Skip to content

Commit 6151ba9

Browse files
authored
Merge pull request #8 from jokajak/master
Support SpoonInstall and expose API
2 parents 9131e41 + 98344ad commit 6151ba9

File tree

9 files changed

+69
-10
lines changed

9 files changed

+69
-10
lines changed

Lunette.spoon.zip

-4.13 KB
Binary file not shown.

Makefile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
ZIPDIR=Spoons
2+
SRCDIR=Source
3+
SOURCES := $(wildcard $(SRCDIR)/*.spoon)
4+
SPOONS := $(patsubst $(SRCDIR)/%, $(ZIPDIR)/%.zip, $(SOURCES))
5+
ZIP=/usr/bin/zip
6+
7+
all: $(SPOONS)
8+
9+
clean:
10+
rm -f $(ZIPDIR)/*.zip
11+
12+
$(ZIPDIR)/%.zip: $(SRCDIR)/%
13+
rm -f $@
14+
cd $(SRCDIR) ; $(ZIP) -9 -r ../$@ $(patsubst $(SRCDIR)/%, %, $<)
15+
16+
.PHONY: clean
Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ obj.__index = obj
33

44
-- Metadata
55
obj.name = "Lunette"
6-
obj.version = "0.2"
6+
obj.version = "0.3"
77
obj.author = "Scott Hudson <scott.w.hudson@gmail.com>"
88
obj.license = "MIT"
99
obj.homepage = "https://github.com/scottwhudson/Lunette"
@@ -18,10 +18,10 @@ local function script_path()
1818
end
1919
obj.spoonPath = script_path()
2020

21-
Command = dofile(obj.spoonPath.."/command.lua")
22-
history = dofile(obj.spoonPath.."/history.lua"):init()
21+
obj.Command = dofile(obj.spoonPath.."/command.lua")
22+
obj.history = dofile(obj.spoonPath.."/history.lua"):init()
2323

24-
DefaultMapping = {
24+
obj.DefaultMapping = {
2525
leftHalf = {
2626
{{"cmd", "alt"}, "left"},
2727
},
@@ -92,14 +92,14 @@ function obj:bindHotkeys(userBindings)
9292
if mappings then
9393
for i, binding in ipairs(mappings) do
9494
hs.hotkey.bind(binding[1], binding[2], function()
95-
exec(command)
95+
self:exec(command)
9696
end)
9797
end
9898
end
9999
end
100100
end
101101

102-
function exec(commandName)
102+
function obj:exec(commandName)
103103
local window = hs.window.focusedWindow()
104104
local windowFrame = window:frame()
105105
local screen = window:screen()
@@ -108,12 +108,14 @@ function exec(commandName)
108108
local newFrame
109109

110110
if commandName == "undo" then
111-
newFrame = history:retrievePrevState()
111+
newFrame = self.history:retrievePrevState()
112112
elseif commandName == "redo" then
113-
newFrame = history:retrieveNextState()
113+
newFrame = self.history:retrieveNextState()
114114
else
115-
newFrame = Command[commandName](windowFrame, screenFrame)
116-
history:push(currentFrame, newFrame)
115+
print("Lunette: " .. commandName)
116+
print(self.Command[commandName])
117+
newFrame = self.Command[commandName](windowFrame, screenFrame)
118+
self.history:push(currentFrame, newFrame)
117119
end
118120

119121
window:setFrame(newFrame)

Spoons/Lunette.spoon.zip

4.14 KB
Binary file not shown.

docs/docs.json

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
[
2+
{
3+
"Constant" : [
4+
5+
],
6+
"submodules" : [
7+
8+
],
9+
"Function" : [
10+
11+
],
12+
"Variable" : [
13+
14+
],
15+
"stripped_doc" : [
16+
17+
],
18+
"type" : "Module",
19+
"desc" : "Lunette is an easily configurable and extendible Hammerspoon package that implements all of the Spectacle keybindings.",
20+
"Deprecated" : [
21+
22+
],
23+
"Constructor" : [
24+
25+
],
26+
"Field" : [
27+
28+
],
29+
"Method" : [
30+
31+
],
32+
"Command" : [
33+
34+
],
35+
"doc" : "Spectacle Window Manager Keybindings For Hammerspoon",
36+
"items" : [
37+
38+
],
39+
"name" : "Lunette"
40+
}
41+
]

0 commit comments

Comments
 (0)