dotfiles/.config/yabai/yabairc

113 lines
4.3 KiB
Plaintext
Raw Normal View History

2020-12-06 10:51:39 +01:00
#!/bin/sh
2020-12-06 10:51:39 +01:00
yabai="/usr/local/bin/yabai"
yabai_sa=$(${yabai} --check-sa)
yabai_bitbar_plugin="yabai_skhd.1d.sh"
yabai_bitbar_refresh_cmd="open -gj 'bitbar://refreshPlugin?name=${yabai_bitbar_plugin}'"
2020-11-29 12:18:03 +01:00
2020-12-06 10:51:39 +01:00
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
# 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
2020-12-06 10:51:39 +01:00
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
2020-12-06 10:51:39 +01:00
## 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
2020-12-06 10:51:39 +01:00
## 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
## 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
2020-12-06 10:51:39 +01:00
## 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
2020-12-06 10:51:39 +01:00
echo "yabai configuration loaded.."