From 51810b5c07e20982ebdf66f0bfb384c4bf55ad7d Mon Sep 17 00:00:00 2001 From: Akshay Date: Wed, 22 Jul 2020 08:04:08 +0530 Subject: squash again --- scripts/scripts/2bws.sh | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100755 scripts/scripts/2bws.sh (limited to 'scripts/scripts/2bws.sh') 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 @@ +#!/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 -- cgit v1.2.3