scripts

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

commit c9f6d6dbb6da58ce56416eccfbab557f74575fd8
parent 394e16a710f71ec1da4add8ac21bafe61e75f2ae
Author: z3bra <willy@mailoo.org>
Date:   Fri Apr  4 15:57:20 +0200

Simplified the whole bar

Diffstat:
mkbar | 29++++++++++++++---------------
1 file changed, 14 insertions(+), 15 deletions(-)
diff --git a/mkbar b/mkbar @@ -9,8 +9,8 @@ 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_group="%{F#ff1d1d1d}━━%{F-}" # Hidden groups +le_group="━━" # Current group # no need to modify anything else here @@ -29,22 +29,22 @@ battery() { # prepend percentage with a '+' if charging, '-' otherwise test "`cat $BATS`" = "Charging" && echo -n '+' || echo -n '-' - # append the character '%' after the number - sed 's/$/%%/' $BATC + cat $BATC } volume() { - amixer get $alsactl | sed -n 's/^.*\[\([0-9]\+%\).*$/\1%/p' | uniq + amixer get $alsactl | sed -n 's/^.*\[\([0-9]\+\)%.*$/\1/p' | uniq } cpuload() { LINE=`ps -eo pcpu |grep -vE '^\s*(0.0|%CPU)' |sed -n '1h;$!H;$g;s/\n/ +/gp'` - echo `bc <<< $LINE`%% + echo `bc <<< $LINE` } memused() { read t f <<< `grep -E 'Mem(Total|Free)' /proc/meminfo |awk '{print $2}'` - echo `bc <<< "scale=2; 100 - $f / $t * 100" | cut -d. -f1`%% + read b c <<< `grep -E '^(Buffers|Cached)' /proc/meminfo |awk '{print $2}'` + bc <<< "100 * ($t - $f - $c - $b) / $t" } network() { @@ -67,7 +67,7 @@ groups() { tot=`xprop -root _NET_NUMBER_OF_DESKTOPS | awk '{print $3}'` for w in `seq 0 $((cur - 1))`; do line="${line}${no_group}"; done - line="${line}${cur_group}" + line="${line}${le_group}" for w in `seq $((cur + 2)) $tot`; do line="${line}${no_group}"; done echo $line } @@ -81,13 +81,12 @@ nowplaying() { # This loop will fill a buffer with our infos, and output it to stdout. while :; do - buf="%{l} " - 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) " - buf="${buf} %{F#4c4c4c} RAM: %{F#ffffff}$(memused) " - buf="${buf} %{F#4c4c4c} VOL: %{F#ffffff}$(volume)  " + buf="%{r}$(groups)   $(clock)" + #buf="${buf} %{F#4c4c4c} CLK: %{F#ffffff}$(clock) " + #buf="${buf} %{F#4c4c4c} NET: %{F#ffffff}$(network) " + #buf="${buf} %{F#4c4c4c} CPU: %{F#ffffff}$(cpuload)%% " + #buf="${buf} %{F#4c4c4c} RAM: %{F#ffffff}$(memused)%% " + #buf="${buf} %{F#4c4c4c} VOL: %{F#ffffff}$(volume)%%  " echo $buf sleep ${refresh_rate}