dotfiles/.config/yabai/yabairc

160 lines
6.2 KiB
Plaintext
Raw Normal View History

2020-12-06 10:51:39 +01:00
#!/bin/sh
2021-01-12 23:22:00 +01:00
## Set PATH
PATH="/opt/homebrew/bin:${PATH}"
2020-12-17 23:04:54 +01:00
## Path to yabai
2021-01-12 23:22:00 +01:00
yabai
2020-12-17 23:04:54 +01:00
## Name of yabai bitbar plugin
2020-12-14 22:20:30 +01:00
yabai_bitbar_plugin="yabai_enhanced.*?.sh"
2020-11-29 12:18:03 +01:00
2020-12-17 23:04:54 +01:00
## Spaces that should be created
2021-01-03 22:12:39 +01:00
yabai_create_spaces="Main Mail Messaging PIM Shell Code Misc."
2020-12-17 23:04:54 +01:00
## Send refresh signal to bitbar
yabai_bitbar_refresh_cmd="set SHELL=/bin/sh && open -g 'bitbar://refreshPlugin?name=${yabai_bitbar_plugin}'"
## Get nuber of spaces that should be created
2020-12-06 10:51:39 +01:00
yabai_create_spaces_count=$(set -- ${yabai_create_spaces} && echo $#)
2020-12-17 23:04:54 +01:00
## Get number of existing spaces
2021-01-12 23:22:00 +01:00
yabai_spaces=$(yabai -m query --spaces | jq length)
2020-12-17 23:04:54 +01:00
## Check version of scripting additions
2021-01-12 23:22:00 +01:00
yabai_sa=$(yabai --check-sa)
2020-12-06 10:51:39 +01:00
## Install or update scripting additions
if ${yabai_sa}; then
2021-01-12 23:22:00 +01:00
sudo yabai --uninstall-sa
sudo yabai --install-sa
2020-12-06 10:51:39 +01:00
fi
2020-12-17 23:04:54 +01:00
## Load scripting additions
2021-01-12 23:22:00 +01:00
sudo yabai --load-sa ## sudo needed since Big Sur
yabai -m signal --add event=dock_did_restart action="sudo yabai --load-sa"
2020-12-06 10:51:39 +01:00
## Global settings
2021-01-12 23:22:00 +01:00
yabai -m config mouse_follows_focus off
yabai -m config focus_follows_mouse off
yabai -m config window_placement second_child
2020-12-17 10:12:27 +01:00
2021-01-12 23:22:00 +01:00
yabai -m config split_ratio 0.6
yabai -m config window_shadow float
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
2021-01-12 23:22:00 +01:00
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
2021-01-12 23:22:00 +01:00
yabai -m space 1 --layout stack
2020-12-06 10:51:39 +01:00
# Yabai-Spaces for BitBar
2021-01-12 23:22:00 +01:00
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}"
2020-12-06 10:51:39 +01:00
## Destroy all spaces in reverse order(except of the first one)
i=${yabai_spaces}; while [ ${i} -ne 1 ]; do
2021-01-12 23:22:00 +01:00
yabai -m space ${i} --destroy
2020-12-06 10:51:39 +01:00
i=$((i-1))
done
## Create spaces and label them
i=0; for name in ${yabai_create_spaces}; do
i=$((i+1))
2021-01-12 23:22:00 +01:00
yabai -m space ${i} --label ${name}
2020-12-06 10:51:39 +01:00
if [ ${i} -lt ${yabai_create_spaces_count} ]; then
2021-01-12 23:22:00 +01:00
yabai -m space --create
2020-12-06 10:51:39 +01:00
fi
done
2020-12-09 20:49:27 +01:00
## Sticky Windows
2021-01-12 23:22:00 +01:00
yabai -m rule --add app="^Todoist$" sticky=on
yabai -m rule --add app="^Bitwarden$" sticky=on
2020-12-09 20:49:27 +01:00
2021-01-03 22:12:39 +01:00
space=Main
2021-01-12 23:22:00 +01:00
yabai -m rule --add app="^Firefox$" space="${space}"
yabai -m rule --add app="^Safari$" space="${space}"
yabai -m rule --add app="^Chrome$" space="${space}"
2021-01-12 23:22:00 +01:00
yabai -m rule --add app="^Reeder$" space="${space}"
2020-12-06 10:51:39 +01:00
2021-01-03 22:12:39 +01:00
space=Mail
2021-01-12 23:22:00 +01:00
yabai -m rule --add app="^Mail$" space="${space}"
yabai -m rule --add app="^Thunderbird$" space="${space}"
2020-12-06 10:51:39 +01:00
2021-01-03 22:12:39 +01:00
space=Messaging
2021-01-12 23:22:00 +01:00
yabai -m rule --add app="^Threema$" space="${space}"
yabai -m rule --add app="^WhatsApp$" space="${space}"
yabai -m rule --add app="^Nachrichten$" space="${space}"
2021-01-03 22:12:39 +01:00
space=PIM
2021-01-12 23:22:00 +01:00
yabai -m rule --add app="^Kalender$" space="${space}"
yabai -m rule --add app="^Fantastical$" space="${space}"
yabai -m rule --add app="^Kontakte$" space="${space}"
2020-12-06 10:51:39 +01:00
2021-01-03 22:12:39 +01:00
space=Shell
2021-01-12 23:22:00 +01:00
yabai -m rule --add app="^iTerm2$" space="${space}"
yabai -m rule --add app="^Terminal$" space="${space}"
2021-01-20 00:01:11 +01:00
yabai -m rule --add app="^Alacritty$" space="${space}"
2020-12-06 10:51:39 +01:00
2021-01-03 22:12:39 +01:00
space=Code
2021-01-12 23:22:00 +01:00
yabai -m rule --add app="^VSCodium$" space="${space}"
yabai -m rule --add app="^VSCode$" space="${space}"
yabai -m rule --add app="^Fork$" space="${space}"
2020-12-06 10:51:39 +01:00
2021-01-03 22:12:39 +01:00
space=Misc.
2021-01-12 23:22:00 +01:00
yabai -m rule --add app="^MoneyMoney$" space="${space}"
yabai -m rule --add app="^YNAB$" space="${space}"
yabai -m rule --add app="^Portfolio Performance$" space="${space}"
yabai -m rule --add app="^Affinity .*$" space="${space}"
2020-12-17 23:04:54 +01:00
## Unmanaged applications
2021-01-12 23:22:00 +01:00
yabai -m rule --add app="^App Store$" manage=off
yabai -m rule --add app="^iStat Menus$" manage=off
yabai -m rule --add app="^Bartender .*$" 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="^System.*informationen$" manage=off
yabai -m rule --add app="^Festplatten.*dienstprogramm$" manage=off
yabai -m rule --add app="^VirtualBox$" manage=off
yabai -m rule --add app="^nextcloud$" manage=off
yabai -m rule --add app="^Hazel$" manage=off
yabai -m rule --add app="^Color Picker$" manage=off
yabai -m rule --add app="^ColorSlurp$" manage=off
yabai -m rule --add app="^PrinterProxy$" manage=off
yabai -m rule --add app="^ExactScan Pro$" manage=off
yabai -m rule --add app="^coconutBattery$" manage=off
yabai -m rule --add app="^Arq$" manage=off
yabai -m rule --add app="^The Unarchiver$" manage=off
yabai -m rule --add app="^VMware Fusion$" manage=off
yabai -m rule --add app="^Passepartout$" manage=off
yabai -m rule --add app="^Facetime$" manage=off
2020-12-14 22:20:30 +01:00
2020-12-17 23:04:54 +01:00
## Unmanaged windows of specific applications
2021-01-12 23:22:00 +01:00
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="^MoneyMoney$" title="(Einstellungen)" manage=off
yabai -m rule --add app="^DBeaver$" title="(Treibereinstellungen|Neue Verbindung anlegen)" manage=off
yabai -m rule --add app="^Fantastical Helper$" manage=off
yabai -m rule --add app="^Affinity .*$" title="(Dokument)" manage=off
yabai -m rule --add app="^Fantastical$" title="(Allgemein|Darstellung|Accounts|Kalender|Erinnerungen|Wetter|Erweitert|Aktualisieren)" 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|Preset Editor|Conflicts|TheTVDB|TheMovieDB|AccoustID)" manage=off
yabai -m rule --add app="^Fork$" title="(General|Commit|Git|Integration|Custom Commands|Updates)" manage=off
yabai -m rule --add app="^Mail$" title="(Accountinformationen|Aktivität|Allgemein|Accounts|Spam|Schrift & Farbe|Darstellung|Verfassen|Signaturen|Regeln)" manage=off
2020-12-11 12:23:09 +01:00
echo "yabai configuration loaded.."