statusbar-scripts

Simple shell scripts for status bars.
git clone git://efe.kim/statusbar-scripts
Log | Files | Refs | README

commit 6078827b10bd642c93b82c6d96b4bcfcee89ff41
parent 6925ab49436b4d1c7031d34139b5e7c5b60c5c40
Author: Sunur Efe Vural <efe@efe.kim>
Date:   Wed, 24 Apr 2019 17:47:55 -0400

some fixes

Diffstat:
Mcpu.sh | 15+++++++++------
Mmem.sh | 2+-
Mtorrent.sh | 11++++++-----
Mvol.sh | 2+-
4 files changed, 17 insertions(+), 13 deletions(-)

diff --git a/cpu.sh b/cpu.sh @@ -1,8 +1,11 @@ #!/bin/sh -{ grep '^cpu ' /proc/stat ; sleep 1 ; grep '^cpu ' /proc/stat -} | awk -v RS="" '{printf "%.1f%\n", ($13-$2+$15-$4)*100/($13-$2+$15-$4+$16-$5)}' - -##!/bin/bash -# -#cat <(grep 'cpu ' /proc/stat) <(sleep 1 && grep 'cpu ' /proc/stat) | awk -v RS="" '{printf "%.2f%\n", ($13-$2+$15-$4)*100/($13-$2+$15-$4+$16-$5)}' +{ + grep '^cpu ' /proc/stat + sleep 1 + grep '^cpu ' /proc/stat +} | awk -v RS="" ' + { + printf "%.1f%\n", ($13-$2+$15-$4)*100/($13-$2+$15-$4+$16-$5) + } +' diff --git a/mem.sh b/mem.sh @@ -1,3 +1,3 @@ #!/bin/sh -free -h | awk '( NR == 2 ){ print $3 }' +free -h | awk '/^Mem: /{ print $3 }' diff --git a/torrent.sh b/torrent.sh @@ -4,9 +4,10 @@ pgrep -x transmission-da >/dev/null || exit 0 transmission-remote -t active -l | [ $(wc -l) -le 2 ] && exit 0 transmission-remote -t active -l | awk ' - /^Sum:/{ - if ( $4 != "0.0" && $5 != "0.0" ) ORS=" " - if ( $4 != "0.0" ) print " " $4 - if ( $4 == "0.0" || $5 == "0.0" ) ORS="\n" - if ( $5 != "0.0" ) print " " $5 } + /^Sum:/ { + if ( $4 != "0.0" && $5 != "0.0" ) ORS=" " + if ( $4 != "0.0" ) print " " $4 + if ( $4 == "0.0" || $5 == "0.0" ) ORS="\n" + if ( $5 != "0.0" ) print " " $5 + } ' diff --git a/vol.sh b/vol.sh @@ -1,3 +1,3 @@ #!/bin/sh -command=amixer get Master | awk -F'[][]' 'END{ gsub("on","",$6); gsub("off","",$6); print $6 " " $2 }' +amixer get Master | awk -F'[][]' 'END{ gsub("on","",$6); gsub("off","",$6); print $6 " " $2 }'