diff options
-rwxr-xr-x | .local/bin/status/sb-battery | 5 | ||||
-rwxr-xr-x | .local/bin/status/sb-clock | 1 | ||||
-rwxr-xr-x | .local/bin/status/sb-cpu | 6 | ||||
-rwxr-xr-x | .local/bin/status/sb-disk | 4 | ||||
-rwxr-xr-x | .local/bin/status/sb-forecast | 2 | ||||
-rwxr-xr-x | .local/bin/status/sb-memory | 5 | ||||
-rwxr-xr-x | .local/bin/status/sb-net | 3 | ||||
-rwxr-xr-x | .local/bin/status/sb-os | 6 | ||||
-rwxr-xr-x | .local/bin/status/sb-temp | 2 |
9 files changed, 20 insertions, 14 deletions
diff --git a/.local/bin/status/sb-battery b/.local/bin/status/sb-battery index d366da9..e239aea 100755 --- a/.local/bin/status/sb-battery +++ b/.local/bin/status/sb-battery @@ -1,5 +1,6 @@ #!/bin/sh +echo -n "^c#fabd2f^" case $(hostname -s) in mother) return ;; po-rbo) @@ -24,8 +25,8 @@ case $(echo "$charge" / 20 | bc) in [ "$charge" -gt 94 ] && return printf " " ;; - "5") + "5") [ "$(cat /sys/class/power_supply/BAT0/status)" = "Charging" ] && return - printf " " + printf "" ;; esac diff --git a/.local/bin/status/sb-clock b/.local/bin/status/sb-clock index faecfc0..cf315f0 100755 --- a/.local/bin/status/sb-clock +++ b/.local/bin/status/sb-clock @@ -1,5 +1,6 @@ #!/bin/sh +echo -n "^d^" clock=$(date '+%I') case "$clock" in diff --git a/.local/bin/status/sb-cpu b/.local/bin/status/sb-cpu index e85f422..f6eaa92 100755 --- a/.local/bin/status/sb-cpu +++ b/.local/bin/status/sb-cpu @@ -7,12 +7,14 @@ # ncpu=$(sysctl -n hw.ncpu | tee $ncpu_file) # fi -printf " " +printf "^c#8ec07c^ " # 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 $(hostname -s) in mother|po-rbo) stats=$(uptime | head -n1) - printf "%s" "$(echo "$stats" | sed 's/.*average: *//;s/,.*//')" + top -b -d 0.1 -n 1 | grep "Cpu(s)" | \ + sed "s/.*, *\([0-9.]*\)%* id.*/\1/" | \ + awk '{print int(100 - $1)"%"}' return ;; mars) diff --git a/.local/bin/status/sb-disk b/.local/bin/status/sb-disk index 7cea853..0c0f2cf 100755 --- a/.local/bin/status/sb-disk +++ b/.local/bin/status/sb-disk @@ -1,9 +1,9 @@ #!/bin/sh -echo -n " " +echo -n "^c#d3869b^ " df=$(df -h -T | grep '/$') if echo "$df" | grep zfs >/dev/null 2>&1; then zpool list $(echo $df | sed 's/\/.*//') | tail -n1 | awk '{print $3"/"$2}' else - echo "$df" | awk '{print $4"/"$3}' + echo "$df" | awk '{print $6}' fi diff --git a/.local/bin/status/sb-forecast b/.local/bin/status/sb-forecast index 2baf81d..e3c8f0d 100755 --- a/.local/bin/status/sb-forecast +++ b/.local/bin/status/sb-forecast @@ -8,7 +8,7 @@ weatherreport=$(curl -sf "wttr.in/Lyon" 2>&1 || exit 1) # >$weatherreport || (rm weatherglyph=$(curl -sf "wttr.in/Lyon?format=%c" 2>&1 || exit 1) # >$weatherglyph || exit 1 moonglyph=$(curl -sf "wttr.in/?format=%m" 2>&1 || exit 1) # >$moonglyph || exit 1 -printf "%s%s" \ +printf "^c#83a598^%s%s" \ "$(echo "$weatherglyph")" \ "$(echo "$weatherreport" | sed '16q;d' | grep -wo "[0-9]*%" | sort -rn | sed "s/^/ /g;1q" | tr -d '\n')" diff --git a/.local/bin/status/sb-memory b/.local/bin/status/sb-memory index 4901b83..a8ba56f 100755 --- a/.local/bin/status/sb-memory +++ b/.local/bin/status/sb-memory @@ -1,14 +1,15 @@ #!/bin/sh +echo -n "^c#b8bb26^ " case $(hostname -s) in mother|po-rbo) - free | sed -n '2p' | awk '{printf (" %2.2fG/%2.2fG\n", ($2 / (1000 ^ 2)) - ($7 / (1000 ^ 2)), ($2 / (1000 ^ 2)))}' + free | sed -n '2p' | awk '{print int(100 - ($7 * 100 / $2))"%"}' ;; mars) sysctl -n hw.physmem \ hw.pagesize \ vm.stats.vm.v_inactive_count \ vm.stats.vm.v_free_count \ - vm.stats.vm.v_cache_count | xargs | awk '{printf (" %2.2fG/%2.2fG\n", ($1 / (1024 ^ 3)) - (($3 + $4 + $5) * $2 / (1024 ^ 3)), ($1 / (1024 ^ 3)))}' + vm.stats.vm.v_cache_count | xargs | awk '{printf ("%2.2fG/%2.2fG\n", ($1 / (1024 ^ 3)) - (($3 + $4 + $5) * $2 / (1024 ^ 3)), ($1 / (1024 ^ 3)))}' ;; esac diff --git a/.local/bin/status/sb-net b/.local/bin/status/sb-net index e20a891..7811800 100755 --- a/.local/bin/status/sb-net +++ b/.local/bin/status/sb-net @@ -1,5 +1,6 @@ #!/bin/sh +echo -n "^c#a89984^" case $(hostname -s) in mother|po-rbo) ping="ping -c1 -w1 9.9.9.9" ;; mars) ping="ping -c1 -t1 9.9.9.9" ;; @@ -19,4 +20,4 @@ if ! $ping >/dev/null 2>&1; then return fi -echo " " +echo "" diff --git a/.local/bin/status/sb-os b/.local/bin/status/sb-os index 5f0973e..9f5b4b2 100755 --- a/.local/bin/status/sb-os +++ b/.local/bin/status/sb-os @@ -1,9 +1,9 @@ #!/bin/sh case $(hostname -s) in - mother) os="" ;; - po-rbo) os="" ;; - mars) os="" ;; + mother) os=^c#83a598^" ;; + po-rbo) os=^c#8ec07c^" ;; + mars) os=^c#fb4934^" ;; esac echo "$os " diff --git a/.local/bin/status/sb-temp b/.local/bin/status/sb-temp index dc2ad35..dfa17c7 100755 --- a/.local/bin/status/sb-temp +++ b/.local/bin/status/sb-temp @@ -2,6 +2,6 @@ case $(hostname -s) in mother) ;; - po-rbo) cat /sys/class/hwmon/hwmon5/temp1_input | awk '{printf (" %3.1f°C", ($1 / 1000))}' ;; + po-rbo) cat /sys/class/hwmon/hwmon5/temp1_input | awk '{printf ("^c#fb4934^ %3.1f°C", ($1 / 1000))}' ;; mars) echo -n "" $(sysctl -n dev.cpu.0.temperature | cut -d '.' -f1)"°C" ;; esac |