herbstpanel: also show current tag

This commit is contained in:
Lucas 2020-01-31 03:03:27 +00:00
parent 64ef0b5728
commit 0dd308156c
1 changed files with 10 additions and 9 deletions

View File

@ -14,29 +14,30 @@ if [ -f ~/.config/herbstluftwm/theme ]; then
. ~/.config/herbstluftwm/theme . ~/.config/herbstluftwm/theme
fi fi
show_urgent_tags() { show_tags() {
mon=$1 mon=$1
herbstclient tag_status "$mon" | tr "\t" "\n" | { herbstclient tag_status "$mon" | tr "\t" "\n" | {
focused=$(herbstclient attr tags.focus.name)
s= s=
while IFS= read -r line; do while IFS= read -r line; do
[ -n "$line" ] || continue [ -n "$line" ] || continue
tag=${line#[.:+#%!-]} tag=${line#[.:+#%!-]}
case $line in case $line in
!*) focused=$(herbstclient attr tags.focus.name) !*) [ "$tag" != "$focused" ] && s=$s" $line"
[ "$tag" != "$focused" ] && s=$s"$line "
;; ;;
esac esac
done done
printf "%%{l}%%{F%s}%s%%{F-}\n" "$hlwm_color9" "$s" printf "%%{l} %s%%{F%s}%s%%{F-}\n" \
"$focused" "$hlwm_color9" "$s"
} }
} }
tagstatus() { tags_status() {
mon=$1 mon=$1
show_urgent_tags "$mon" show_tags "$mon"
herbstclient -i "tag_flags" | while read -r discard; do herbstclient -i "tag_(changed|flags)" | while read -r discard; do
show_urgent_tags "$mon" show_tags "$mon"
done done
} }
@ -50,7 +51,7 @@ while IFS=" " read -r m x y w h; do
center= center=
right= right=
{ {
tagstatus "$m" & tags_status "$m" &
spoon -t & spoon -t &
} | while IFS= read line; do } | while IFS= read line; do
case $line in case $line in