summaryrefslogtreecommitdiff
path: root/.config/eww/scripts/update_workspaces
diff options
context:
space:
mode:
authorbd <bdunahu@operationnull.com>2025-10-18 16:49:18 -0400
committerbd <bdunahu@operationnull.com>2025-10-18 16:49:18 -0400
commit4d6171844a8b6971c76be8054aa56b65685317fd (patch)
treeadbea5f22b8c6f6c3392cac5c049d5424f9ba770 /.config/eww/scripts/update_workspaces
parentb5eaf56936b0620e0fb0f2f0d4bb12936f7f2445 (diff)
move tab-bar-global info to dedicated eww panel
Diffstat (limited to '.config/eww/scripts/update_workspaces')
-rwxr-xr-x.config/eww/scripts/update_workspaces34
1 files changed, 34 insertions, 0 deletions
diff --git a/.config/eww/scripts/update_workspaces b/.config/eww/scripts/update_workspaces
new file mode 100755
index 0000000..4fb1b1c
--- /dev/null
+++ b/.config/eww/scripts/update_workspaces
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+gib_workspace_names() {
+ wmctrl -d \
+ | awk '{ print $1 " " $2 " " $9 }' \
+ | grep -v NSP
+}
+
+gib_workspace_yuck() {
+ buffered=""
+ gib_workspace_names | while read -r id active name; do
+ name="${name#*_}"
+ if [ "$active" == '*' ]; then
+ active_class="active"
+ else
+ active_class="inactive"
+ fi
+
+ if wmctrl -l | grep --regexp '.*\s\+'"$id"'\s\+.*' >/dev/null; then
+ button_class="occupied"
+ button_name="●"
+ else
+ button_class="empty"
+ button_name="○"
+ fi
+ buffered+="(button :class \"$button_class $active_class\" :onclick \"wmctrl -s $id\" \"$button_name\")"
+ echo -n "$buffered"
+ buffered=""
+ done
+}
+
+box_attrs=':orientation "h" :class "workspaces" :space-evenly false :halign "center" :valign "center" :vexpand false :spacing 8 '
+
+echo "(box $box_attrs $(gib_workspace_yuck))"