Skip to content

Instantly share code, notes, and snippets.

@kdnk
Last active June 27, 2023 11:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kdnk/c38664459b402a22a360921ddc53bf1c to your computer and use it in GitHub Desktop.
Save kdnk/c38664459b402a22a360921ddc53bf1c to your computer and use it in GitHub Desktop.
# focus window
# | | i3-wm | yabai |
# | ---------------- | ----------- | ---------- |
# | フォーカスの移動 | $mod + jkl; | alt + hjkl |
alt - h : yabai -m window --focus west
alt - j : yabai -m window --focus stack.next || yabai -m window --focus south
alt - k : yabai -m window --focus stack.prev || yabai -m window --focus north
alt - l : yabai -m window --focus east
# warp
shift + alt - h : yabai -m window --warp west
shift + alt - j : yabai -m window --warp south
shift + alt - k : yabai -m window --warp north
shift + alt - l : yabai -m window --warp east
# focus space
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
cmd - 1 : yabai -m space --focus 1
cmd - 2 : yabai -m space --focus 2
cmd - 3 : yabai -m space --focus 3
cmd - 4 : yabai -m space --focus 4
cmd - 5 : yabai -m space --focus 5
cmd - 7 : yabai -m space --focus 7
cmd - 8 : yabai -m space --focus 8
cmd - 9 : yabai -m space --focus 9
# send window to 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 - a : yabai -m window --space prev
shift + alt - d : yabai -m window --space next
alt - a : yabai -m space --focus prev
alt - d : yabai -m space --focus next
# balance size of windows
shift + alt - 0 : yabai -m space --balance
shift + alt - q : yabai -m space --balance
# make floating window fill screen
shift + alt - up : yabai -m window --grid 1:1:0:0:1:1
# make floating window fill left-half of screen
shift + alt - left : yabai -m window --grid 1:2:0:0:1:1
# make floating window fill right-half of screen
shift + alt - right : yabai -m window --grid 1:2:1:0:1:1
# toggle window fullscreen zoom
alt - f : yabai -m window --toggle zoom-fullscreen
# alt - t : yabai -m window --toggle float && yabai -m window --grid 4:4:1:1:2:2
# float / unfloat window and restore position
shift + alt - space : yabai -m window --toggle float && yabai -m window --grid 4:4:1:1:2:2
# toggle window split type
# | | i3-wm | yabai |
# | ---------------------- | --------- | -------- |
# | splith/splitv (toggle) | $mod + e | alt + e |
alt - e : yabai -m window --toggle split
# rotate window
# | | i3-wm | yabai |
# | -------------- | ----- | ---------- |
# | rotate 90 | | alt + r |
# | mirror x or y | | alt + x y |
# rotate tree
alt - r : yabai -m space --rotate 90
# mirror tree y-axis
alt - y : yabai -m space --mirror y-axis
# mirror tree x-axis
alt - x : yabai -m space --mirror x-axis
# restart yabai
# from launchctl kickstart -k "gui/${UID}/homebrew.mxcl.yabailaunchctl kickstart -k "gui/${UID}/homebrew.mxcl.yabailaunchctl kickstart -k "gui/${UID}/homebrew.mxcl.yabailaunchctl kickstart -k "gui/${UID}/homebrew.mxcl.yabailaunchctl kickstart -k "gui/${UID}/homebrew.mxcl.yabai"github.com/koekeishiya/yabai/wiki/Tips-and-tricks
# (2022-10-11 21:24)
ctrl + alt + cmd - r : launchctl kickstart -k "gui/${UID}/homebrew.mxcl.yabai"
#!/usr/bin/env sh
# necessary to load scripting-addition during startup on macOS Big Sur
# *yabai --load-sa* is configured to run through sudo without a password
sudo yabai --load-sa
yabai -m signal --add event=dock_did_restart action="sudo yabai --load-sa"
# mission-control desktop labels
# yabai -m space 1 --label code
# yabai -m space 2 --label mail
# yabai -m space 3 --label web
# yabai -m space 4 --label notes
# yabai -m space 5 --label re
# yabai -m space 6 --label media
# yabai -m space 7 --label social
# yabai -m space 8 --label games
# # window rules
# yabai -m rule --add app="^Mail$" space=mail
# yabai -m rule --add app="^Safari$" space=web
# yabai -m rule --add app="^Notes$" space=notes
# yabai -m rule --add app="^ida64$" space=re
# yabai -m rule --add app="^Transmission$" space=media
# yabai -m rule --add app="^Spotify$" space=media
# yabai -m rule --add app="^Discord$" space=social grid=1:1:0:0:1:1 manage=off
# yabai -m rule --add app="^Steam$" space=games manage=off
# yabai -m rule --add app="^(Calculator|System Preferences|Archive Utility)$" manage=off
# yabai -m rule --add app="^mpv$" manage=off border=off sticky=on layer=above opacity=1.0 grid=8:8:6:0:2:2
# signals
yabai -m signal --add event=window_destroyed active=yes action="yabai -m query --windows --window &> /dev/null || yabai -m window --focus mouse &> /dev/null || yabai -m window --focus \$(yabai -m query --windows --space | jq .[0].id) &> /dev/null"
yabai -m signal --add event=window_minimized active=yes action="if \$(yabai -m query --windows --window \$YABAI_WINDOW_ID | jq -r '.\"is-floating\"'); then yabai -m query --windows --window &> /dev/null || yabai -m window --focus mouse &> /dev/null || yabai -m window --focus \$(yabai -m query --windows --space | jq .[0].id) &> /dev/null; fi"
# specific space settings
# yabai -m config --space mail layout stack
# yabai -m config --space games layout float
# global settings
yabai -m config \
external_bar off:41:0 \
mouse_follows_focus on \
focus_follows_mouse autoraise \
window_placement second_child \
window_topmost off \
window_shadow off \
window_animation_duration 0.01 \
window_opacity_duration 0.01 \
active_window_opacity 1.00 \
normal_window_opacity 0.90 \
window_opacity off \
insert_feedback_color 0xaad75f5f \
active_window_border_color 0xBF775759 \
kormal_window_border_color 0x7f353535 \
window_border_width 4 \
window_border_radius 12 \
window_border_blur off \
window_border_hidpi on \
window_border on \
split_ratio 0.50 \
split_type auto \
auto_balance off \
top_padding 10 \
left_padding 10 \
right_padding 10 \
bottom_padding 10 \
window_gap 10 \
layout bsp \
mouse_modifier ctrl \
mouse_action1 move \
mouse_action2 resize \
mouse_drop_action swap
# https://qiita.com/syumiwohossu/items/b770c0904d56c861cb8d
# yabai -m rule --add app="^zoom.us$" manage=on
echo "yabai configuration loaded.."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment