2019-09-11 04:11:40 +02:00
|
|
|
#!/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
|
|
|
|
# <http://creativecommons.org/publicdomain/zero/1.0/>.
|
|
|
|
|
|
|
|
if [ -f ~/.config/herbstluftwm/theme ]; then
|
|
|
|
. ~/.config/herbstluftwm/theme
|
|
|
|
fi
|
|
|
|
|
2020-01-26 18:28:08 +01:00
|
|
|
show_urgent_tags() {
|
2019-09-11 04:11:40 +02:00
|
|
|
mon=$1
|
|
|
|
herbstclient tag_status "$mon" | tr "\t" "\n" | {
|
2020-01-26 18:28:08 +01:00
|
|
|
s=
|
2019-09-11 04:11:40 +02:00
|
|
|
while IFS= read -r line; do
|
2020-01-26 18:28:08 +01:00
|
|
|
[ -n "$line" ] || continue
|
2019-09-11 04:11:40 +02:00
|
|
|
tag=${line#[.:+#%!-]}
|
|
|
|
|
|
|
|
case $line in
|
2020-01-26 18:28:08 +01:00
|
|
|
!*) focused=$(herbstclient attr tags.focus.name)
|
|
|
|
[ "$tag" != "$focused" ] && s=$s"$line "
|
2019-09-11 04:11:40 +02:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
2020-01-26 18:28:08 +01:00
|
|
|
printf "%%{l}%%{F%s}%s%%{F-}\n" "$hlwm_color9" "$s"
|
2019-09-11 04:11:40 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-01-26 18:28:08 +01:00
|
|
|
tagstatus() {
|
2019-09-11 04:11:40 +02:00
|
|
|
mon=$1
|
2020-01-26 18:28:08 +01:00
|
|
|
show_urgent_tags "$mon"
|
|
|
|
herbstclient -i "tag_flags" | while read -r discard; do
|
|
|
|
show_urgent_tags "$mon"
|
2019-09-11 04:11:40 +02:00
|
|
|
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=
|
|
|
|
{
|
2020-01-26 18:28:08 +01:00
|
|
|
tagstatus "$m" &
|
2019-09-11 04:11:40 +02:00
|
|
|
spoon -t &
|
|
|
|
} | while IFS= read line; do
|
|
|
|
case $line in
|
2020-01-26 18:28:08 +01:00
|
|
|
"%{l}"*)
|
|
|
|
left=$line
|
|
|
|
;;
|
2019-09-11 04:11:40 +02:00
|
|
|
"%{c}"*)
|
|
|
|
center=$line
|
|
|
|
;;
|
|
|
|
"%{r}"*)
|
|
|
|
right=$line
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
printf "%s%s%s\n" "$left" "$center" "$right"
|
2020-01-26 18:28:08 +01:00
|
|
|
done | lemonbar-xft -g "${w}x${h}+${x}+${y}" \
|
|
|
|
-B "$hlwm_background" -F "$hlwm_foreground" -f "$hlwm_face" &
|
2019-09-11 04:11:40 +02:00
|
|
|
done
|
|
|
|
herbstclient -w reload >/dev/null
|
|
|
|
kill 0
|