Open Bellavene opened 1 year ago
@Bellavene that's a good implementation of tabbed view on the stack layout. Nice! Sorry for taking it out of context, but are you the original author, as I have not seen it before?
@Bellavene that's a good implementation of tabbed view on the stack layout. Nice! Sorry for taking it out of context, but are you the original author, as I have not seen it before?
Yes, thank you. Borrowed another script here as a starting point. Too bad we don't have a usual window counter in yabai and Asmund stated many times that he doesn't want to implement it. It would simplify a lot of things and will work as intended.
So far this version worked best for me, calls fewer queries. You must set window_placement first_child
and insert_feedback_color 0x00000000
in .yabairc
#!/bin/zsh
CURRENT_DISPLAY=$(yabai -m query --windows --window | jq '.display')
WINDOWS_ARRAY=$(yabai -m query --windows --space $(yabai -m query --spaces --space | jq '.index') --display $CURRENT_DISPLAY | jq -r 'map(select(.["is-minimized"]==false and .["is-floating"]==false))')
NUMBER_OF_WINDOWS=$(echo $WINDOWS_ARRAY | jq -r 'length')
STACK=$(echo $WINDOWS_ARRAY | jq -re "sort_by(.frame.y) | .[2].id")
LAST_MIN=$(yabai -m query --windows --space | jq -r '.[] | select(."is-minimized"==true).id' | tac | head -n 1)
case $NUMBER_OF_WINDOWS in
0)
yabai -m config split_ratio 0.35
;;
1)
yabai -m config split_type auto
yabai -m config split_ratio 0.5
;;
2)
yabai -m config split_ratio 0.5
yabai -m config split_type horizontal
yabai -m window $STACK --insert south
yabai -m window --deminimize $LAST_MIN && sleep 0.2; yabai -m window $STACK --insert south
yabai -m window --focus north
yabai -m window first --insert north
;;
3)
yabai -m window --warp first
yabai -m window first --insert north
;;
*)
yabai -m window uncle --minimize
sleep 0.4
yabai -m window --warp first
yabai -m window first --insert north
;;
esac
The more I use it, the more I like it. Perfect for macbooks little screens. I wish only that we could polish it a bit. Best would be to implement it right in yabai without scripts, or at least add a yabai global setting for new windows location point, at first window or last one. And ideally would be with 4 windows instead of 3 (too buggy to implement through scripts). Right now, it sometimes adds new window at master stack if application is opened fresh and master window was selected.
IMHO, That's how stage manager should have worked at the beginning, not that useless nonsense they've made.
I am trying to implement an auto minimizer/un-minimizer with three or four windows, but feel that I am a bit dumb to make it perfect. The main window should be untouchable, un-minimizing should take the window back to the first one on the right side. Any suggestions? Also tried a variation of stacking to the last window, but it is even worse.
.yabairc
yabai-count-minimize
https://user-images.githubusercontent.com/77557804/219257720-f31f4448-6e64-46ff-824a-577bf705d900.mp4