Dots/configs/eww/scripts/workspaces
2023-04-19 11:04:08 +01:00

27 lines
857 B
Bash
Executable file

#!/usr/bin/env bash
gib() {
current=$(wmctrl -d | grep '*' | awk '{print $1}')
for workspace in $(wmctrl -d | awk '{print $1}'); do
if [ $current -eq $workspace ]; then
focused="workspace-focused"
else
focused=""
fi
if [ $(wmctrl -lx | grep " $workspace " | awk '{print $1}' | wc -l) -gt 0 ]; then
occupied="workspace-occupied"
else
occupied=""
fi
echo "(button :class \"workspace $occupied $focused\" :onclick \"wmctrl -s $workspace\")"
done
}
# echo "(box :class \"workspaces\" :orientation \"v\" :space-evenly false :spacing \"0\" $(gib))"
xprop -spy -root _NET_CURRENT_DESKTOP | while read -r; do
eww update workspace_data="(box :class \"workspaces\" :orientation \"v\" :space-evenly false :spacing \"0\" $(gib))"
done