Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
cmsj committed Sep 8, 2017
1 parent ba3e850 commit e7a54ae
Show file tree
Hide file tree
Showing 19 changed files with 1,488 additions and 197 deletions.
27 changes: 27 additions & 0 deletions Spoons/Caffeine.spoon/docs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
[
{
"doc" : "Prevent the screen from going to sleep",
"items" : [
{
"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",
"type" : "Method",
"name" : "bindHotkeys",
"def" : "Caffeine:bindHotkeys(mapping)"
},
{
"doc" : "Starts Caffeine\n\nParameters:\n * None\n\nReturns:\n * The Caffeine object",
"type" : "Method",
"name" : "start",
"def" : "Caffeine:start()"
},
{
"doc" : "Stops Caffeine\n\nParameters:\n * None\n\nReturns:\n * The Caffeine object",
"type" : "Method",
"name" : "stop",
"def" : "Caffeine:stop()"
}
],
"name" : "Caffeine",
"desc" : "Prevent the screen from going to sleep"
}
]
27 changes: 27 additions & 0 deletions Spoons/MouseCircle.spoon/docs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
[
{
"doc" : "Draws a circle around the mouse pointer when a hotkey is pressed",
"items" : [
{
"doc" : "An `hs.drawing.color` table defining the colour of the circle. Defaults to red.",
"type" : "Variable",
"name" : "color",
"def" : "MouseCircle.color"
},
{
"doc" : "Binds hotkeys for MouseCircle\n\nParameters:\n * mapping - A table containing hotkey modifier\/key details for the following items:\n * show - This will cause the mouse circle to be drawn",
"type" : "Method",
"name" : "bindHotkeys",
"def" : "MouseCircle:bindHotkeys(mapping)"
},
{
"doc" : "Draws a circle around the mouse\n\nParameters:\n * None\n\nReturns:\n * None",
"type" : "Method",
"name" : "show",
"def" : "MouseCircle:show()"
}
],
"name" : "MouseCircle",
"desc" : "Draws a circle around the mouse pointer when a hotkey is pressed"
}
]
122 changes: 122 additions & 0 deletions Spoons/RandomWallpaper.spoon/docs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
[
{
"Constant" : [

],
"submodules" : [

],
"Function" : [

],
"Variable" : [
{
"desc" : "The number of seconds to wait before fetching a new wallpaper. Defaults to 600 (10 minutes)",
"stripped_doc" : [
"The number of seconds to wait before fetching a new wallpaper. Defaults to 600 (10 minutes)"
],
"name" : "interval",
"doc" : "The number of seconds to wait before fetching a new wallpaper. Defaults to 600 (10 minutes)",
"notes" : [

],
"signature" : "RandomWallpaper.interval",
"type" : "Variable",
"returns" : [

],
"def" : "RandomWallpaper.interval",
"parameters" : [

]
}
],
"stripped_doc" : [

],
"Deprecated" : [

],
"type" : "Module",
"desc" : "Fetch random wallpaper images from Unsplash (http\/\/unsplash.com)",
"Constructor" : [

],
"Field" : [

],
"items" : [
{
"desc" : "The number of seconds to wait before fetching a new wallpaper. Defaults to 600 (10 minutes)",
"stripped_doc" : [
"The number of seconds to wait before fetching a new wallpaper. Defaults to 600 (10 minutes)"
],
"name" : "interval",
"doc" : "The number of seconds to wait before fetching a new wallpaper. Defaults to 600 (10 minutes)",
"notes" : [

],
"signature" : "RandomWallpaper.interval",
"type" : "Variable",
"returns" : [

],
"def" : "RandomWallpaper.interval",
"parameters" : [

]
},
{
"desc" : "Starts the random wallpaper updates",
"stripped_doc" : [
"Starts the random wallpaper updates",
""
],
"name" : "start",
"doc" : "Starts the random wallpaper updates\n\nParameters:\n * None\n\nReturns:\n * None",
"notes" : [

],
"signature" : "RandomWallpaper:start()",
"type" : "Method",
"returns" : [
" * None"
],
"def" : "RandomWallpaper:start()",
"parameters" : [
" * None",
""
]
}
],
"Command" : [

],
"Method" : [
{
"desc" : "Starts the random wallpaper updates",
"stripped_doc" : [
"Starts the random wallpaper updates",
""
],
"name" : "start",
"doc" : "Starts the random wallpaper updates\n\nParameters:\n * None\n\nReturns:\n * None",
"notes" : [

],
"signature" : "RandomWallpaper:start()",
"type" : "Method",
"returns" : [
" * None"
],
"def" : "RandomWallpaper:start()",
"parameters" : [
" * None",
""
]
}
],
"doc" : "Fetch random wallpaper images from Unsplash (http\/\/unsplash.com)",
"name" : "RandomWallpaper"
}
]
66 changes: 66 additions & 0 deletions Spoons/RandomWallpaper.spoon/init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
--- === RandomWallpaper ===
---
--- Fetch random wallpaper images from Unsplash (http//unsplash.com)

local obj = {}
obj.__index = obj

-- Metadata
obj.name = "RandomWallpaper"
obj.version = "1.0"
obj.author = "Chris Jones <[email protected]>"
obj.homepage = "https://github.com/Hammerspoon/Spoons"
obj.license = "MIT - https://opensource.org/licenses/MIT"

obj.timer = nil

--- RandomWallpaper.interval
--- Variable
--- The number of seconds to wait before fetching a new wallpaper. Defaults to 600 (10 minutes)
obj.interval = 600

--- RandomWallpaper:start()
--- Method
--- Starts the random wallpaper updates
---
--- Parameters:
--- * None
---
--- Returns:
--- * None
function obj:show()
circle = self.circle
timer = self.timer

if circle then
circle:delete()
if timer then
timer:stop()
end
end

mousepoint = hs.mouse.getAbsolutePosition()

local color = nil
if (self.color) then
color = self.color
else
color = {["red"]=1,["blue"]=0,["green"]=0,["alpha"]=1}
end
circle = hs.drawing.circle(hs.geometry.rect(mousepoint.x-40, mousepoint.y-40, 80, 80))
circle:setStrokeColor(color)
circle:setFill(false)
circle:setStrokeWidth(5)
circle:bringToFront(true)
circle:show(0.5)
self.circle = circle

self.timer = hs.timer.doAfter(3, function()
self.circle:hide(0.5)
hs.timer.doAfter(0.6, function() self.circle:delete() end)
end)

return self
end

return obj
Loading

0 comments on commit e7a54ae

Please sign in to comment.