dotfiles/hammerspoon/init.lua
2022-03-01 13:27:26 -05:00

36 lines
1.3 KiB
Lua

-- Needed until https://github.com/Hammerspoon/hammerspoon/issues/2478 is fixed
hs.configdir = os.getenv('HOME') .. '/.hammerspoon'
package.path = hs.configdir .. '/?.lua;' .. hs.configdir .. '/?/init.lua;' .. hs.configdir .. '/Spoons/?.spoon/init.lua;' .. package.path
hs.loadSpoon("SpoonInstall")
spoon.SpoonInstall.use_syncinstall = true
spoon.SpoonInstall:andUse("WindowScreenLeftAndRight")
spoon.SpoonInstall:andUse("WindowHalfsAndThirds")
spoon.SpoonInstall:andUse("Commander")
TERMINAL_NAME = "WezTerm"
spoon.WindowScreenLeftAndRight:bindHotkeys(spoon.WindowScreenLeftAndRight.defaultHotkeys)
spoon.WindowHalfsAndThirds:bindHotkeys(spoon.WindowHalfsAndThirds.defaultHotkeys)
hs.hotkey.bind({"cmd", "alt", "ctrl"}, "SPACE", function ()
spoon.Commander.show()
end)
hs.hotkey.bind({"ctrl"}, "t", function ()
local currentApp = hs.window.focusedWindow():application()
if (currentApp:name() == TERMINAL_NAME) then
hs.eventtap.keyStroke({"ctrl"}, "t", 1000, currentApp)
else
hs.application.launchOrFocus(TERMINAL_NAME)
end
end)
hs.hotkey.bind({"cmd", "alt"}, ",", function ()
hs.application.launchOrFocus("System Preferences")
end)
hs.hotkey.bind({"cmd", "shift"}, "l", function ()
hs.application.launchOrFocus("Launchpad")
end)