Remove .yabairc

This commit is contained in:
Kasper Juul Hermansen 2023-09-25 22:27:32 +02:00
parent 4e03180b5d
commit 760c24d41a
Signed by: kjuulh
GPG Key ID: 57B6E1465221F912

View File

@ -1,169 +0,0 @@
#!/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 --displays \
# | jq -r 'map(select(.uuid == "37D8832A-2D66-02CA-B9F7-8F30A301B230")) | .[].spaces | .[]' \
# | xargs -I{} yabai -m query --windows --space {} \
# | jq -r 'map(select(."is-minimized" == false)) | length')
output=$(yabai -m query --displays \
| jq -r 'map(select(.uuid == "37D8832A-2D66-02CA-B9F7-8F30A301B230")) | .[].spaces | .[]' \
| xargs -I{} yabai -m query --windows --space {} \
| jq -r 'map(select(."is-minimized" == false))' \
| jq -c '[if length > 0 then {space: .[0].space, length: length} else empty end] | .[]')
echo "$output" | while read -r line; do
scale=40
space=$(echo "$line" | jq -r '.space')
length=$(echo "$line" | jq -r '.length')
p=$((length == 1 ? $scale : 20))
di="$space"
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
done
output=$(yabai -m query --displays \
| jq -r 'map(select(.uuid == "04D18502-16C9-45C6-8D4E-F6DAA26C5AB6")) | .[].spaces | .[]' \
| xargs -I{} yabai -m query --windows --space {} \
| jq -r 'map(select(."is-minimized" == false))' \
| jq -c '[if length > 0 then {space: .[0].space, length: length} else empty end] | .[]')
echo "$output" | while read -r line; do
scale=200
space=$(echo "$line" | jq -r '.space')
length=$(echo "$line" | jq -r '.length')
p=$((length == 1 ? $scale : 20))
di="$space"
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
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"
padding_refresh_command="~/bin/refresh-yabai-padding.sh"
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.."