Add .yabairc
This commit is contained in:
parent
78698c08d6
commit
293261c96b
141
executable_dot_yabairc
Normal file
141
executable_dot_yabairc
Normal file
@ -0,0 +1,141 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
#
|
||||||
|
# for this to work you must configure sudo such that
|
||||||
|
# it will be able to run the command without password
|
||||||
|
#
|
||||||
|
# see this wiki page for information:
|
||||||
|
# - https://github.com/koekeishiya/yabai/wiki/Installing-yabai-(latest-release)#configure-scripting-addition
|
||||||
|
#
|
||||||
|
# yabai -m signal --add event=dock_did_restart action="sudo yabai --load-sa"
|
||||||
|
# sudo yabai --load-sa
|
||||||
|
#
|
||||||
|
|
||||||
|
yabai -m signal --add event=dock_did_restart action="sudo yabai --load-sa"
|
||||||
|
sudo yabai --load-sa
|
||||||
|
|
||||||
|
# global settings
|
||||||
|
yabai -m config \
|
||||||
|
mouse_follows_focus off \
|
||||||
|
focus_follows_mouse off \
|
||||||
|
window_origin_display default \
|
||||||
|
window_placement second_child \
|
||||||
|
window_zoom_persist on \
|
||||||
|
window_topmost off \
|
||||||
|
window_shadow on \
|
||||||
|
window_animation_frame_rate 120 \
|
||||||
|
window_opacity_duration 0.0 \
|
||||||
|
active_window_opacity 1.0 \
|
||||||
|
normal_window_opacity 0.90 \
|
||||||
|
window_opacity off \
|
||||||
|
insert_feedback_color 0xffd75f5f \
|
||||||
|
active_window_border_color 0xff775759 \
|
||||||
|
normal_window_border_color 0xff555555 \
|
||||||
|
window_border_width 4 \
|
||||||
|
window_border_radius 12 \
|
||||||
|
window_border_blur off \
|
||||||
|
window_border_hidpi on \
|
||||||
|
window_border off \
|
||||||
|
split_ratio 0.50 \
|
||||||
|
split_type auto \
|
||||||
|
auto_balance off \
|
||||||
|
window_gap 12 \
|
||||||
|
layout bsp \
|
||||||
|
mouse_modifier fn \
|
||||||
|
mouse_action1 move \
|
||||||
|
mouse_action2 resize \
|
||||||
|
mouse_drop_action swap
|
||||||
|
# window_animation_duration 0.0 \
|
||||||
|
# top_padding 12 \
|
||||||
|
# bottom_padding 12 \
|
||||||
|
# left_padding 12 \
|
||||||
|
# right_padding 12 \
|
||||||
|
|
||||||
|
#external_monitor=$(yabai -m query --displays | jq -r 'map(select(.external == 1)) | .[].index' | tr -d '\n')
|
||||||
|
|
||||||
|
window_numbers=$(yabai -m query --spaces \
|
||||||
|
| jq '.[].index' \
|
||||||
|
| xargs -I{} yabai -m query --windows --space {} \
|
||||||
|
| jq -r 'map(select(."is-minimized" == false)) | length')
|
||||||
|
|
||||||
|
di=1
|
||||||
|
for wn in $window_numbers; do
|
||||||
|
p=$((wn == 1 ? 200 : 20))
|
||||||
|
|
||||||
|
yabai -m config --space $di top_padding $p
|
||||||
|
yabai -m config --space $di bottom_padding $p
|
||||||
|
yabai -m config --space $di left_padding $p
|
||||||
|
yabai -m config --space $di right_padding $p
|
||||||
|
|
||||||
|
|
||||||
|
di=$((di+1))
|
||||||
|
done
|
||||||
|
|
||||||
|
# padding signals
|
||||||
|
padding_refresh_command="p=\$((\$(yabai -m query --windows --space | jq 'map(select(.\"is-minimized\" == false)) | length') == 1 ? 200 : 20)) && \
|
||||||
|
yabai -m config --space mouse top_padding \$p && \
|
||||||
|
yabai -m config --space mouse bottom_padding \$p && \
|
||||||
|
yabai -m config --space mouse left_padding \$p && \
|
||||||
|
yabai -m config --space mouse right_padding \$p"
|
||||||
|
|
||||||
|
|
||||||
|
yabai -m signal --add event=window_created action="$padding_refresh_command"
|
||||||
|
yabai -m signal --add event=window_destroyed action="$padding_refresh_command"
|
||||||
|
yabai -m signal --add event=application_launched action="$padding_refresh_command"
|
||||||
|
yabai -m signal --add event=application_terminated action="$padding_refresh_command"
|
||||||
|
|
||||||
|
# signals
|
||||||
|
yabai -m signal --add event=window_destroyed action="yabai -m query --windows --window &> /dev/null || yabai -m window --focus mouse"
|
||||||
|
yabai -m signal --add event=application_terminated action="yabai -m query --windows --window &> /dev/null || yabai -m window --focus mouse"
|
||||||
|
|
||||||
|
# if [[ $(yabai -m query --windows --space | jq "length") == 1 ]]; then
|
||||||
|
# # padding for one window
|
||||||
|
# yabai -m config top_padding 160
|
||||||
|
# yabai -m config bottom_padding 160
|
||||||
|
# yabai -m config left_padding 160
|
||||||
|
# yabai -m config right_padding 160
|
||||||
|
# else
|
||||||
|
# # padding for two or more windows
|
||||||
|
# yabai -m config top_padding 12
|
||||||
|
# yabai -m config bottom_padding 12
|
||||||
|
# yabai -m config left_padding 12
|
||||||
|
# yabai -m config right_padding 12
|
||||||
|
# fi
|
||||||
|
#
|
||||||
|
# yabai -m signal --add \
|
||||||
|
# event=window_created \
|
||||||
|
# action="[[ $(yabai -m query --windows --space | jq 'length') -gt 1 ]] \
|
||||||
|
# && yabai -m config top_padding 160 \
|
||||||
|
# && yabai -m config bottom_padding 160 \
|
||||||
|
# && yabai -m config left_padding 160 \
|
||||||
|
# && yabai -m config right_padding 160"
|
||||||
|
# yabai -m signal --add \
|
||||||
|
# event=window_destroyed \
|
||||||
|
# action="[[ $(yabai -m query --windows --space | jq 'length') == 1 ]] \
|
||||||
|
# && 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 rule --add app="^Google Chrome|Firefox|Arc$" space=2
|
||||||
|
# Text editors
|
||||||
|
yabai -m rule --add app="^(Code)$" space=1
|
||||||
|
# Jetbrains apps
|
||||||
|
apps="^(IntelliJ IDEA|WebStorm|RubyMine|PyCharm|DataGrip)$"
|
||||||
|
yabai -m rule --add app="${apps}" space=1 manage=off
|
||||||
|
|
||||||
|
# Floating
|
||||||
|
yabai -m rule --add app="^(1Password|AWS VPN Client)" manage=off
|
||||||
|
|
||||||
|
# Terminal
|
||||||
|
yabai -m rule --add app="^(Alacritty)$" space=1
|
||||||
|
# Mailspring
|
||||||
|
yabai -m rule --add app="^(Mailspring|Obsidian|Linear|Calendar)$" space=3
|
||||||
|
# Music
|
||||||
|
yabai -m rule --add app="^(Spotify)$" space=5
|
||||||
|
# Social
|
||||||
|
yabai -m rule --add app="^(Slack|WhatsApp|Microsoft Teams|Zoom)$" space=6
|
||||||
|
|
||||||
|
echo "yabai configuration loaded.."
|
||||||
|
|
Loading…
Reference in New Issue
Block a user