删除无用文件

This commit is contained in:
sugood 2020-10-24 23:40:21 +08:00
parent abf9f7d414
commit cfc23162b2
5 changed files with 10 additions and 744 deletions

20
.idea/workspace.xml generated
View File

@ -2,10 +2,10 @@
<project version="4"> <project version="4">
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="495daa03-3ea5-4e8c-9013-c532511d508b" name="Default" comment=""> <list default="true" id="495daa03-3ea5-4e8c-9013-c532511d508b" name="Default" comment="">
<change beforePath="" afterPath="$PROJECT_DIR$/README_en.md" /> <change beforePath="$PROJECT_DIR$/Spoons/Caffeine.spoon/caffeine-off.pdf" afterPath="" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" /> <change beforePath="$PROJECT_DIR$/Spoons/Caffeine.spoon/caffeine-on.pdf" afterPath="" />
<change beforePath="$PROJECT_DIR$/README.md" afterPath="$PROJECT_DIR$/README.md" /> <change beforePath="$PROJECT_DIR$/Spoons/Caffeine.spoon/docs.json" afterPath="" />
<change beforePath="$PROJECT_DIR$/README_zh-CN.md" afterPath="" /> <change beforePath="$PROJECT_DIR$/Spoons/Caffeine.spoon/init.lua" afterPath="" />
</list> </list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" /> <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="TRACKING_ENABLED" value="true" /> <option name="TRACKING_ENABLED" value="true" />
@ -40,8 +40,8 @@
<entry file="file://$PROJECT_DIR$/README_en.md"> <entry file="file://$PROJECT_DIR$/README_en.md">
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]"> <provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
<state split_layout="SPLIT"> <state split_layout="SPLIT">
<first_editor relative-caret-position="444"> <first_editor relative-caret-position="369">
<caret line="87" column="15" lean-forward="true" selection-start-line="87" selection-start-column="15" selection-end-line="87" selection-end-column="15" /> <caret line="82" column="24" lean-forward="true" selection-start-line="82" selection-start-column="24" selection-end-line="82" selection-end-column="24" />
<folding /> <folding />
</first_editor> </first_editor>
<second_editor /> <second_editor />
@ -416,12 +416,12 @@
<workItem from="1602910724222" duration="3375000" /> <workItem from="1602910724222" duration="3375000" />
<workItem from="1602916148688" duration="33848000" /> <workItem from="1602916148688" duration="33848000" />
<workItem from="1603074238740" duration="59948000" /> <workItem from="1603074238740" duration="59948000" />
<workItem from="1603457165086" duration="42076000" /> <workItem from="1603457165086" duration="42137000" />
</task> </task>
<servers /> <servers />
</component> </component>
<component name="TimeTrackingManager"> <component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="172789000" /> <option name="totallyTimeSpent" value="172850000" />
</component> </component>
<component name="ToolWindowManager"> <component name="ToolWindowManager">
<frame x="0" y="23" width="1920" height="1009" extended-state="0" /> <frame x="0" y="23" width="1920" height="1009" extended-state="0" />
@ -832,8 +832,8 @@
<entry file="file://$PROJECT_DIR$/README_en.md"> <entry file="file://$PROJECT_DIR$/README_en.md">
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]"> <provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
<state split_layout="SPLIT"> <state split_layout="SPLIT">
<first_editor relative-caret-position="444"> <first_editor relative-caret-position="369">
<caret line="87" column="15" lean-forward="true" selection-start-line="87" selection-start-column="15" selection-end-line="87" selection-end-column="15" /> <caret line="82" column="24" lean-forward="true" selection-start-line="82" selection-start-column="24" selection-end-line="82" selection-end-column="24" />
<folding /> <folding />
</first_editor> </first_editor>
<second_editor /> <second_editor />

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,143 +0,0 @@
[
{
"Command": [],
"Constant": [],
"Constructor": [],
"Deprecated": [],
"Field": [],
"Function": [],
"Method": [
{
"def": "Caffeine:bindHotkeys(mapping)",
"desc": "Binds hotkeys for Caffeine",
"doc": "Binds hotkeys for Caffeine\n\nParameters:\n * mapping - A table containing hotkey modifier/key details for the following items:\n * toggle - This will toggle the state of display sleep prevention, and update the menubar graphic\n\nReturns:\n * The Caffeine object",
"name": "bindHotkeys",
"parameters": [
" * mapping - A table containing hotkey modifier/key details for the following items:",
" * toggle - This will toggle the state of display sleep prevention, and update the menubar graphic"
],
"returns": [
" * The Caffeine object"
],
"signature": "Caffeine:bindHotkeys(mapping)",
"stripped_doc": "",
"type": "Method"
},
{
"def": "Caffeine:setState(on)",
"desc": "Sets whether or not caffeination should be enabled",
"doc": "Sets whether or not caffeination should be enabled\n\nParameters:\n * on - A boolean, true if screens should be kept awake, false to let macOS send them to sleep\n\nReturns:\n * None",
"name": "setState",
"parameters": [
" * on - A boolean, true if screens should be kept awake, false to let macOS send them to sleep"
],
"returns": [
" * None"
],
"signature": "Caffeine:setState(on)",
"stripped_doc": "",
"type": "Method"
},
{
"def": "Caffeine:start()",
"desc": "Starts Caffeine",
"doc": "Starts Caffeine\n\nParameters:\n * None\n\nReturns:\n * The Caffeine object",
"name": "start",
"parameters": [
" * None"
],
"returns": [
" * The Caffeine object"
],
"signature": "Caffeine:start()",
"stripped_doc": "",
"type": "Method"
},
{
"def": "Caffeine:stop()",
"desc": "Stops Caffeine",
"doc": "Stops Caffeine\n\nParameters:\n * None\n\nReturns:\n * The Caffeine object",
"name": "stop",
"parameters": [
" * None"
],
"returns": [
" * The Caffeine object"
],
"signature": "Caffeine:stop()",
"stripped_doc": "",
"type": "Method"
}
],
"Variable": [],
"desc": "Prevent the screen from going to sleep",
"doc": "Prevent the screen from going to sleep\nDownload: [https://github.com/Hammerspoon/Spoons/raw/master/Spoons/Caffeine.spoon.zip](https://github.com/Hammerspoon/Spoons/raw/master/Spoons/Caffeine.spoon.zip)",
"items": [
{
"def": "Caffeine:bindHotkeys(mapping)",
"desc": "Binds hotkeys for Caffeine",
"doc": "Binds hotkeys for Caffeine\n\nParameters:\n * mapping - A table containing hotkey modifier/key details for the following items:\n * toggle - This will toggle the state of display sleep prevention, and update the menubar graphic\n\nReturns:\n * The Caffeine object",
"name": "bindHotkeys",
"parameters": [
" * mapping - A table containing hotkey modifier/key details for the following items:",
" * toggle - This will toggle the state of display sleep prevention, and update the menubar graphic"
],
"returns": [
" * The Caffeine object"
],
"signature": "Caffeine:bindHotkeys(mapping)",
"stripped_doc": "",
"type": "Method"
},
{
"def": "Caffeine:setState(on)",
"desc": "Sets whether or not caffeination should be enabled",
"doc": "Sets whether or not caffeination should be enabled\n\nParameters:\n * on - A boolean, true if screens should be kept awake, false to let macOS send them to sleep\n\nReturns:\n * None",
"name": "setState",
"parameters": [
" * on - A boolean, true if screens should be kept awake, false to let macOS send them to sleep"
],
"returns": [
" * None"
],
"signature": "Caffeine:setState(on)",
"stripped_doc": "",
"type": "Method"
},
{
"def": "Caffeine:start()",
"desc": "Starts Caffeine",
"doc": "Starts Caffeine\n\nParameters:\n * None\n\nReturns:\n * The Caffeine object",
"name": "start",
"parameters": [
" * None"
],
"returns": [
" * The Caffeine object"
],
"signature": "Caffeine:start()",
"stripped_doc": "",
"type": "Method"
},
{
"def": "Caffeine:stop()",
"desc": "Stops Caffeine",
"doc": "Stops Caffeine\n\nParameters:\n * None\n\nReturns:\n * The Caffeine object",
"name": "stop",
"parameters": [
" * None"
],
"returns": [
" * The Caffeine object"
],
"signature": "Caffeine:stop()",
"stripped_doc": "",
"type": "Method"
}
],
"name": "Caffeine",
"stripped_doc": "Download: [https://github.com/Hammerspoon/Spoons/raw/master/Spoons/Caffeine.spoon.zip](https://github.com/Hammerspoon/Spoons/raw/master/Spoons/Caffeine.spoon.zip)",
"submodules": [],
"type": "Module"
}
]

