-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.yabairc
executable file
·113 lines (93 loc) · 6.11 KB
/
.yabairc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
! /usr/bin/env zsh
### Variables ###
# Note: These variables are menat to by easily changed by anyone.
export shadow_toggle="off" # Determines wether window shadows are on (usage: on/off)
export mouse_mod="ctrl" # key that when pressed, mouse can be used to move and resize (usage: cmd/alt/ctrl/shift)1
export border_toggle="on" # Determines wether borders for active windows are on (usage: on/off)
export border_width="2" # Determines the width of the active window's border (usage: 2/5/any number)
export border_radius="11" # radius of the active window's border (usage: 11/0/any number)
export opacity_toggle="off" # Detriments wether opacity based focus is on (usage: on/off)
export layout="bsp" # Layout of windows (usage: bsp/float/stack)
export animation_duration="0.0" # Window animation duration (usage: 0.0/0.3/0.5)
# animations cannot be on if using a stack layout.
export autoraise_toggle="on" # turn autoraise on or off (usage: on/off)
### Load scriptting adittion ##
sudo yabai --load-sa
yabai -m signal --add event=dock_did_restart action="sudo yabai --load-sa" # If yabai detected that i loaded the scripting addition, restart yabai
### Focus the window that is hoverd with the mouse ###
if [[ $autoraise_toggle == "on" ]]; then
yabai -m config focus_follows_mouse autoraise
# yabai -m config mouse_follows_focus on
fi
### Toggles ###
yabai -m config window_shadow $shadow_toggle # turn on/off window shadows (configured in variables)
yabai -m config mouse_modifier $mouse_mod # make cmd the mouse modifier key (configued in variables)
yabai -m config layout $layout # set layout (configured in variables)
yabai -m config window_animation_duration $animation_duration # Set animation duration (configured in variables)
yabai -m config window_border_radius $border_radius # set border radius (configured in variables)
### Configure opacity based focus ###
yabai -m config window_opacity $opacity_toggle # Turn on/off opacity based focus (configured in variables)
yabai -m config window_opacity_duration 0.2 # Time it takes to fade between windows
yabai -m config active_window_opacity 1.0 # opacity for the focused window
yabai -m config normal_window_opacity 0.9 # opacity for other windows
### Configure mouse usage ###
yabai -m config mouse_action1 warp
yabai -m config mouse_action2 resize
### Configure window borders ###
yabai -m config window_border $border_toggle # Turn on/off window borders (configured in variables)
yabai -m config window_border_width $border_width # Set border width (configured in variables)
yabai -m config active_window_border_color 0xFFcba6f7 # Set border color for the active window
yabai -m config normal_window_border_color 0xFF3e4050 # set border color for other windows
### don't uncomment, but run on first install. uncommenting will break borders upon restart
# yabai -m window --toggle border
### Configure window gaps ###
yabai -m config top_padding 3 # Top gap width (configured in variables)
yabai -m config bottom_padding 5 # Bottom gap width (configured in variables)
yabai -m config left_padding 5 # left gap width (configured in variables)
yabai -m config right_padding 5 # right gap width (configured in variables)
yabai -m config window_gap 8 # inside gap width (configured in variables)
yabai -m config external_bar main:30:0 # Add padding for main:display
# Configure individual spaces
# Space 1: Spotify
yabai -m space 1 --label spotify
# Space 2: Browser
yabai -m space 2 --label browser
# ...
# Space 6: discord/slack
yabai -m space 6 --label comm
yabai -m config --space 6 layout stack
yabai -m config --space 6 left_padding 38
# yabai -m config --space 6 window_opacity off
# Center unmanaged windows
# Managed apps can't be moved
yabai -m rule --add label="Finder" app="^Finder$" title="(Co(py|nnect)|Move|Info|Finder Pref)" manage=off
yabai -m rule --add label="Safari" app="^Safari$" title="^(General|(Tab|Password|Website|Extension)s|AutoFill|Se(arch|curity)|Privacy|Privacy Report)|Advanced)$" manage=off
yabai -m rule --add label="Orion" app="^Orion$" title="^(General|Appearance|Browsing|Sync|Passwords|Privacy|Search|Websites|Advanced)$" manage=off
yabai -m rule --add label="System Settings" app="^System Settings$" title=".*" manage=off
yabai -m rule --add label="Software Update" title="Software Update" manage=off
yabai -m rule --add label="About This Mac" app="System Information" title="About This Mac" manage=off
yabai -m rule --add label="Archive Utility" app="Archive Utility" title="Archive Utility" manage=off
# yabai -m rule --add label="IntellJ IDEA" app="IntelliJ IDEA$" title="Preferences" manage=off
# yabai -m rule --add app="IntelliJ IDEA" title="(Preferences|Project Structure|Choose Modules)" manage=off
yabai -m rule --add app="Steam" manage=off
events=('application_launched')
# apps=('System Preferences' 'Archive Utility')
apps=('System Settings', 'Archive Utility')
read -r -d '' action <<- 'EOF'
window="$(yabai -m query --windows --window)"
display="$(yabai -m query --displays --window)"
coords="$(jq \
--argjson window "${window}" \
--argjson display "${display}" \
-nr '(($display.frame | .x + .w / 2) - ($window.frame.w / 2) | tostring)
+ ":"
+ (($display.frame | .y + .h / 2) - ($window.frame.h / 2) | tostring)')"
yabai -m window --move "abs:${coords}"
EOF
(( ${#apps[@]} )) && app_query="app=\"^($(IFS=\|;echo "${apps[*]}"))\$\""
for event in "${events[@]}"; do
yabai -m signal --add label="${0}_signal_${event}" event="${event}" \
$(eval "${app_query}}") action="${action}"
done
### Notify when the yabai config finished loading ###
echo "yabai configuration loaded.."