Skip to content

Instantly share code, notes, and snippets.

@MateuszKruk1303
Created September 4, 2025 12:11
Show Gist options
  • Select an option

  • Save MateuszKruk1303/0531ebdc54f694a81e3dcf7cd0775efb to your computer and use it in GitHub Desktop.

Select an option

Save MateuszKruk1303/0531ebdc54f694a81e3dcf7cd0775efb to your computer and use it in GitHub Desktop.
Yabai config
cmd - 9 : yabai --start-service
cmd - 8 : yabai --stop-service
# move between spaces with go-back functionality
cmd - 1 : \
current=$(yabai -m query --spaces --space | jq -r '.index'); \
last=$(cat ~/.cache/yabai_last_space 2>/dev/null || echo "1"); \
if [ "$current" = "1" ] && [ "$last" != "1" ]; then \
echo "$current" > ~/.cache/yabai_last_space; \
yabai -m space --focus "$last"; \
else \
echo "$current" > ~/.cache/yabai_last_space; \
yabai -m space --focus 1; \
fi
cmd - 2 : \
current=$(yabai -m query --spaces --space | jq -r '.index'); \
last=$(cat ~/.cache/yabai_last_space 2>/dev/null || echo "1"); \
if [ "$current" = "2" ] && [ "$last" != "2" ]; then \
echo "$current" > ~/.cache/yabai_last_space; \
yabai -m space --focus "$last"; \
else \
echo "$current" > ~/.cache/yabai_last_space; \
yabai -m space --focus 2; \
fi
cmd - 3 : \
current=$(yabai -m query --spaces --space | jq -r '.index'); \
last=$(cat ~/.cache/yabai_last_space 2>/dev/null || echo "1"); \
if [ "$current" = "3" ] && [ "$last" != "3" ]; then \
echo "$current" > ~/.cache/yabai_last_space; \
yabai -m space --focus "$last"; \
else \
echo "$current" > ~/.cache/yabai_last_space; \
yabai -m space --focus 3; \
fi
cmd - 4 : \
current=$(yabai -m query --spaces --space | jq -r '.index'); \
last=$(cat ~/.cache/yabai_last_space 2>/dev/null || echo "1"); \
if [ "$current" = "4" ] && [ "$last" != "4" ]; then \
echo "$current" > ~/.cache/yabai_last_space; \
yabai -m space --focus "$last"; \
else \
echo "$current" > ~/.cache/yabai_last_space; \
yabai -m space --focus 4; \
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment