#! /bin/sh export COLOR_FOREGROUND='#FFCCCCCC' export COLOR_BACKGROUND='#FF000000' export COLOR_ACTIVE_MONITOR_FG='#FF000000' export COLOR_ACTIVE_MONITOR_BG='#FF000000' export COLOR_INACTIVE_MONITOR_FG='#FF58C5F1' export COLOR_INACTIVE_MONITOR_BG='#FF000000' export COLOR_FOCUSED_OCCUPIED_FG='#FFF6F9FF' export COLOR_FOCUSED_OCCUPIED_BG='#FF000000' export COLOR_FOCUSED_FREE_FG='#FFF6F9FF' export COLOR_FOCUSED_FREE_BG='#FF000000' export COLOR_FOCUSED_URGENT_FG='#FF000000' export COLOR_FOCUSED_URGENT_BG='#FFF9A299' export COLOR_OCCUPIED_FG='#FFA3A6AB' export COLOR_OCCUPIED_BG='#FF000000' export COLOR_FREE_FG='#FF6F7277' export COLOR_FREE_BG='#FF000000' export COLOR_URGENT_FG='#FFF9A299' export COLOR_URGENT_BG='#FF000000' export COLOR_LAYOUT_FG='#FFA3A6AB' export COLOR_LAYOUT_BG='#FF000000' export COLOR_TITLE_FG='#FFDDDDDD' export COLOR_TITLE_BG='#FF000000' export COLOR_STATUS_FG='#FFCCCCCC' export COLOR_STATUS_BG='#FF000000' export COLOR_STATUS_READ="#859900" export COLOR_STATUS_WRITE="#990A1B" if [ $(pgrep -cx panel) -gt 1 ] ; 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 config top_padding $PANEL_HEIGHT bspc control --subscribe > "$PANEL_FIFO" & xtitle -sf 'T%s' > "$PANEL_FIFO" & clock -sf 'S%a %Y-%m-%d %H:%M' > "$PANEL_FIFO" & LC_TIME=en_DK.UTF-8 mpstat 1 | stdbuf -oL tail -n +4 | stdbuf -oL awk '$12 ~ /[0-9.]+/ { printf "L%3d\n", 100 - $12 }' > "$PANEL_FIFO" & free -m -s 1 | stdbuf -oL awk '/^Mem:.*/ { printf "M%02d%%\n", ($3 - $6 - $7) / $2 * 100 }' > "$PANEL_FIFO" & iostat -y -d 1 | stdbuf -oL awk '/Device.*/ { printf("\nI"); next } /^[0-9a-z]* / { printf " %s %04.0f↓ %04.0f↑", $1, $3, $4 } END { printf "\n" }' > "$PANEL_FIFO" & # Battery while :; do acpi -b | sed 's/.*, /B/' > "$PANEL_FIFO" sleep 5 done & # Temperature while :; do cat /sys/devices/virtual/thermal/thermal_zone0/temp | sed 's/[0-9][0-9][0-9]$//' | sed 's/^/C/' > "$PANEL_FIFO" sleep 2 done & # Network throughput while :; do net_info=$( ip -4 -o addr show | grep -v ' lo ' | while read line; do iface=$(echo $line | cut -d ' ' -f 2); # addr=$(echo $line | cut -d ' ' -f 4 | sed 's/\/.*//'); if [ ! -d /sys/class/net/$iface ]; then sleep 1; continue; fi rf=/sys/class/net/$iface/statistics/rx_bytes; tf=/sys/class/net/$iface/statistics/tx_bytes; # Get RX and TX bytes then sleep for ~1 second r1=`cat $rf`; t1=`cat $tf`; sleep 1 # Get RX and TX bytes and print rates in KBPS r2=`cat $rf`; t2=`cat $tf`; rr="$(((r2-r1)/1024))"; tr="$(((t2-t1)/1024))"; # printf "$iface $addr %04.0f↓ %04.0f↑ " $rr $tr printf "$iface %04.0f↓ %04.0f↑ " $rr $tr done) if [ -z "$net_info" ]; then sleep 5; else echo "N$net_info" > "$PANEL_FIFO" fi done & #. ./panel_colors cat "$PANEL_FIFO" | ~/.config/bspwm/panel_bar | lemonbar -g x$PANEL_HEIGHT -f "$PANEL_FONT" -F "$COLOR_FOREGROUND" -B "$COLOR_BACKGROUND" & wait