● skhd
skhd is a simple hotkey daemon for macOS that runs in the background and executes commands when specific key combinations are pressed. It's commonly used with yabai to provide keyboard-driven window management.
Installation
brew install koekeishiya/formulae/skhd
brew services start skhd
Configuration
Configuration lives in ~/.config/skhd/skhdrc. The file is reloaded automatically when saved, or manually with:
skhd --reload
Basic Syntax
# Comments start with #
# Format: modifier + key = command
alt + return = exec open -n /Applications/Terminal.app
Modifiers
alt- Option keyctrl- Control keyshift- Shift keycmd- Command keyfn- Function key
Keys
return- Enter keyspace- Space barescape- Escape keytab- Tab keydelete- Delete key- Letters:
athroughz - Numbers:
0through9 - Function keys:
f1throughf35
Common Patterns
Window Management with Yabai
# Focus windows
alt + h : yabai -m window --focus west
alt + j : yabai -m window --focus south
alt + k : yabai -m window --focus north
alt + l : yabai -m window --focus east
# Move windows
alt + shift + h : yabai -m window --warp west
alt + shift + j : yabai -m window --warp south
alt + shift + k : yabai -m window --warp north
alt + shift + l : yabai -m window --warp east
Application Launching
alt + return : exec open -n /Applications/Terminal.app
alt + b : exec open -a /Applications/Safari.app
alt + e : exec open -a /Applications/Visual\ Studio\ Code.app
Space Management
alt + 1 : yabai -m space --focus 1
alt + 2 : yabai -m space --focus 2
alt + 3 : yabai -m space --focus 3
Advanced Features
Multiple Commands
alt + t : exec terminal; exec say "terminal opened"
Conditional Execution
# Only run if yabai is running
alt + r : launch yabai -m window --focus && yabai -m window --focus next
Key Chords
# Press alt, then x, then c
alt > x > c : exec echo "key chord activated"
Mode Switching
# Define a mode
alt + m : mode launch
launch > a : exec open -a /Applications/AppStore.app
launch > s : exec open -a /Applications/Safari.app
launch > escape : mode default
Service Management
| Command | Action |
|---|---|
brew services start skhd |
Start skhd service |
brew services stop skhd |
Stop skhd service |
brew services restart skhd |
Restart skhd service |
skhd --reload |
Reload configuration without restart |
Troubleshooting
Keys not working:
- Check System Settings → Privacy & Security → Accessibility
- Ensure skhd has permission
- Restart skhd:
brew services restart skhd
Configuration not loading:
- Check syntax with
skhd --load-config - Verify file path:
~/.config/skhd/skhdrc - Check for syntax errors (missing colons, invalid keys)
Conflicts with macOS:
- Some key combinations are reserved by macOS
- Use different modifiers or keys
- Check System Settings → Keyboard → Keyboard Shortcuts
Sample Minimal Config
# Focus windows
alt + h : yabai -m window --focus west
alt + j : yabai -m window --focus south
alt + k : yabai -m window --focus north
alt + l : yabai -m window --focus east
# Move windows
alt + shift + h : yabai -m window --warp west
alt + shift + j : yabai -m window --warp south
alt + shift + k : yabai -m window --warp north
alt + shift + l : yabai -m window --warp east
# Resize windows
alt + r : yabai -m window --toggle zoom-parent
alt + e : yabai -m window --toggle split
# Float toggle
alt + space : yabai -m window --toggle float
# Restart yabai
alt + shift + r : launch yabai --restart-service
skhd is lightweight and fast—key presses are registered almost instantly, making it ideal for keyboard-driven workflows. The configuration is simple but powerful, enabling complex automation through keybindings.
- Links to
- yabai
- Linked from
- skhd Advanced Features · skhd Configuration · Yabai Shortcuts