Created
July 14, 2023 11:02
-
-
Save avevlad/93b01dad04f6954a81da318758c83783 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
IFS=$'\n' # make newlines the only separator | |
array=( `yabai -m query --windows | jq '.[] |(.id,.app)' | grep ""` ) | |
my_array_length=${#array[@]} | |
function center_all_windows() { | |
yabai -m space --toggle padding | |
yabai -m space --padding abs:20:20:20:20 | |
for ((idx=0; idx<${#array[@]}; ++idx)); do | |
grid="4:10:2:0:6:4" | |
if [ $(($idx % 2)) -eq 0 ] | |
then | |
# if [[ "${array[idx+1]}" == *"Code"* ]]; then | |
# grid="1:1:2:0:6:4" | |
# fi | |
if [[ "${array[idx+1]}" == *"iTerm2"* ]]; then | |
echo "Iterm!!!" | |
grid="4:10:2:0:6:3" | |
fi | |
echo "$idx" "${array[idx]}" "${array[idx+1]}" | |
yabai -m window ${array[idx]} --toggle float --grid $grid | |
fi | |
done | |
} | |
function fullscreen_all_windows() { | |
yabai -m space --toggle padding | |
yabai -m space --padding abs:0:0:0:0 | |
for ((idx=0; idx<${#array[@]}; ++idx)); do | |
if [ $(($idx % 2)) -eq 0 ] | |
then | |
echo "$idx" "${array[idx]}" "${array[idx+1]}" | |
yabai -m window ${array[idx]} --toggle float --grid 1:1:2:0:6:4 | |
fi | |
done | |
} | |
if [ "$1" == "center_all_windows" ]; then center_all_windows; fi | |
if [ "$1" == "fullscreen_all_windows" ]; then fullscreen_all_windows; fi | |
unset IFS |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment