From b3eaf4d3e1e3031054fadbc47eb749f47f901e83 Mon Sep 17 00:00:00 2001 From: Kevin Chabowski Date: Sun, 1 Dec 2013 23:59:31 +0100 Subject: Initial commit --- mybar/mybar.sh | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100755 mybar/mybar.sh (limited to 'mybar/mybar.sh') diff --git a/mybar/mybar.sh b/mybar/mybar.sh new file mode 100755 index 0000000..5adc11e --- /dev/null +++ b/mybar/mybar.sh @@ -0,0 +1,63 @@ +#!/bin/sh + +update_wminfo() { + bspc control --subscribe | while read line; do + echo "bspwm $line" + done +} + +update_time() { + while true; do + date '+date %a. %Y-%b-%d %H:%M' + sleep 1 + done +} + +update_mem() { + while true; do + awk ' +$1 == "MemTotal:" { total=$2; } +$1 == "MemFree:" { free=$2; } +$1 == "Buffers:" { buf=$2; } +$1 == "Cached:" { cache=$2; } +END { print "mem " int((total - free - buf - cache) / 1024); }' < /proc/meminfo + sleep 2 + done +} + +update_cpu() { + while true; do + grep '^cpu\s' < /proc/stat + sleep 2 + done +} + +update_bat() { + while true; do + battery -f "bat %s %d" + sleep 2 + done +} + +update_wifi() { + while true; do + wicd-cli -y -d | ~/mybar/wifi.awk + sleep 2 + done +} + +trap 'trap - TERM; kill 0' INT TERM QUIT EXIT + +update_wminfo > "$BAR_FIFO" & +update_time > "$BAR_FIFO" & +update_mem > "$BAR_FIFO" & +update_cpu > "$BAR_FIFO" & + +if test $(hostname) = "kch42-notebook"; then + update_bat > "$BAR_FIFO" & + update_wifi > "$BAR_FIFO" & +fi + +xtitle -sf 'window %s' > "$BAR_FIFO" & + +cat "$BAR_FIFO" | ~/mybar/mybar.awk | bar -- cgit v1.2.3-54-g00ecf