Rewrite of yabairc

This commit is contained in:
Christian Baer 2020-12-06 10:51:39 +01:00
parent d8855c9af7
commit bb4e7bc29c

View File

@ -1,31 +1,38 @@
#!/usr/bin/env sh #!/bin/sh
sudo yabai --load-sa yabai="/usr/local/bin/yabai"
yabai -m signal --add event=dock_did_restart action="sudo yabai --load-sa" yabai_sa=$(${yabai} --check-sa)
yabai_bitbar_plugin="yabai_skhd.1d.sh"
yabai_bitbar_refresh_cmd="open -gj 'bitbar://refreshPlugin?name=${yabai_bitbar_plugin}'"
# global settings yabai_create_spaces="main mail pim shell code misc"
yabai -m config mouse_follows_focus off yabai_create_spaces_count=$(set -- ${yabai_create_spaces} && echo $#)
yabai -m config focus_follows_mouse off
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
# sudo ${yabai} --load-sa
#sudo ${yabai} --load-sa
${yabai} --load-sa
#yabai -m signal --add event=dock_did_restart action="sudo ${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 window_placement first_child
yabai -m config window_topmost off yabai -m config split_ratio 0.6
yabai -m config window_shadow off
yabai -m config window_opacity off
yabai -m config window_opacity_duration 0.0
yabai -m config active_window_opacity 1.0
yabai -m config normal_window_opacity 0.9
yabai -m config window_border off
yabai -m config window_border_width 6
yabai -m config active_window_border_color 0xff775759
yabai -m config normal_window_border_color 0xff555555
yabai -m config insert_feedback_color 0xffd75f5f
yabai -m config split_ratio 0.50
yabai -m config auto_balance on
yabai -m config mouse_modifier fn yabai -m config mouse_modifier fn
yabai -m config mouse_action1 move yabai -m config mouse_action1 move
yabai -m config mouse_action2 resize yabai -m config mouse_action2 resize
yabai -m config mouse_drop_action swap
# general space settings
## General space settings
yabai -m config layout bsp yabai -m config layout bsp
yabai -m config top_padding 10 yabai -m config top_padding 10
yabai -m config bottom_padding 10 yabai -m config bottom_padding 10
@ -33,9 +40,74 @@ yabai -m config left_padding 10
yabai -m config right_padding 10 yabai -m config right_padding 10
yabai -m config window_gap 10 yabai -m config window_gap 10
## Specific space settings
yabai -m space 1 --layout stack
yabai -m rule --add app="^Systemeinstellungen$" manage=off # Yabai-Spaces for BitBar
yabai -m rule --add app="^Todoist$" manage=off yabai -m signal --add event=space_changed action="${yabai_bitbar_refresh_cmd}"
yabai -m rule --add app="^Fantastical$" manage=off 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
## Screen 1 (Main)
space=main
yabai -m rule --add label="Firefox" app="^Firefox$" space="${space}"
yabai -m rule --add label="Reeder" app="^Reeder$" space="${space}"
## Screen 2 (Mail)
space=mail
yabai -m rule --add label="Mail" app="^Mail$" space="${space}"
yabai -m rule --add label="Thunderbird" app="^Thunderbird$" space="${space}"
## Screen 3 (PIM)
space=pim
yabai -m rule --add label="Kalender" app="^Kalender$" space="${space}"
yabai -m rule --add label="Fantastical" app="^Fantastical$" space="${space}"
yabai -m rule --add label="Kontakte" app="^Kontakte$" space="${space}"
## Screen 4 (Terminal)
space=shell
yabai -m rule --add label="iTerm2" app="^iTerm2$" space="${space}"
yabai -m rule --add label="Terminal" app="^Terminal$" space="${space}"
## Screen 5 (Coding)
space=code
yabai -m rule --add label="VSCodium" app="^VSCodium$" space="${space}"
yabai -m rule --add label="Fork" app="^Fork$" space="${space}"
## Screen 6 (Misc.)
space=misc
## Unmanaged windows
yabai -m rule --add label="Alfred Preferences" app="^Alfred Preferences$" manage=off
yabai -m rule --add label="App Store" app="^App Store$" manage=off
yabai -m rule --add label="Rechner" app="^Rechner$" manage=off
yabai -m rule --add label="Numi" app="^Numi$" manage=off
yabai -m rule --add label="thunderbird-activities" app="^Thunderbird$" title="^Aktivitäten$" manage=off
yabai -m rule --add label="thunderbird-send" app="^Thunderbird$" title='^Nachricht wird gesendet.*$' manage=off
yabai -m rule --add label="fantastical-helper" app="^Fantastical Helper$" manage=off
yabai -m rule --add label="Finder" app="^Finder$" title="(Co(py|nnect)|Move|Info|Pref)" manage=off
yabai -m rule --add label="Preview" app="Preview" manage=off
yabai -m rule --add label="System Preferences" app="^System Preferences$" manage=off
yabai -m rule --add label="VirtualBox" app="^VirtualBox$" manage=off
yabai -m rule --add label="Nextcloud" app="^nextcloud$" manage=off
yabai -m rule --add label="FileBot" app="^FileBot" manage=off
echo "yabai configuration loaded.." echo "yabai configuration loaded.."