Skip to content

Instantly share code, notes, and snippets.

@bavovna
Last active February 15, 2026 00:58
Show Gist options
  • Select an option

  • Save bavovna/fb1a2c0073ba1bb2ac0e8da7a82321b3 to your computer and use it in GitHub Desktop.

Select an option

Save bavovna/fb1a2c0073ba1bb2ac0e8da7a82321b3 to your computer and use it in GitHub Desktop.
local function toggleApp(appName, newWindowMenuItem)
local app = hs.application.get(appName)
if app then
if not app:mainWindow() then
app:selectMenuItem({appName, newWindowMenuItem})
elseif app:isFrontmost() then
app:hide()
else
app:activate()
end
else
hs.application.launchOrFocus(appName)
end
end
-- Bind hotkeys to toggle ghostty, kitty, alacritty
hs.hotkey.bind({"ctrl", "shift"}, "`", function()
toggleApp("ghostty", "New OS window")
end)
hs.hotkey.bind({"ctrl", "shift"}, "-", function()
toggleApp("alacritty", "New OS window")
end)
hs.hotkey.bind({"ctrl", "shift"}, "=", function()
toggleApp("kitty", "New OS window")
end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment