#!/bin/sh yabai="/usr/local/bin/yabai" yabai_sa=$(${yabai} --check-sa) yabai_bitbar_plugin="yabai_enhanced.365d.sh" yabai_bitbar_refresh_cmd="open -gj 'bitbar://refreshPlugin?name=${yabai_bitbar_plugin}'" yabai_create_spaces="Main Mail PIM Shell Code Misc." yabai_create_spaces_count=$(set -- ${yabai_create_spaces} && echo $#) yabai_spaces=$(yabai -m query --spaces --display 1 | jq length) ## Install or update scripting additions if ${yabai_sa}; then sudo ${yabai} --uninstall-sa sudo ${yabai} --install-sa fi ${yabai} --load-sa yabai -m signal --add event=dock_did_restart action="${yabai} --load-sa" ## Global settings yabai -m config mouse_follows_focus on yabai -m config focus_follows_mouse off # autofocus|autoraise|off yabai -m config window_placement first_child yabai -m config split_ratio 0.6 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 10 yabai -m config bottom_padding 10 yabai -m config left_padding 10 yabai -m config right_padding 10 yabai -m config window_gap 10 ## Specific space settings yabai -m space 1 --layout stack # Yabai-Spaces for BitBar yabai -m signal --add event=space_changed action="${yabai_bitbar_refresh_cmd}" yabai -m signal --add event=display_added action="${yabai_bitbar_refresh_cmd}" yabai -m signal --add event=display_removed action="${yabai_bitbar_refresh_cmd}" yabai -m signal --add event=display_changed action="${yabai_bitbar_refresh_cmd}" yabai -m signal --add event=display_moved action="${yabai_bitbar_refresh_cmd}" ## Destroy all spaces in reverse order(except of the first one) i=${yabai_spaces}; while [ ${i} -ne 1 ]; do yabai -m space ${i} --destroy i=$((i-1)) done ## Create spaces and label them i=0; for name in ${yabai_create_spaces}; do i=$((i+1)) yabai -m space ${i} --label ${name} if [ ${i} -lt ${yabai_create_spaces_count} ]; then yabai -m space --create fi done ## Sticky Windows yabai -m rule --add app="^Todoist$" sticky=on yabai -m rule --add app="^Bitwarden$" sticky=on ## Screen 1 (Main) space=1 yabai -m rule --add app="^Firefox$" space="${space}" yabai -m rule --add app="^Reeder$" space="${space}" ## Screen 2 (Mail) space=2 yabai -m rule --add app="^Mail$" space="${space}" yabai -m rule --add app="^Thunderbird$" space="${space}" ## Screen 3 (PIM) space=3 yabai -m rule --add app="^Kalender$" space="${space}" yabai -m rule --add app="^Fantastical$" space="${space}" yabai -m rule --add app="^Kontakte$" space="${space}" ## Screen 4 (Terminal) space=4 yabai -m rule --add app="^iTerm2$" space="${space}" yabai -m rule --add app="^Terminal$" space="${space}" ## Screen 5 (Coding) space=5 yabai -m rule --add app="^VSCodium$" space="${space}" yabai -m rule --add app="^VSCode$" space="${space}" yabai -m rule --add app="^Fork$" space="${space}" ## Screen 6 (Misc.) space=6 yabai -m rule --add app="^MoneyMoney$" space="${space}" yabai -m rule --add app="^YNAB$" space="${space}" ## Unmanaged windows yabai -m rule --add app="^App Store$" manage=off yabai -m rule --add app="^Rechner$" manage=off yabai -m rule --add app="^Numi$" manage=off yabai -m rule --add app="Vorschau" manage=off yabai -m rule --add app="^System.*einstellungen$" manage=off yabai -m rule --add app="^VirtualBox$" manage=off yabai -m rule --add app="^nextcloud$" manage=off yabai -m rule --add app="^Color Picker$" manage=off yabai -m rule --add app="(Brother|HP)" manage=off yabai -m rule --add app="^Alfred Preferences$" manage=off yabai -m rule --add app="^Thunderbird$" title="(Nachricht wird gesendet|Aktivitäten|Öffnen von)" manage=off yabai -m rule --add app="^DBeaver$" title="(Treibereinstellungen)" manage=off yabai -m rule --add app="^Fantastical Helper$" manage=off yabai -m rule --add app="^Finder$" title="(Kopieren|Bewegen|Verbinden|Infos|Einstellungen|Über|Papierkorb)" manage=off yabai -m rule --add app="^FileBot$" title="(Invalid Characters|TheTVDB|TheMovieDB|AccoustID)" manage=off echo "yabai configuration loaded.."