scripts

various script and utils
git clone git://z3bra.org/scripts
Log | Files | Refs

commit 394e16a710f71ec1da4add8ac21bafe61e75f2ae
parent a874cfd7fff74d1ea76246954445839093fb0ed3
Author: z3bra <willy@mailoo.org>
Date:   Thu Apr  3 11:12:11 +0200

Made better configuration for mkbar

Diffstat:
mkbar | 31+++++++++++++++++++++----------
1 file changed, 21 insertions(+), 10 deletions(-)
diff --git a/mkbar b/mkbar @@ -3,17 +3,28 @@ # z3bra - (c) wtfpl 2014 # Fetch infos on your computer, and print them to stdout every second. +# configuration variables +refresh_rate=0.75 # how often will the bar update +datefmt="%H:%M" # date time format +maildir=~/var/mail/INBOX/new # where do new mails arrive ? +battery=1 # battery index +alsactl=Master # which alsa channel to display +no_group="░░" # Hidden groups +cur_group="██" # current group + +# no need to modify anything else here + clock() { - date '+%H:%M' + date "+${datefmt}" } mails() { - fcount ~/var/mail/INBOX/new + fcount ${maildir} } battery() { - BATC=/sys/class/power_supply/BAT1/capacity - BATS=/sys/class/power_supply/BAT1/status + BATC=/sys/class/power_supply/BAT${battery}/capacity + BATS=/sys/class/power_supply/BAT${battery}/status # prepend percentage with a '+' if charging, '-' otherwise test "`cat $BATS`" = "Charging" && echo -n '+' || echo -n '-' @@ -23,7 +34,7 @@ battery() { } volume() { - amixer get Master | sed -n 'N;s/^.*\[\([0-9]\+%\).*$/\1%/p' + amixer get $alsactl | sed -n 's/^.*\[\([0-9]\+%\).*$/\1%/p' | uniq } cpuload() { @@ -55,9 +66,9 @@ groups() { cur=`xprop -root _NET_CURRENT_DESKTOP | awk '{print $3}'` tot=`xprop -root _NET_NUMBER_OF_DESKTOPS | awk '{print $3}'` - for w in `seq 0 $((cur - 1))`; do line="${line}░░"; done - line="${line}██" - for w in `seq $((cur + 2)) $tot`; do line="${line}░░"; done + for w in `seq 0 $((cur - 1))`; do line="${line}${no_group}"; done + line="${line}${cur_group}" + for w in `seq $((cur + 2)) $tot`; do line="${line}${no_group}"; done echo $line } @@ -71,7 +82,7 @@ nowplaying() { # This loop will fill a buffer with our infos, and output it to stdout. while :; do buf="%{l} " - buf="${buf} $(groups) %{r}" + buf="${buf} $(groups)%{U-}%{B-}%{F-}%{r}" buf="${buf} %{F#4c4c4c} CLK: %{F#ffffff}$(clock) " buf="${buf} %{F#4c4c4c} NET: %{F#ffffff}$(network) " buf="${buf} %{F#4c4c4c} CPU: %{F#ffffff}$(cpuload) " @@ -79,5 +90,5 @@ while :; do buf="${buf} %{F#4c4c4c} VOL: %{F#ffffff}$(volume)  " echo $buf - sleep 1 # The HUD will be updated every second + sleep ${refresh_rate} done