35 lines
1 KiB
Bash
Executable file
35 lines
1 KiB
Bash
Executable file
#! /bin/sh
|
|
|
|
PANEL_FIFO=/tmp/panel-fifo
|
|
PANEL_HEIGHT=24
|
|
PANEL_FONT="-*-fixed-*-*-*-*-10-*-*-*-*-*-*-*"
|
|
PANEL_WM_NAME=bspwm_panel
|
|
export PANEL_FIFO PANEL_HEIGHT PANEL_FONT PANEL_WM_NAME
|
|
|
|
if xdo id -a "$PANEL_WM_NAME" > /dev/null ; then
|
|
printf "%s\n" "The panel is already running." >&2
|
|
exit 1
|
|
fi
|
|
|
|
trap 'trap - TERM; kill 0' INT TERM QUIT EXIT
|
|
|
|
[ -e "$PANEL_FIFO" ] && rm "$PANEL_FIFO"
|
|
mkfifo "$PANEL_FIFO"
|
|
|
|
bspc subscribe report > "$PANEL_FIFO" &
|
|
|
|
while :; do
|
|
date '+%y-%m-%d %H:%M' | xargs -0 printf "D%s"
|
|
top -bn1 | grep 'Cpu(s)' | sed "s/.*, *\([0-9.]*\)%* id.*/\1/" | awk '{print 100 - $1"%"}' | xargs -0 printf "C%s"
|
|
free -h | awk '/^Mem/ { print $3 " / " $2 }' | sed 's/i//g' | xargs -0 printf "R%s"
|
|
sleep 1
|
|
done > "$PANEL_FIFO" &
|
|
|
|
. .config/panel/panel_colors
|
|
|
|
.config/panel/panel_bar < "$PANEL_FIFO" | lemonbar -a 32 -u 2 -n "$PANEL_WM_NAME" -g x$PANEL_HEIGHT -f "$PANEL_FONT" -F "$COLOR_DEFAULT_FG" -B "$COLOR_DEFAULT_BG" | sh &
|
|
|
|
wid=$(xdo id -m -a "$PANEL_WM_NAME")
|
|
xdo above -t "$(xdo id -N Bspwm -n root | sort | head -n 1)" "$wid"
|
|
|
|
wait
|