From 1f83e90a7391ffe984e19aaa6f941db29176629e Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Fri, 25 Dec 2015 06:43:57 -0500 Subject: [PATCH] keybinds.lua -> bindings.lua --- hammerspoon/bindings.lua | 32 ++++++++++++++++++++++++++++++++ hammerspoon/keybinds.lua | 17 ----------------- 2 files changed, 32 insertions(+), 17 deletions(-) create mode 100644 hammerspoon/bindings.lua delete mode 100644 hammerspoon/keybinds.lua diff --git a/hammerspoon/bindings.lua b/hammerspoon/bindings.lua new file mode 100644 index 00000000..e9612f33 --- /dev/null +++ b/hammerspoon/bindings.lua @@ -0,0 +1,32 @@ +-- +commandMode = hs.hotkey.modal.new('cmd', 'escape') + +-- Screen overlay +local f = hs.screen.primaryScreen():frame() +local r = hs.drawing.rectangle(hs.geometry(0, 0, f.w, f.h + 30)) +r:setAlpha(0.5) +r:setFillColor(hs.drawing.color.black) +r:bringToFront() + +-- +function commandMode:entered() hs.alert("Command mode!"); r:show() end +function commandMode:exited() r:hide(); hs.alert("Bye bye") end + +-- Command mode keybindings +hs.fnutils.each({ + { '', 'escape', util.call(commandMode, 'exit') }, + { '', 'r', util.reload }, + { 'shift', 'r', hs.openConsole }, +}, function (item) + commandMode:bind(item[1], item[2], item[3]) +end) + +-- Global keybindings +hs.fnutils.each({ + -- { {'cmd', 'ctrl'}, 'up', function() print("UP") end }, + -- { {'cmd', 'ctrl'}, 'left', function() print("LEFT") end }, + -- { {'cmd', 'ctrl'}, 'right', function() print("RIGHT") end }, +}, function (item) + hs.hotkey.bind(item[1], item[2], item[3]) +end) + diff --git a/hammerspoon/keybinds.lua b/hammerspoon/keybinds.lua deleted file mode 100644 index 013597c8..00000000 --- a/hammerspoon/keybinds.lua +++ /dev/null @@ -1,17 +0,0 @@ -k = hs.hotkey.modal.new('cmd', 'escape') - - --- Screen overlay -local f = screen:frame() -local r = hs.drawing.rectangle(hs.geometry(0, 0, f.w, f.h + 30)) -r:setAlpha(0.5) -r:setFillColor(hs.drawing.color.black) -r:bringToFront() - -function k:entered() hs.alert("Command mode!"); r:show() end -function k:exited() r:hide(); hs.alert("Bye bye") end - - --- Bindings -k:bind('', 'escape', function() k:exit() end) -k:bind('', 'r', function() core.reload() end)