#!/bin/sh # env # Written in 2019 by Lucas # CC0 1.0 Universal/Public domain - No rights reserved # # To the extent possible under law, the author(s) have dedicated all # copyright and related and neighboring rights to this software to the # public domain worldwide. This software is distributed without any # warranty. You should have received a copy of the CC0 Public Domain # Dedication along with this software. If not, see # . if [ -f ~/.config/herbstluftwm/theme ]; then . ~/.config/herbstluftwm/theme fi tagstatus() { mon=$1 herbstclient tag_status "$mon" | tr "\t" "\n" | { out= while IFS= read -r line; do [ -z "$line" ] && continue tag=${line#[.:+#%!-]} rev= color=$hlwm_color8 case $line in :*) color=$hlwm_foreground ;; [#-]*) color=$hlwm_color14 ;; [%+]*) color=$hlwm_color6 ;; !*) color=$hlwm_color13 focused=$(herbstclient attr tags.focus.name) if [ "$tag" = "$focused" ]; then color=$hlwm_color14 fi ;; esac o=$o"%{O1}%{U$color+u}%{O5}%{U--u}" done printf "%%{c}%s%%{O1}\n" "$o" } } taglist() { mon=$1 tagstatus "$mon" herbstclient -i "tag_changed|tag_flags" \ | while read -r discard; do tagstatus "$mon" done } if [ $# -ne 0 ]; then printf "Usage: %s monitor x y width height\n" "${0##*/}" >&2 exit 1 fi while IFS=" " read -r m x y w h; do left= center= right= { taglist "$m" & spoon -t & } | while IFS= read line; do case $line in "%{c}"*) center=$line ;; "%{r}"*) right=$line ;; esac printf "%s%s%s\n" "$left" "$center" "$right" done | lemonbar-xft -g "$w"x"$h"+"$x"+"$y" \ -B "$hlwm_background" -F "$hlwm_foreground" \ -f "$hlwm_face" | sh & done herbstclient -w reload >/dev/null kill 0