hlwm: simplify panel
This commit is contained in:
parent
82b8e95d7e
commit
83255497ac
@ -1,6 +1,6 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# env
|
# env
|
||||||
# Written in 2019 by Lucas
|
# Written in 2019-2020 by Lucas
|
||||||
# CC0 1.0 Universal/Public domain - No rights reserved
|
# CC0 1.0 Universal/Public domain - No rights reserved
|
||||||
#
|
#
|
||||||
# To the extent possible under law, the author(s) have dedicated all
|
# To the extent possible under law, the author(s) have dedicated all
|
||||||
@ -166,16 +166,6 @@ hc unlock
|
|||||||
|
|
||||||
hc detect_monitors
|
hc detect_monitors
|
||||||
|
|
||||||
if [ -f ~/.config/herbstluftwm/herbstpanel.sh ]; then
|
for m in $(hc list_monitors | cut -d : -f 1); do
|
||||||
bar_height=$(($hlwm_font_height))
|
sh ~/.config/herbstluftwm/herbstpanel.sh "$m" &
|
||||||
for m in $(hc list_monitors | cut -d : -f 1); do
|
done
|
||||||
hc monitor_rect "$m" | {
|
|
||||||
read -r x y w h
|
|
||||||
# `lemonbar -b` is relative from the bottom, so no need
|
|
||||||
# to do arithmetic in here
|
|
||||||
#y=$(($y + $h - $bar_height))
|
|
||||||
printf "%s\t%u\t%u\t%u\t%u\n" \
|
|
||||||
"$m" "$x" "$y" "$w" $bar_height
|
|
||||||
}
|
|
||||||
done | sh ~/.config/herbstluftwm/herbstpanel.sh &
|
|
||||||
fi
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# env
|
# env
|
||||||
# Written in 2019 by Lucas
|
# Written in 2019-2020 by Lucas
|
||||||
# CC0 1.0 Universal/Public domain - No rights reserved
|
# CC0 1.0 Universal/Public domain - No rights reserved
|
||||||
#
|
#
|
||||||
# To the extent possible under law, the author(s) have dedicated all
|
# To the extent possible under law, the author(s) have dedicated all
|
||||||
@ -14,7 +14,16 @@ if [ -f ~/.config/herbstluftwm/theme ]; then
|
|||||||
. ~/.config/herbstluftwm/theme
|
. ~/.config/herbstluftwm/theme
|
||||||
fi
|
fi
|
||||||
|
|
||||||
show_tags() {
|
bar_geomtry()
|
||||||
|
{
|
||||||
|
herbstclient monitor_rect "$m" | {
|
||||||
|
read -r mx my mw mh
|
||||||
|
printf "%ux%u+%u+%u\n" "$mw" "$hlwm_font_height" "$mx" "$my"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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)
|
focused=$(herbstclient attr tags.focus.name)
|
||||||
@ -33,7 +42,8 @@ show_tags() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tags_status() {
|
tags_status()
|
||||||
|
{
|
||||||
mon=$1
|
mon=$1
|
||||||
show_tags "$mon"
|
show_tags "$mon"
|
||||||
herbstclient -i "tag_(changed|flags)" | while read -r discard; do
|
herbstclient -i "tag_(changed|flags)" | while read -r discard; do
|
||||||
@ -41,33 +51,34 @@ tags_status() {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ $# -ne 0 ]; then
|
if [ $# -ne 1 ]; then
|
||||||
printf "Usage: %s monitor x y width height\n" "${0##*/}" >&2
|
printf "Usage: %s monitor\n" "${0##*/}" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
while IFS=" " read -r m x y w h; do
|
geometry=$(bar_geometry "$m")
|
||||||
left=
|
|
||||||
center=
|
left=
|
||||||
right=
|
center=
|
||||||
{
|
right=
|
||||||
tags_status "$m" &
|
{
|
||||||
spoon -t &
|
tags_status "$m" &
|
||||||
} | while IFS= read line; do
|
spoon -t &
|
||||||
case $line in
|
} | while IFS= read line; do
|
||||||
"%{l}"*)
|
case $line in
|
||||||
left=$line
|
"%{l}"*)
|
||||||
;;
|
left=$line
|
||||||
"%{c}"*)
|
;;
|
||||||
center=$line
|
"%{c}"*)
|
||||||
;;
|
center=$line
|
||||||
"%{r}"*)
|
;;
|
||||||
right=$line
|
"%{r}"*)
|
||||||
;;
|
right=$line
|
||||||
esac
|
;;
|
||||||
printf "%s%s%s\n" "$left" "$center" "$right"
|
esac
|
||||||
done | lemonbar-xft -b -g "${w}x${h}+${x}+${y}" \
|
printf "%s%s%s\n" "$left" "$center" "$right"
|
||||||
-B "$hlwm_background" -F "$hlwm_foreground" -f "$hlwm_face" &
|
done | lemonbar-xft -b -g "$geometry" \
|
||||||
done
|
-B "$hlwm_background" -F "$hlwm_foreground" -f "$hlwm_face" &
|
||||||
|
|
||||||
herbstclient -w reload
|
herbstclient -w reload
|
||||||
kill 0
|
kill 0
|
||||||
|
Loading…
Reference in New Issue
Block a user