helm/hammerspoon/bindings.lua

33 lines
1 KiB
Lua
Raw Normal View History

2015-12-25 03:43:57 -08:00
--
commandMode = hs.hotkey.modal.new('cmd', 'escape')
-- Screen overlay
local f = hs.screen.primaryScreen():frame()
2015-12-26 23:29:38 -08:00
local overlay = hs.drawing.rectangle(hs.geometry(0, 0, f.w, f.h + 30))
overlay:setAlpha(0.5)
overlay:setFillColor(hs.drawing.color.black)
overlay:bringToFront()
2015-12-25 03:43:57 -08:00
--
2015-12-26 23:29:38 -08:00
function commandMode:entered() overlay:show() end
function commandMode:exited() overlay:hide() end
2015-12-25 03:43:57 -08:00
-- Command mode keybindings
hs.fnutils.each({
2016-01-02 12:40:13 -08:00
{ '', 'escape', util.call(commandMode, 'exit') },
{ '', 'r', util.reload },
{ 'shift', 'r', function() hs.openConsole(); commandMode:exit() end },
2015-12-25 03:43:57 -08:00
}, function (item)
2016-01-02 12:40:13 -08:00
commandMode:bind(item[1], item[2], item[3])
2015-12-25 03:43:57 -08:00
end)
-- Global keybindings
hs.fnutils.each({
2016-01-02 12:40:13 -08:00
-- { {'cmd', 'ctrl'}, 'up', function() print("UP"); modes.position:enter() end },
-- { {'cmd', 'ctrl'}, 'left', function() print("LEFT"); resizeBRMode:enter() end },
-- { {'cmd', 'ctrl'}, 'right', function() print("RIGHT"); resizeTLMode:enter() end },
2015-12-25 03:43:57 -08:00
}, function (item)
2016-01-02 12:40:13 -08:00
hs.hotkey.bind(item[1], item[2], item[3])
2015-12-25 03:43:57 -08:00
end)