Skip to content

Instantly share code, notes, and snippets.

@peltho
Created March 16, 2023 15:26
Show Gist options
  • Save peltho/854077a776b514dc7c74a0994c65e104 to your computer and use it in GitHub Desktop.
Save peltho/854077a776b514dc7c74a0994c65e104 to your computer and use it in GitHub Desktop.
Skhd config file
# Move to window in current workspace
cmd - left : yabai -m window --focus west
cmd - down : yabai -m window --focus south
cmd - up : yabai -m window --focus north
cmd - right : yabai -m window --focus east
# Shift window in current workspace
cmd + shift - left : yabai -m window --swap west || $(yabai -m window --display west; yabai -m display --focus west)
cmd + shift - down : yabai -m window --swap south || $(yabai -m window --display south; yabai -m display --focus south)
cmd + shift - up : yabai -m window --swap north || $(yabai -m window --display north; yabai -m display --focus north)
cmd + shift - right : yabai -m window --swap east || $(yabai -m window --display east; yabai -m display --focus east)
# Move to workspace
cmd - 0x12 : yabai -m space --focus 1
cmd - 0x13 : yabai -m space --focus 2
cmd - 0x14 : yabai -m space --focus 3
cmd - 0x15 : yabai -m space --focus 4
cmd - 0x17 : yabai -m space --focus 5
cmd - 0x16 : yabai -m space --focus 6
# Move focused window to next/prev workspace
cmd + shift - 0x12 : yabai -m window --space 1
cmd + shift - 0x13 : yabai -m window --space 2
cmd + shift - 0x14 : yabai -m window --space 3
cmd + shift - 0x15 : yabai -m window --space 4
cmd + shift - 0x17 : yabai -m window --space 5
cmd + shift - 0x16 : yabai -m window --space 6
# change layout of desktop
alt - e : yabai -m space --layout bsp
alt - l : yabai -m space --layout float
alt - s : yabai -m space --layout stack
# close focused window
cmd + shift - a : yabai -m window --close
# enter fullscreen mode for the focused container
cmd + alt - f : yabai -m window --toggle zoom-fullscreen
# toggle window native fullscreen
cmd + ctrl - f : yabai -m window --toggle native-fullscreen
# create desktop, move window and follow focus - uses jq for parsing json (brew install jq)
#shift + cmd - n : yabai -m space --create && \
# index="$(yabai -m query --spaces --display | jq 'map(select(."native-fullscreen" == 0))[-1].index')" && \
# yabai -m window --space "${index}" && \
# yabai -m space --focus "${index}"
# create desktop and follow focus - uses jq for parsing json (brew install jq)
#cmd + alt - n : yabai -m space --create && \
# index="$(yabai -m query --spaces --display | jq 'map(select(."native-fullscreen" == 0))[-1].index')" && \
# yabai -m space --focus "${index}"
# destroy desktop
# cmd + alt - w : yabai -m space --destroy
# cmd + alt - w : yabai -m space --focus prev && yabai -m space recent --destroy
# focus monitor
#ctrl + alt - x : yabai -m display --focus recent
#ctrl + alt - z : yabai -m display --focus prev
#ctrl + alt - c : yabai -m display --focus next
#ctrl + alt - 1 : yabai -m display --focus 1
#ctrl + alt - 2 : yabai -m display --focus 2
#ctrl + alt - 3 : yabai -m display --focus 3
# Applications hotkeys
cmd - return : /Applications/Hyper.app/Contents/MacOS/Hyper
cmd - 0x0B : /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome
cmd - 0x30 : yabai -m query --spaces --space \
| jq -re ".index" \
| xargs -I{} yabai -m query --windows --space {} \
| jq -sre 'add | map(select(."is-minimized"==false)) | sort_by(.display, .frame.y, .frame.x, .id) | . as $array | length as $array_length | index(map(select(."has-focus"==true))) as $has_index | if $has_index > 0 then nth($has_index - 1).id else nth($array_length - 1).id end' \
| xargs -I{} yabai -m window --focus {}
# scratchpad
#cmd - x : /Applications/Hyper.app/Contents/MacOS/Hyper; \
# sleep 0.1 && yabai -m window --toggle float;\
# yabai -m window --grid 4:4:1:1:2:2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment