From fd84eee156baafb1b3d394cc784582f8e1fecbe2 Mon Sep 17 00:00:00 2001 From: Joe Date: Wed, 24 Aug 2022 10:15:04 +0200 Subject: update --- .local/bin/status/sb-cpu | 38 ++++++++++++++++++-------------------- .local/bin/status/sb-volume | 20 ++++++++++++++------ 2 files changed, 32 insertions(+), 26 deletions(-) (limited to '.local/bin/status') diff --git a/.local/bin/status/sb-cpu b/.local/bin/status/sb-cpu index 8ad6dfb..58abb72 100755 --- a/.local/bin/status/sb-cpu +++ b/.local/bin/status/sb-cpu @@ -1,24 +1,22 @@ #!/bin/sh -ncpu_file="/tmp/ncpu" -if [ -f $ncpu_file ]; then - ncpu=$(cat $ncpu_file) -else - ncpu=$(sysctl -n hw.ncpu | tee $ncpu_file) -fi +# ncpu_file="/tmp/ncpu" +# if [ -f $ncpu_file ]; then +# ncpu=$(cat $ncpu_file) +# else +# ncpu=$(sysctl -n hw.ncpu | tee $ncpu_file) +# fi printf " " -# for i in $(top -P -d 1 | sed -n 3,${topline}p | rev | cut -d' ' -f2 | rev | cut -d'.' -f1 | awk '{print (100 - $1)}'); do -for i in $(top -P -d 2 -s 0.2 | grep '^CPU' | tail -n$ncpu | sed '{s/% idle$//;s/.*[[:blank:]]//;s/\..*//;s/^/100 - /;}' | bc); do - case $(echo $i / 12.5 | bc) in - "0") printf "▁";; - "1") printf "▂";; - "2") printf "▃";; - "3") printf "▄";; - "4") printf "▅";; - "5") printf "▆";; - "6") printf "▇";; - "7") printf "█";; - "8") printf "█";; - esac; -done +# for i in $(top -P -d 2 -s 0.2 | grep '^CPU' | tail -n$ncpu | sed '{s/% idle$//;s/.*[[:blank:]]//;s/\..*//;s/^/100 - /;}' | bc); do +case $(top -d 2 -s 0.2 | grep '^CPU' | sed '{1d;s/% idle$//;s/.*[[:blank:]]//;s/\..*//;s/^/(100 - /;s/$/) \/ 12\.5/;}' | bc) in + "0") printf "[ ]";; + "1") printf "[= ]";; + "2") printf "[== ]";; + "3") printf "[=== ]";; + "4") printf "[==== ]";; + "5") printf "[===== ]";; + "6") printf "[====== ]";; + "7") printf "[======= ]";; + "8") printf "[========]";; +esac diff --git a/.local/bin/status/sb-volume b/.local/bin/status/sb-volume index aefad80..402431d 100755 --- a/.local/bin/status/sb-volume +++ b/.local/bin/status/sb-volume @@ -2,12 +2,8 @@ vol="$(mixer vol | awk '{print $7}' | cut -d ':' -f1)" -if [ "$vol" -gt "70" ]; then +if [ "$vol" -gt "0" ]; then icon="" -elif [ "$vol" -gt "30" ]; then - icon="" -elif [ "$vol" -gt "0" ]; then - icon="" else icon="婢" fi @@ -20,4 +16,16 @@ else micon="" fi -echo "$micon $icon " +echo -n "$micon $icon " + +case $(echo $vol / 12.5 | bc) in + "0") printf "[ ]";; + "1") printf "[= ]";; + "2") printf "[== ]";; + "3") printf "[=== ]";; + "4") printf "[==== ]";; + "5") printf "[===== ]";; + "6") printf "[====== ]";; + "7") printf "[======= ]";; + "8") printf "[========]";; +esac -- cgit v1.2.3