1
0
Fork 0
mirror of https://github.com/Horhik/dotfiles.git synced 2024-11-30 12:01:26 +00:00
Dotfiles/.config/polybar/polybar-scripts/info-hlwm-workspaces/info-hlwm-workspaces.sh
2020-07-27 07:59:00 +03:00

47 lines
1.7 KiB
Bash

#!/usr/bin/env bash
herbstclient --idle "tag_*" 2>/dev/null | {
while true; do
# Read tags into $tags as array
IFS=$'\t' read -ra tags <<< "$(herbstclient tag_status)"
{
for i in "${tags[@]}" ; do
# Read the prefix from each tag and render them according to that prefix
case ${i:0:1} in
'#')
# the tag is viewed on the focused monitor
# TODO Add your formatting tags for focused workspaces
;;
':')
# : the tag is not empty
# TODO Add your formatting tags for occupied workspaces
;;
'!')
# ! the tag contains an urgent window
# TODO Add your formatting tags for workspaces with the urgent hint
;;
'-')
# - the tag is viewed on a monitor that is not focused
# TODO Add your formatting tags for visible but not focused workspaces
;;
*)
# . the tag is empty
# There are also other possible prefixes but they won't appear here
echo "%{F-}%{B-}" # Add your formatting tags for empty workspaces
;;
esac
echo "%{A1:herbstclient use ${i:1}:} ${i:1} %{A -u -o F- B-}"
done
echo "%{F-}%{B-}"
} | tr -d "\n"
echo
# wait for next event from herbstclient --idle
read -r || break
done
} 2>/dev/null