#!/usr/bin/env bash # # I have set the "FN" key on my Planck to the "Meh" action which just fires # the Ctrl+Shift+Alt key combo which helps here to have unique skhd shortcuts # that don't clash with macOS/Neovim/... # meh = shift + alt + ctrl # hyper = cmd + shift + alt + ctrl # Focus a window 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 # Focus a space meh - 1 : index=1; eval "$(yabai -m query --spaces | jq --argjson index "${index}" -r '(.[] | select(.index == $index).windows[0]) as $wid | if $wid then "yabai -m window --focus \"" + ($wid | tostring) + "\"" else "skhd --key \"ctrl - " + (map(select(."is-native-fullscreen" == false)) | index(map(select(.index == $index))) + 1 % 10 | tostring) + "\"" end')" meh - 2 : index=2; eval "$(yabai -m query --spaces | jq --argjson index "${index}" -r '(.[] | select(.index == $index).windows[0]) as $wid | if $wid then "yabai -m window --focus \"" + ($wid | tostring) + "\"" else "skhd --key \"ctrl - " + (map(select(."is-native-fullscreen" == false)) | index(map(select(.index == $index))) + 1 % 10 | tostring) + "\"" end')" meh - 3 : index=3; eval "$(yabai -m query --spaces | jq --argjson index "${index}" -r '(.[] | select(.index == $index).windows[0]) as $wid | if $wid then "yabai -m window --focus \"" + ($wid | tostring) + "\"" else "skhd --key \"ctrl - " + (map(select(."is-native-fullscreen" == false)) | index(map(select(.index == $index))) + 1 % 10 | tostring) + "\"" end')" meh - 4 : index=4; eval "$(yabai -m query --spaces | jq --argjson index "${index}" -r '(.[] | select(.index == $index).windows[0]) as $wid | if $wid then "yabai -m window --focus \"" + ($wid | tostring) + "\"" else "skhd --key \"ctrl - " + (map(select(."is-native-fullscreen" == false)) | index(map(select(.index == $index))) + 1 % 10 | tostring) + "\"" end')" meh - 5 : index=5; eval "$(yabai -m query --spaces | jq --argjson index "${index}" -r '(.[] | select(.index == $index).windows[0]) as $wid | if $wid then "yabai -m window --focus \"" + ($wid | tostring) + "\"" else "skhd --key \"ctrl - " + (map(select(."is-native-fullscreen" == false)) | index(map(select(.index == $index))) + 1 % 10 | tostring) + "\"" end')" # Zoom a window. `--toggle float` would be nicer, but results # in the window brought back to the wrong place after toggling meh - f : yabai -m window --toggle zoom-fullscreen # Move/swap windows meh - h : yabai -m window --swap west meh - j : yabai -m window --swap south meh - k : yabai -m window --swap north meh - l : yabai -m window --swap east # Split hyper - h : yabai -m window --warp west hyper - j : yabai -m window --warp south hyper - k : yabai -m window --warp north hyper - l : yabai -m window --warp east # toggle split meh - t : yabai -m window --toggle split # split vertically meh - v : yabai -m window --insert east # split horizontally meh - x : yabai -m window --insert south # Resize window # NOTE: Custom keys can be checked with `skhd --observe` meh - a : yabai -m window --resize left:-50:0; yabai -m window --resize right:-50:0 meh - s : yabai -m window --resize bottom:0:50; yabai -m window --resize top:0:50 meh - w: yabai -m window --resize top:0:-50; yabai -m window --resize bottom:0:-50 meh - d : yabai -m window --resize right:50:0; yabai -m window --resize left:50:0 # Move window to other desktop and focus desktop # FIXME: does not work with SIP enabled since macOS 15.? hyper - 1 : yabai -m window --space 1 hyper - 2 : yabai -m window --space 2 hyper - 3 : yabai -m window --space 3 hyper - 4 : yabai -m window --space 4 hyper - 5 : yabai -m window --space 5 # Move window to display left and right meh - r : yabai -m window --display west; yabai -m display --focus west meh - u : yabai -m window --display east; yabai -m display --focus east # Revert resized windows to default meh - 0 : yabai -m space --balance # Rotate windows clockwise meh - y : yabai -m space --rotate 270 # Indicate focus # NOTE: Needs scripting/protection off #hyper - o: yabai -m window --opacity 0.1 && sleep $(yabai -m config window_opacity_duration) && yabai -m window --opacity 0.0