Created
October 24, 2025 11:41
-
-
Save gsamat/f8d98293fc5508ae05ec51aba595908d to your computer and use it in GitHub Desktop.
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 characters
| hs.hotkey.bind({"ctrl"}, "a", function() | |
| hs.application.launchOrFocus("Safari") | |
| end) | |
| hs.hotkey.bind({"ctrl"}, "n", function() | |
| hs.application.launchOrFocus("Notes") | |
| end) | |
| hs.hotkey.bind({"ctrl"}, "m", function() | |
| hs.application.launchOrFocus("Mail") | |
| end) | |
| hs.hotkey.bind({"ctrl"}, "w", function() | |
| hs.application.launchOrFocus("iA Writer") | |
| end) | |
| hs.hotkey.bind({"ctrl"}, "s", function() | |
| hs.application.launchOrFocus("Sublime Text") | |
| end) | |
| ctrlchotkey = hs.hotkey.bind({"ctrl"}, "c", function() | |
| local frontApp = hs.application.frontmostApplication() | |
| if frontApp:name() == "Terminal" or frontApp:name() == "Warp" then | |
| ctrlchotkey:disable() | |
| hs.eventtap.keyStroke({"ctrl"}, "c") | |
| ctrlchotkey:enable() | |
| return | |
| end | |
| hs.application.launchOrFocus("Google Chrome") | |
| end) | |
| -- from https://github.com/Hammerspoon/hammerspoon/issues/664 | |
| hs.hotkey.bind({"ctrl"}, "l", function() | |
| hs.application.launchOrFocus("Calendar") | |
| end) | |
| hs.hotkey.bind({"ctrl"}, "t", function() | |
| hs.application.launchOrFocus("Telegram") | |
| end) | |
| hs.hotkey.bind({"ctrl"}, "z", function() | |
| hs.application.launchOrFocus("zoom.us") | |
| end) | |
| hs.hotkey.bind({"ctrl"}, "q", function() | |
| hs.application.launchOrFocus("Things3") | |
| end) | |
| hs.hotkey.bind({"ctrl"}, "p", function() | |
| hs.application.launchOrFocus("iA Presenter") | |
| end) | |
| hs.hotkey.bind({"ctrl"}, "x", function() | |
| hs.application.launchOrFocus("Warp") | |
| end) | |
| hs.hotkey.bind({"ctrl", "alt"}, "0", function() | |
| local win = hs.window.focusedWindow() | |
| if win then | |
| win:setSize({w=1280, h=799}) -- Customize x/y here | |
| end | |
| end) | |
| hs.hotkey.bind({"ctrl"}, "b", function() | |
| hs.urlevent.openURL("https://3.basecamp.com/5104612/buckets/24362112/todolists/4233472251") | |
| end) | |
| hs.hotkey.bind({"cmd", "shift"}, "v", function() | |
| hs.eventtap.keyStrokes(hs.pasteboard.getContents()) | |
| end) | |
| hs.hotkey.bind({"ctrl"}, "g", function() | |
| hs.urlevent.openURL("https://www.google.com/search?q=" .. hs.pasteboard.getContents()) | |
| end) | |
| hs.hotkey.bind({"ctrl"}, "d", function() | |
| -- local dirPath = "/Users/samat/Downloads" -- Customize this path | |
| -- local ok, output, err = hs.execute("open " .. dirPath, true) -- true for user-visible (shows terminal if errors) | |
| -- if not ok then | |
| -- hs.alert.show("Failed to open directory: " .. tostring(err)) | |
| -- end | |
| hs.application.launchOrFocus("Finder") | |
| local applescript = [[ | |
| tell application "Finder" | |
| open POSIX file "/Users/samat/Downloads" | |
| set theFolder to "Macintosh HD:Users:samat:Downloads" as alias -- replace with the path to your specific folder | |
| if exists window 1 then | |
| if target of window 1 as alias is equal to theFolder then | |
| set sidebar width of window 1 to 0 -- hides the sidebar | |
| end if | |
| end if | |
| end tell ]] | |
| local ok, result = hs.osascript.applescript(applescript) | |
| if not ok then | |
| hs.alert.show("AppleScript failed: " .. tostring(result)) | |
| end | |
| end) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment