Files
hlwm-config/statusbar.sh
2018-04-03 23:17:34 +02:00

52 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
source ~/.config/herbstluftwm/settings.sh
# disable path name expansion or * will be expanded in the line
# cmd=( $line )
set -f
statusbar_height=20
monitor=${1:-0}
geometry=( $(herbstclient monitor_rect "$monitor") )
if [ -z "$geometry" ] ;then
echo "Invalid monitor $monitor"
exit 1
fi
# geometry has the format: WxH+X+Y
x=${geometry[0]}
y=$((${geometry[3]} - $statusbar_height))
screen_width=${geometry[2]}
panelGeometry=${geometry[2]}x${statusbar_height}+${x}+${y}
{
conky -c /home/idon/.config/herbstluftwm/conkyrc | while read -r; do
echo -e "$REPLY";
done > >(uniq_linebuffered) &
childpid=$!
herbstclient --idle
kill $childpid
} 2> /dev/null | {
while true ; do
read line || break
cmd=( $line )
# find out event origin
case "${cmd[0]}" in
focus_changed|window_title_changed|tag_changed|tag_flags)
;;
quit_panel)
exit
;;
reload)
exit
;;
*)
echo $line
;;
esac
done
} 2> /dev/null \
| lemonbar \
-g $panelGeometry \
-f "$font" \
-B $bgcolor -F $fgcolor \
-u 2