diff options
Diffstat (limited to 'scripts/scripts/2bws.sh')
-rwxr-xr-x | scripts/scripts/2bws.sh | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/scripts/scripts/2bws.sh b/scripts/scripts/2bws.sh new file mode 100755 index 0000000..6f81baa --- /dev/null +++ b/scripts/scripts/2bws.sh | |||
@@ -0,0 +1,40 @@ | |||
1 | #!/usr/bin/env bash | ||
2 | # display workspace status | ||
3 | # requires wmctrl | ||
4 | |||
5 | # get the current workspace | ||
6 | ws=$( xprop -root _NET_CURRENT_DESKTOP | sed -e 's/_NET_CURRENT_DESKTOP(CARDINAL) = //' ) | ||
7 | |||
8 | # icons | ||
9 | CURRENT=● | ||
10 | OCCUPIED=● | ||
11 | UNOCCUPIED=· | ||
12 | |||
13 | # colors | ||
14 | current="$( ~/scripts/get_xres color5 )" | ||
15 | occupied="$( ~/scripts/get_xres color8 )" | ||
16 | unoccupied="$( ~/scripts/get_xres color8 )" | ||
17 | |||
18 | # print workspaces to stdout | ||
19 | draw() { | ||
20 | for i in {0..5}; do | ||
21 | # get the number of windows in each workspace | ||
22 | windows=$( wmctrl -l | cut -d ' ' -f3 | grep $i | wc -l ) | ||
23 | |||
24 | |||
25 | if [[ $i -eq $ws ]] | ||
26 | then | ||
27 | # current workspace | ||
28 | echo -ne "%{F$current} $CURRENT " | ||
29 | else | ||
30 | if [[ $windows -eq 0 ]] | ||
31 | then | ||
32 | echo -ne "%{F$unoccupied} $UNOCCUPIED " | ||
33 | else | ||
34 | echo -ne "%{F$occupied} $OCCUPIED " | ||
35 | fi | ||
36 | fi | ||
37 | done | ||
38 | } | ||
39 | |||
40 | draw | ||