Last active
January 23, 2025 04:41
-
-
Save rstacruz/34893af9ff16e9e4bbfd79f998a66fc1 to your computer and use it in GitHub Desktop.
Revisions
-
rstacruz revised this gist
Jan 23, 2025 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -14,6 +14,7 @@ local MODS = { "ctrl", "cmd" } local SHIFT_MODS = { "shift", "ctrl", "cmd" } local LAUNCHER_APPS = { -- these keys are mostly on the left hand side (qwerty/colemak) { key = "v", app = "Visual Studio Code" }, -- "[v]scode" { key = "t", app = "Ghostty" }, -- "[t]erminal" { key = "w", app = "Firefox" }, -- "[w]eb" @@ -22,7 +23,7 @@ local LAUNCHER_APPS = { { key = "s", app = "Slack" }, { key = "z", app = "zoom.us" }, { key = "f", app = "Finder" }, { key = "p", app = "Spotify" }, -- [p]layer { key = "a", app = "Obsidian" }, } -
rstacruz revised this gist
Jan 23, 2025 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -59,7 +59,7 @@ end local function setup() bindLauncherKeys(LAUNCHER_APPS, { mods = MODS }) bindLauncherKeys(LAUNCHER_APPS_SHIFT, { mods = SHIFT_MODS }) end return { setup = setup } -
rstacruz revised this gist
Jan 23, 2025 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -17,7 +17,7 @@ local LAUNCHER_APPS = { { key = "v", app = "Visual Studio Code" }, -- "[v]scode" { key = "t", app = "Ghostty" }, -- "[t]erminal" { key = "w", app = "Firefox" }, -- "[w]eb" { key = "m", app = "Microsoft Outlook", label = "Outlook" }, -- "[m]ail" { key = "b", app = "Bruno" }, { key = "s", app = "Slack" }, { key = "z", app = "zoom.us" }, -
rstacruz revised this gist
Jan 23, 2025 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -18,7 +18,7 @@ local LAUNCHER_APPS = { { key = "t", app = "Ghostty" }, -- "[t]erminal" { key = "w", app = "Firefox" }, -- "[w]eb" { key = "m", app = "Microsoft Outlook", label = "Outlook" }, { key = "b", app = "Bruno" }, { key = "s", app = "Slack" }, { key = "z", app = "zoom.us" }, { key = "f", app = "Finder" }, -
rstacruz revised this gist
Jan 23, 2025 . 1 changed file with 0 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -24,7 +24,6 @@ local LAUNCHER_APPS = { { key = "f", app = "Finder" }, { key = "b", app = "Spotify" }, { key = "a", app = "Obsidian" }, } local LAUNCHER_APPS_SHIFT = { -
rstacruz created this gist
Jan 23, 2025 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,66 @@ -- Rico's hammerspoon launcher config -- -- usage: -- * press `ctrl-cmd-w` to switch-or-launch Firefox -- * update the shortcuts below to your liking -- -- installation: -- * save as ~/.hammerspoon/mods/launcher.lua -- * add this to ~/.hammerspoon/init.lua: `require("mods.launcher").setup()` -- -- ...alternatively just paste all these directly into init.lua (without the `return`) and run setup() local MODS = { "ctrl", "cmd" } local SHIFT_MODS = { "shift", "ctrl", "cmd" } local LAUNCHER_APPS = { { key = "v", app = "Visual Studio Code" }, -- "[v]scode" { key = "t", app = "Ghostty" }, -- "[t]erminal" { key = "w", app = "Firefox" }, -- "[w]eb" { key = "m", app = "Microsoft Outlook", label = "Outlook" }, { key = "c", app = "Bruno" }, { key = "s", app = "Slack" }, { key = "z", app = "zoom.us" }, { key = "f", app = "Finder" }, { key = "b", app = "Spotify" }, { key = "a", app = "Obsidian" }, { key = "p", app = "Google Chrome" }, -- "[w]eb" } local LAUNCHER_APPS_SHIFT = { { key = "w", app = "Google Chrome" }, -- "[w]eb" } local function activateApp(app) local win = hs.window.focusedWindow() if win and win:application():name() == app then -- If it's already focused, switch to next window hs.eventtap.keyStroke({ "cmd" }, "`") else -- Else, focus it hs.application.launchOrFocus(app) end end local function bindLauncherKeys(apps, options) for _, action in ipairs(apps) do local label = action.label or action.app hs.hotkey.bind(options.mods, action.key, label, function() if action.activate then action.activate() else activateApp(action.app) end if options.onactivate then options.onactivate() end end) end end local function setup() bindLauncherKeys(LAUNCHER_APPS, { mods = MODS }) bindLauncherKeys(LAUNCHER_APPS_SHIFT, { mods = SHIFT_MODS) end return { setup = setup }