Auto minimizing "Carousel" mode
- Dominant language
- C
- Stars
- 29.6k
- Forks
- 750
- PR merge metrics
- No merged PRs in 30d
Description
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 -m signal --add event=window_created action="yabai-count-minimize"
yabai -m signal --add event=window_destroyed action="yabai-count-minimize"
```
yabai-count-minimize
```
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=$(yabai -m query --windows --space | jq 'sort_by(.frame.y, .frame.x ) | .[1].id')
STACK2=$(yabai -m query --windows --space | jq 'sort_by(.frame.y, .frame.x ) | .[2].id')
STACK3=$(echo $WINDOWS_ARRAY | jq -re "sort_by(.frame.x, .frame.y, .id) | .[3].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-1])
yabai -m config split_ratio 0.65
;;
2)
yabai -m window --deminimize $LAST_MIN;yabai -m window last --insert south
yabai -m window --focus $STACK
yabai -m config split_ratio 0.5
yabai -m window $STACK --insert north
yabai -m space --balance x-axis
;;
3)
yabai -m config split_ratio 0.5
yabai -m window $STACK --insert north
yabai -m space --balance x-axis
;;
*)
yabai -m config split_ratio 0.5
yabai -m window $STACK3 --minimize
yabai -m window $STACK --insert north
yabai -m space --balance x-axis
;;
esac
```
https://user-images.githubusercontent.com/77557804/219257720-f31f4448-6e64-46ff-824a-577bf705d900.mp4
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the .yabairc signal definitions and the yabai-count-minimize script, then reproduce the three- or four-window behavior shown in the video. Clarify the expected main-window protection and the ordering used when a minimized window is restored; done means that carousel behavior is consistent as windows are created, destroyed, minimized, and un-minimized.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- shell
- Domain
- cli, desktop
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100