Skip to Content

MacOS - skhd hotkey

Posted on


Every time I wish to switch between windows, I must use ⌘ + tab, which is rather inconvenient. Similarly, to open a new iTerm, I have to use ⌘ + space to access Alfred, then type “iTerm” to launch it. This process is equally cumbersome.


skhd is a simple hotkey daemon for macOS. We can use it to define hotkeys to switch between windows, open terminal, etc.


brew install koekeishiya/formulae/skhd
skhd --start-service


Create a file ~/.skhdrc and add the following content:

# Opens app
# Switch to or open app
lctrl + shift - h : osascript "${HOME}"/.config/yabai/scripts/toggle_app.scpt "Google Chrome"
lctrl + shift - j : osascript "${HOME}"/.config/yabai/scripts/toggle_app.scpt "Slack"
lctrl + shift - k : osascript "${HOME}"/.config/yabai/scripts/toggle_app.scpt "iTerm"
lctrl + shift - l : osascript "${HOME}"/.config/yabai/scripts/toggle_app.scpt "Obsidian"
lctrl + shift - m : osascript "${HOME}"/.config/yabai/scripts/toggle_app.scpt "Messenger"
# toggle app.scpt

on run argv
    set appName to item 1 of argv
    if application appName is running then
        tell application appName
        end tell
        tell application appName
        end tell
    end if
end run

Now, we can use lctrl + shift - h to switch to or open Google Chrome, lctrl + shift - j to switch to or open Slack, etc. Or you can config other hotkeys as you want. eg: alt - g to open Google Chrome, alt - s to open Slack, etc.

You can read more configuration in my ~/.skhdrc

comments powered by Disqus