Skip to content

Commit

Permalink
Update yabai.1d.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
SxC97 authored Dec 11, 2020
1 parent 3f44410 commit 1e522c9
Showing 1 changed file with 52 additions and 2 deletions.
54 changes: 52 additions & 2 deletions yabai.1d.sh
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,25 @@ SPACES=('•' '•' '•' '•' '•' '•' '•' '•' '•' '•' '•' '•'

STYLE="CUSTOM"

# Choose weather or not you want to see the type of the current space. i.e. BSP, STACK, or FLOAT
# Options, `true` or `false`

SPACETYPE=true
BSP=""
STACK=""
FLOAT=""
SPACELEFT=" "
SPACERIGHT=" "

# Choose weather or not you want to see the type of the window. i.e. floating or managed
# Options, `true` or `false`

WINTYPE=true
WINFLOAT="⦿"
WINMANAGED=""
WINLEFT=" "
WINRIGHT=" "

# -------------------------------------------------------------------------#
# Don't edit anything below this point if you dont know what you're doing! #
# -------------------------------------------------------------------------#
Expand Down Expand Up @@ -121,9 +140,40 @@ elif [ "$STYLE" = "CUSTOM" ]; then
done
fi

STRING+=$RIGHT
FINALSTRING=$(echo "$STRING$RIGHT" | tr -s "$DIV")

TYPE=$(yabai -m query --spaces --space | jq .type)

if [[ $TYPE == *"bsp"* ]]; then
TYPE=$BSP
elif [[ $TYPE == *"stack"* ]]; then
TYPE=$STACK
elif [[ $TYPE == *"float"* ]]; then
TYPE=$FLOAT
else
TYPE=''
fi

WINDOW=$(yabai -m query --windows --window | jq .floating) 2> /dev/null

if ! [ -z "$WINDOW" ] && [[ $WINDOW -eq "0" ]]; then
WINDOW=$WINMANAGED
elif ! [ -z "$WINDOW" ] && [[ $WINDOW -eq "1" ]]; then
WINDOW=$WINFLOAT
else
WINDOW=''
fi

if [[ "$SPACETYPE" = true ]] && [[ "$WINTYPE" = true ]]; then
FINAL=$FINALSTRING$SPACELEFT$TYPE$SPACERIGHT$WINLEFT$WINDOW$WINRIGHT
elif [[ "$SPACETYPE" = true ]]; then
FINAL=$FINALSTRING$SPACELEFT$TYPE$SPACERIGHT
elif [[ "$WINTYPE" = true ]]; then
FINAL=$FINALSTRING$WINLEFT$WINDOW$WINRIGHT
fi

echo "$FINAL"

echo "$STRING" | tr -s "$DIV"
echo "---"
echo "Restart yabai & skhd | bash='$0' param1=restart terminal=false"
echo "Stop yabai & skhd | bash='$0' param1=stop terminal=false"
Expand Down

0 comments on commit 1e522c9

Please sign in to comment.