blob: 63117ef0fd4d9dcad82ee6e6f8d05c54937cc90d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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))
|