Skip to content

Instantly share code, notes, and snippets.

@armand1m
Last active May 2, 2024 18:00
Show Gist options
  • Save armand1m/4094b37d8969fd365fdcc215277e9e67 to your computer and use it in GitHub Desktop.
Save armand1m/4094b37d8969fd365fdcc215277e9e67 to your computer and use it in GitHub Desktop.
⚙️ My yabai and skhd configuration files.
# open terminal
cmd - return : open -n -a "Terminal"
# open chrome
cmd + shift - return : open -n -a "Google Chrome"
# moves focus between windows in the current focused display
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
# moves focus between spaces
alt - 1 : yabai -m space --focus 1
alt - 2 : yabai -m space --focus 2
alt - 3 : yabai -m space --focus 3
alt - 4 : yabai -m space --focus 4
alt - 5 : yabai -m space --focus 5
alt - 6 : yabai -m space --focus 6
alt - 7 : yabai -m space --focus 7
alt - 8 : yabai -m space --focus 8
alt - 9 : yabai -m space --focus 9
alt - 0 : yabai -m space --focus 10
# delete focused space
alt - q : yabai -m space --destroy
# toggle window split type
alt - e : yabai -m window --toggle split
# close window
alt - x : yabai -m window --close
# minimize window
alt - m : yabai -m window --minimize
# rotate tree
alt - r : yabai -m space --rotate 90
# mirror tree y-axis
alt - y : yabai -m space --mirror y-axis
# toggle desktop offset
alt - a : yabai -m space --toggle padding; yabai -m space --toggle gap
# toggle window parent zoom
alt - d : yabai -m window --focus mouse && \
yabai -m window --toggle zoom-parent
# float / unfloat window and center on screen
alt - t : yabai -m window --toggle float;\
yabai -m window --grid 4:4:1:1:2:2
# toggle window fullscreen zoom
alt - f : yabai -m window --focus mouse && \
yabai -m window --toggle zoom-fullscreen
# toggle window native fullscreen
shift + alt - f : yabai -m window --toggle native-fullscreen
# increase gap in focused space
alt - g : yabai -m space --gap rel:10
# decrease gap in focused space
shift + alt - g : yabai -m space --gap rel:-10
# create a new space and follow focus
alt - n : yabai -m space --create && \
index="$(yabai -m query --displays --display | jq '.spaces[-1]')" && \
yabai -m space --focus "${index}"
# create a new space, move window and follow focus
shift + alt - n : yabai -m space --create && \
index="$(yabai -m query --displays --display | jq '.spaces[-1]')" && \
yabai -m window --space "${index}" && \
yabai -m space --focus "${index}"
# balance size of windows
shift + alt - 0 : yabai -m space --balance
# swap window
shift + alt - h : yabai -m window --swap west
shift + alt - j : yabai -m window --swap south
shift + alt - k : yabai -m window --swap north
shift + alt - l : yabai -m window --swap east
# move window
shift + cmd - h : yabai -m window --warp west
shift + cmd - j : yabai -m window --warp south
shift + cmd - k : yabai -m window --warp north
shift + cmd - l : yabai -m window --warp east
# send window to a space
shift + alt - 1 : yabai -m window --space 1
shift + alt - 2 : yabai -m window --space 2
shift + alt - 3 : yabai -m window --space 3
shift + alt - 4 : yabai -m window --space 4
shift + alt - 5 : yabai -m window --space 5
shift + alt - 6 : yabai -m window --space 6
shift + alt - 7 : yabai -m window --space 7
shift + alt - 8 : yabai -m window --space 8
shift + alt - 9 : yabai -m window --space 9
shift + alt - 0 : yabai -m window --space 10
# change layout of desktop
ctrl + alt - a : yabai -m space --layout bsp
ctrl + alt - d : yabai -m space --layout float
# increase window size
ctrl + alt - h : yabai -m window --resize left:-40:0
ctrl + alt - j : yabai -m window --resize bottom:0:40
ctrl + alt - k : yabai -m window --resize top:0:-40
ctrl + alt - l : yabai -m window --resize right:40:0
# decrease window size
ctrl + alt + cmd - h : yabai -m window --resize left:40:0
ctrl + alt + cmd - j : yabai -m window --resize bottom:0:-40
ctrl + alt + cmd - k : yabai -m window --resize top:0:40
ctrl + alt + cmd - l : yabai -m window --resize right:-40:0
# restart yabai
ctrl + alt + cmd - r : launchctl kickstart -k "gui/${UID}/homebrew.mxcl.yabai"
ctrl + alt + cmd - o : node ~/Projects/Personal/philips-hue-experiments/commands/turn-on.js --all
ctrl + alt + cmd - f : node ~/Projects/Personal/philips-hue-experiments/commands/turn-off.js --all
#!/usr/bin/env sh
sudo yabai --load-sa
yabai -m signal --add event=dock_did_restart action="sudo yabai --load-sa"
# global settings
yabai -m config external_bar all:24:0
yabai -m config mouse_follows_focus on
yabai -m config focus_follows_mouse autofocus
yabai -m config window_placement second_child
yabai -m config window_topmost on
yabai -m config window_opacity on
yabai -m config window_opacity_duration 0.0
yabai -m config window_shadow off
yabai -m config insert_feedback_color 0xaad75f5f
yabai -m config active_window_opacity 1.0
yabai -m config normal_window_opacity 0.90
yabai -m config split_ratio 0.50
yabai -m config auto_balance off
yabai -m config mouse_modifier fn
yabai -m config mouse_action1 move
yabai -m config mouse_action2 resize
# general space settings
yabai -m config layout bsp
yabai -m config top_padding 24
yabai -m config bottom_padding 16
yabai -m config left_padding 16
yabai -m config right_padding 16
yabai -m config window_gap 16
# rules
## makes system preferences always floating
yabai -m rule --add app="^System Preferences$" manage=off
yabai -m rule --add app="^Wally$" manage=off
yabai -m rule --add app="^Pulse Secure$" manage=off
# signals
## updates workspace widget when space changes
yabai -m signal --add event=space_changed \
action="osascript -e 'tell application \"Übersicht\" to refresh widget id \"pecan-workspace-jsx\"'"
echo "yabai configuration loaded.."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment