● skhd Advanced Features
skhd supports advanced features like key chords, mode switching, and conditional execution for complex keyboard workflows.
Multiple Commands
Chain multiple commands with ;:
alt + t : exec terminal; exec say "terminal opened"
Conditional Execution
Run commands conditionally using shell logic:
# Only run if yabai is running
alt + r : launch yabai -m window --focus && yabai -m window --focus next
Key Chords
Sequential key presses for complex actions:
# Press alt, then x, then c
alt > x > c : exec echo "key chord activated"
# Longer sequences
alt > a > b > c : exec echo "three key chord"
Mode Switching
Create temporary keybinding modes:
# Define a mode
alt + m : mode launch
# Mode-specific bindings
launch > a : exec open -a /Applications/AppStore.app
launch > s : exec open -a /Applications/Safari.app
launch > escape : mode default
Application-Specific Bindings
Bind keys only for specific applications:
# Only in Terminal
alt + t [Terminal] : exec echo "Terminal specific"
# Exclude from specific apps
alt + t [~Terminal] : exec echo "Not in Terminal"
# Wildcard for all apps
alt + t [*] : exec echo "All apps"
Forwarding Keystrokes
Forward keystrokes to the application instead of consuming them:
# Forward alt + c to application
alt > c -> : exec echo "Forwarded"
Modifier Variants
Use different modifier combinations:
# Basic binding
alt + a : exec echo "alt a"
# Shift variant
alt + shift + a : exec echo "alt shift a"
# Control variant
alt + ctrl + a : exec echo "alt ctrl a"
Complex Mode Logic
Create nested mode systems:
# Main mode switcher
alt + 1 : mode workspace
alt + 2 : mode media
alt + 3 : mode system
# Workspace mode
workspace > h : yabai -m window --focus west
workspace > j : yabai -m window --focus south
workspace > escape : mode default
# Media mode
media > space : exec mpc toggle
media > right : exec mpc next
media > left : exec mpc prev
media > escape : mode default
Observer Mode
Use observer mode to find keycodes:
# Launch in observer mode
skhd --observe
# Press keys to see their keycodes
# Press ctrl+c to quit
This helps when you need to bind keys that don't have obvious names in skhd's syntax.
Performance Optimization
For complex configurations, consider:
- Use mode switching to reduce active bindings
- Prefer simple keybindings over complex chords
- Test performance with
skhd --load-config - Keep frequently used bindings in the default mode
Advanced features make skhd powerful for complex workflows while maintaining its core simplicity and speed.
For basic skhd configuration and syntax, see skhd Configuration. For the main skhd overview, see skhd.
- Links to
- skhd · skhd Configuration · skhd