Skip to content

Instantly share code, notes, and snippets.

@shibacomputer
Created September 23, 2019 10:35
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 shibacomputer/a380f2bc9e62732332ec2251eb80d06f to your computer and use it in GitHub Desktop.
Save shibacomputer/a380f2bc9e62732332ec2251eb80d06f to your computer and use it in GitHub Desktop.
# focus window
home : yabai -m window --focus west
pagedown : yabai -m window --focus south
pageup : yabai -m window --focus north
end : yabai -m window --focus east
# swap window
shift + alt + ctrl - home : yabai -m window --swap west
shift + alt + ctrl - pagedown : yabai -m window --swap south
shift + alt + ctrl - pageup : yabai -m window --swap north
shift + alt + ctrl - end : yabai -m window --swap east
# move window
alt - home : yabai -m window --warp west
alt - pagedown : yabai -m window --warp south
alt - pageup : yabai -m window --warp north
alt - end : yabai -m window --warp east
# balance size of windows
fn + alt - space : yabai -m space --balance
# rotate tree
alt - r : yabai -m space --rotate 90
# mirror tree y-axis
shift + alt - r : yabai -m space --mirror y-axis
# toggle window fullscreen zoom
shift + alt - o : yabai -m window --toggle zoom-fullscreen
# float / unfloat window and center on screen
shift + alt - p : yabai -m window --toggle float;\
yabai -m window --grid 4:4:1:1:2:2
# move focused container to workspace
shift + alt - m : yabai -m window --space last; yabai -m space --focus last
shift + alt - p : yabai -m window --space prev; yabai -m space --focus prev
shift + alt - n : yabai -m window --space next; yabai -m space --focus next
shift + alt - 1 : yabai -m window --space 1; yabai -m space --focus 1
shift + alt - 2 : yabai -m window --space 2; yabai -m space --focus 2
shift + alt - 3 : yabai -m window --space 3; yabai -m space --focus 3
shift + alt - 4 : yabai -m window --space 4; yabai -m space --focus 4
shift + alt - 5 : yabai -m window --space 5; yabai -m space --focus 5
shift + alt - 6 : yabai -m window --space 6; yabai -m space --focus 6
shift + alt - 7 : yabai -m window --space 7; yabai -m space --focus 7
shift + alt - 8 : yabai -m window --space 8; yabai -m space --focus 8
shift + alt - 9 : yabai -m window --space 9; yabai -m space --focus 9
shift + alt - 0 : yabai -m window --space 0; yabai -m space --focus 0
shift + alt - y : brew services restart yabai
#!/usr/bin/env sh
# bar settings
yabai -m config status_bar on
yabai -m config status_bar_font_family "SF Mono"
yabai -m config status_bar_icon_font_family "Font Awesome 5 Free"
yabai -m config status_bar_background_color 0xff202020
yabai -m config status_bar_foreground_color 0xffa8a8a8
yabai -m config status_bar_space_icon_strip I II III IV V VI VII VIII IX X
yabai -m config status_bar_power_icon_strip  
yabai -m config status_bar_space_icon 
yabai -m config status_bar_clock_icon 
# global settings
yabai -m config mouse_follows_focus on
yabai -m config window_topmost off
yabai -m config window_opacity off
yabai -m config window_shadow off
yabai -m config focus_follows_mouse on
yabai -m config window_border on
yabai -m config window_border_width 2
yabai -m config active_window_border_color 0xff565656
yabai -m config normal_window_border_color 0xff222222
yabai -m config insert_window_border_color 0xffd75f5f
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 true
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 6
yabai -m config bottom_padding 6
yabai -m config left_padding 6
yabai -m config right_padding 6
yabai -m config window_gap 6
echo "yabai configuration loaded.."
# set codesigning certificate name here (default: yabai-cert)
YABAI_CERT=
function main() {
if check_for_updates; then
install_updates ${YABAI_CERT}
else
osascript << EOM
display notification "Configuration loaded." ¬
with title "$(yabai --version)"
EOM
fi
}
# Please do not touch the code below unless you absolutely know what you are
# doing. It's the result of multiple long evenings trying to get this to work
# and relies on terrible hacks to work around limitations of launchd.
# For questions please reach out to @dominiklohmann via GitHub.
function check_for_updates() {
set -o pipefail
installed="$(brew info koekeishiya/formulae/yabai | grep 'HEAD-' \
| awk '{print substr($1,length($1)-6)}')"
remote="$(git ls-remote --head 'https://github.com/koekeishiya/yabai.git' \
| awk '{print substr($1,1,7)}')"
[ ${?} -eq 0 ] && [[ "${installed}" != "${remote}" ]]
}
function install_updates() {
script=$(mktemp)
cat > ${script} << EOF
#! /usr/bin/env sh
clear
printf "\e[1mUpdating yabai...\e[0m\n"
printf "Authenticate to continue, Ctrl+C to cancel.\n\n"
if sudo -v; then
brew services stop koekeishiya/formulae/yabai
brew reinstall koekeishiya/formulae/yabai
codesign -fs "${1:-yabai-cert}" "$(brew --prefix yabai)/bin/yabai"
sudo yabai --uninstall-sa
sudo yabai --install-sa
brew services start koekeishiya/formulae/yabai
killall Dock
sleep 1
fi
ps -eo pid,comm | grep -v grep | grep -i Terminal | tail -1 \
| awk '{print $1}' | xargs kill
EOF
chmod +x ${script}
open -FWnb com.apple.Terminal ${script}
rm -f ${script}
}
main &
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment