blob: 6f81baadeadbbbd7f58338e8a9ebde8617eb4a00 (
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
34
35
36
37
38
39
40
|
#!/usr/bin/env bash
# display workspace status
# requires wmctrl
# get the current workspace
ws=$( xprop -root _NET_CURRENT_DESKTOP | sed -e 's/_NET_CURRENT_DESKTOP(CARDINAL) = //' )
# icons
CURRENT=●
OCCUPIED=●
UNOCCUPIED=·
# colors
current="$( ~/scripts/get_xres color5 )"
occupied="$( ~/scripts/get_xres color8 )"
unoccupied="$( ~/scripts/get_xres color8 )"
# print workspaces to stdout
draw() {
for i in {0..5}; do
# get the number of windows in each workspace
windows=$( wmctrl -l | cut -d ' ' -f3 | grep $i | wc -l )
if [[ $i -eq $ws ]]
then
# current workspace
echo -ne "%{F$current} $CURRENT "
else
if [[ $windows -eq 0 ]]
then
echo -ne "%{F$unoccupied} $UNOCCUPIED "
else
echo -ne "%{F$occupied} $OCCUPIED "
fi
fi
done
}
draw
|