View File

@ -1,119 +0,0 @@
--- === Caffeine ===
---
--- Prevent the screen from going to sleep
--- Download: [https://github.com/Hammerspoon/Spoons/raw/master/Spoons/Caffeine.spoon.zip](https://github.com/Hammerspoon/Spoons/raw/master/Spoons/Caffeine.spoon.zip)
local obj = { __gc = true }
--obj.__index = obj
setmetatable(obj, obj)
obj.__gc = function(t)
t:stop()
end
-- Metadata
obj.name = "Caffeine"
obj.version = "1.0"
obj.author = "Chris Jones <cmsj@tenshu.net>"
obj.homepage = "https://github.com/Hammerspoon/Spoons"
obj.license = "MIT - https://opensource.org/licenses/MIT"
obj.menuBarItem = nil
obj.hotkeyToggle = nil
-- Internal function used to find our location, so we know where to load files from
local function script_path()
local str = debug.getinfo(2, "S").source:sub(2)
return str:match("(.*/)")
end
obj.spoonPath = script_path()
function obj:init()
end
--- Caffeine:bindHotkeys(mapping)
--- Method
--- Binds hotkeys for Caffeine
---
--- Parameters:
--- * mapping - A table containing hotkey modifier/key details for the following items:
--- * toggle - This will toggle the state of display sleep prevention, and update the menubar graphic
---
--- Returns:
--- * The Caffeine object
function obj:bindHotkeys(mapping)
if (self.hotkeyToggle) then
self.hotkeyToggle:delete()
end
local toggleMods = mapping["toggle"][1]
local toggleKey = mapping["toggle"][2]
self.hotkeyToggle = hs.hotkey.new(toggleMods, toggleKey, function() self.clicked() end)
return self
end
--- Caffeine:start()
--- Method
--- Starts Caffeine
---
--- Parameters:
--- * None
---
--- Returns:
--- * The Caffeine object
function obj:start()
if self.menuBarItem then self:stop() end
self.menuBarItem = hs.menubar.new()
self.menuBarItem:setClickCallback(self.clicked)
if (self.hotkeyToggle) then
self.hotkeyToggle:enable()
end
self.setDisplay(hs.caffeinate.get("displayIdle"))
return self
end
--- Caffeine:stop()
--- Method
--- Stops Caffeine
---
--- Parameters:
--- * None
---
--- Returns:
--- * The Caffeine object
function obj:stop()
if self.menuBarItem then self.menuBarItem:delete() end
if (self.hotkeyToggle) then
self.hotkeyToggle:disable()
end
self.menuBarItem = nil
return self
end
function obj.setDisplay(state)
local result
if state then
result = obj.menuBarItem:setIcon(obj.spoonPath.."/caffeine-on.pdf")
else
result = obj.menuBarItem:setIcon(obj.spoonPath.."/caffeine-off.pdf")
end
end
function obj.clicked()
obj.setDisplay(hs.caffeinate.toggle("displayIdle"))
end
--- Caffeine:setState(on)
--- Method
--- Sets whether or not caffeination should be enabled
---
--- Parameters:
--- * on - A boolean, true if screens should be kept awake, false to let macOS send them to sleep
---
--- Returns:
--- * None
function obj:setState(on)
hs.caffeinate.set("displayIdle", on)
obj.setDisplay(on)
end
return obj