Increase window padding when window count low #1419
Replies: 3 comments 2 replies
-
I don't think you can script your way around that. Might have to either add some form of syntax to allow batching, or just introduce something like |
Beta Was this translation helpful? Give feedback.
-
Thank you for that example! |
Beta Was this translation helpful? Give feedback.
-
Thanks @ephemeraleternity for the idea! Also relative beginner here, but just adding in another variant in case someone finds it helpful: With the following in my yabairc: # Padding and gaps
yabai -m config top_padding 12 \
bottom_padding 12 \
left_padding 12 \
right_padding 12 \
window_gap 12
# Call external shell script on window update to adjust padding
yabai -m signal --add event=window_created action="~/.config/yabai/paddingRefresh.sh"
yabai -m signal --add event=window_destroyed action="~/.config/yabai/paddingRefresh.sh"
yabai -m signal --add event=window_minimized action="~/.config/yabai/paddingRefresh.sh"
yabai -m signal --add event=window_deminimized action="~/.config/yabai/paddingRefresh.sh" I have a shell script next to yabairc with the following: #!/bin/bash
currentDisplayUUID=$(yabai -m query --displays --display mouse | jq -r '.uuid')
myWidescreenUUID="41846C28-F936-44BB-86C0-AF51F09SF4F5"
if [[ "$currentDisplayUUID" == "$myWidescreenUUID" ]]
then
countUnfloated=$(yabai -m query --windows --display | jq -r '.[]."is-floating"' | grep false | wc -l)
countInvisible=$(yabai -m query --windows --display | jq -r '.[]."is-visible"' | grep false | wc -l)
windowCount="$((countUnfloated - countInvisible))"
case $windowCount in
[0-1])
yabai -m config --space mouse left_padding 500 \
right_padding 500
;;
2)
yabai -m config --space mouse left_padding 200 \
right_padding 200
;;
*)
yabai -m config --space mouse left_padding 12 \
right_padding 12
;;
esac
else
yabai -m config --space mouse left_padding 12 \
right_padding 12
fi |
Beta Was this translation helpful? Give feedback.
-
Since I'm using a 27" iMac, I don't need a single window to fill up the entire screen. To decrease window size, I've written a script that increases window padding when the number of windows is low. This is basically the same idea as in this discussion, but since it's more than a year old, I figured I'd open up a new one.
Using window padding to change window size introduces a noticeable delay when opening new windows though. Which is why I'd like to ask for help with my script or even a different method of achieving what I want. The delay is introduced by requiring four separate adjustments for padding (top, bottom, left, right). This means all windows get visibly shifted four times every time I open a new one. I'm very much a beginner to shell scripting and programming in general and I'm aware that my code is very likely to be pretty bad. I'm honestly quite surprised I've gotten this to work at all.
Whether this can be improved or not, yabai is still an amazing window manager and I'm grateful for all the work and continual improvements that are being put into it!
Beta Was this translation helpful? Give feedback.
All reactions