#!/usr/bin/env sh
sudo yabai --load-sa
yabai -m signal --add event=dock_did_restart action="sudo yabai --load-sa"

yabai -m config external_bar all:20:20

# Without Ubersicht
#yabai -m config external_bar all:0:0

# global settings
yabai -m config mouse_follows_focus on
yabai -m config focus_follows_mouse on
yabai -m config window_placement second_child
yabai -m config window_topmost off
yabai -m config window_shadow on
yabai -m config window_border off
yabai -m config window_border_placement exterior
yabai -m config window_border_width 1.0
yabai -m config window_border_radius 1.0
yabai -m config active_window_border_color 0xff008bff
yabai -m config normal_window_border_color 0x01000000
yabai -m config insert_window_border_color 0xB2EBDBB2
yabai -m config window_opacity off
yabai -m config split_ratio 0.50
yabai -m config auto_balance on
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

yabai -m config window_topmost on
yabai -m config window_shadow float

# From DWM
yabai -m rule --add app="^System Preferences$" manage=off border=off
yabai -m rule --add app="^Alfred$" manage=off border=off
yabai -m rule --add app="choose" manage=off
yabai -m rule --add app="Calendar" manage=off
yabai -m rule --add app="JDownloader 2*" manage=off

yabai -m rule --add app="Terminal" space=^1 display=1
yabai -m rule --add app="iTerm2" space=^1 display=1

yabai -m rule --add app="Firefox" space=^2
yabai -m rule --add app="Opera" space=^2
yabai -m rule --add app="Safari" space=^2

yabai -m rule --add app="Mail" space=^3

# Communication
yabai -m rule --add app="Slack" space=^4
yabai -m rule --add app="Signal" space=^4
yabai -m rule --add app="Discord" space=^4
yabai -m rule --add app="WhatsApp" space=^4
yabai -m rule --add app="Microsoft Teams" space=^4
yabai -m rule --add app="Microsoft Outlook" space=^4
yabai -m rule --add app="Messages" space=^4

# Tools
yabai -m rule --add app="Music" space=^5
yabai -m rule --add app="QuickTime Player" space=^5
yabai -m rule --add app="VLC" space=^5
yabai -m rule --add app="Spotify" space=^5

# Floating
yabai -m rule --add app="DisplayLinkUserAgent" space=^7
