summaryrefslogtreecommitdiff
path: root/.config/eww/scripts
diff options
context:
space:
mode:
authorbd <bdunahu@operationnull.com>2025-10-27 11:52:47 -0400
committerbd <bdunahu@operationnull.com>2025-10-27 11:52:47 -0400
commit4e80c119a8a062c419540be9b197df175ab21b7c (patch)
tree039717033a97dc78c74d5f494e61cf190a753e89 /.config/eww/scripts
parentbfa9d711a225d6ceb445bbb60dfac0f8ed24443d (diff)
display open X windows (current workspace) on left side of eww bar
Diffstat (limited to '.config/eww/scripts')
-rwxr-xr-x.config/eww/scripts/update_x_names33
1 files changed, 33 insertions, 0 deletions
diff --git a/.config/eww/scripts/update_x_names b/.config/eww/scripts/update_x_names
new file mode 100755
index 0000000..63117ef
--- /dev/null
+++ b/.config/eww/scripts/update_x_names
@@ -0,0 +1,33 @@
+#!/run/current-system/profile/bin/guile \
+-s
+!#
+
+(use-modules (ice-9 popen)
+ (ice-9 textual-ports)
+ (ice-9 rdelim))
+
+(define cmd "wmctrl -l | awk -v ws=\"$(wmctrl -d | awk '$2 == \"*\" {print $1}')\" '$2 == ws {print}' | cut -d ' ' -f 5-")
+
+(define box-attrs '(:class "classes"
+ :orientation "h"
+ :valign "center"
+ :halign "start"
+ :space-evenly "false"))
+
+(define titles
+ (let* ((process (open-pipe* OPEN_READ "sh" "-c" cmd))
+ (output (get-string-all process)))
+ (close-pipe process)
+ output))
+
+(define labels
+ (map (lambda (t) `(eventbox
+ :onclick ,(string-concatenate `("wmctrl -a \"" ,t "\""))
+ (label :class "class"
+ :text ,t
+ :truncate true
+ :valign "center")))
+ (filter (lambda (s) (not (string=? s "")))
+ (string-split titles #\newline))))
+
+(write `(box ,@box-attrs ,@labels))