Skip to content

Instantly share code, notes, and snippets.

@jonlorusso
Created February 13, 2015 00:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonlorusso/5fb6cab18b79e2dde684 to your computer and use it in GitHub Desktop.
Save jonlorusso/5fb6cab18b79e2dde684 to your computer and use it in GitHub Desktop.
#!/bin/bash
focused="%{U#FFdd7380+u}----------%{U-}"
active="%{U#FF1b1b1b+u}----------%{U-}"
normal="%{U#FF4b4b4b+u}----------%{U-}"
desktops() {
desktops=""
for e in $(echo $1 | cut -d':' -f2-6 | tr ':' '\n')
do
if [ "${e:0:1}" == "O" ]; then
desktops="$desktops $focused"
elif [ "${e:0:1}" == "F" ]; then
desktops="$desktops $focused"
elif [ "${e:0:1}" == "o" ]; then
desktops="$desktops $active"
else
desktops="$desktops $normal"
fi
done
echo $desktops
}
bspc control --subscribe | \
while read -r line ; do
# skip messages for other monitors
[ $( echo $line | grep "^WM$MONITOR" ) ] || continue
output=$(desktops $line)
echo "%{c}$output%{r}"
done | bar -bp -g "1366x18" -u 6 -F "#00000000" -B "#00000000"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment