diff --git a/hammerspoon/init.lua b/hammerspoon/init.lua index 8c488f7..c7a8e4c 100644 --- a/hammerspoon/init.lua +++ b/hammerspoon/init.lua @@ -8,6 +8,8 @@ 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) @@ -17,7 +19,12 @@ hs.hotkey.bind({"cmd", "alt", "ctrl"}, "SPACE", function () end) hs.hotkey.bind({"ctrl"}, "t", function () - hs.application.launchOrFocus("Wezterm") + 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 ()