dotfiles/dotlocal/bin/get_active_workspace

23 lines
510 B
Bash
Executable file

#!/bin/sh
a=$(hyprctl workspaces | grep "workspace ID" | cut -d " " -f 3)
active=$(hyprctl monitors | grep "active workspace:" | tr -s ' ' | cut -d " " -f 3)
a=$(echo $a | tr " " "\n" | sort -g)
b="(box :space-evenly false "
for i in $a
do
if [ "${i}" == "${active}" ]
then
b="${b}(button :class 'active' :onclick 'hyprctl dispatch workspace ${i}' '${i}')"
else
b="${b}(button :class 'btw' :onclick 'hyprctl dispatch workspace ${i}' '${i}')"
fi
done
b="${b} )"
echo "$b"