From bb7a0dc58eb4e02afd943dc055a998247d8bc633 Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Wed, 25 Aug 2021 05:13:50 -0500 Subject: [PATCH] adding idk things --- scripts/cpu-plasma.2s.sh | 7 +++++++ scripts/laptopdet | 7 +++++++ scripts/mem-plasma.2s.sh | 10 ++++++++++ 3 files changed, 24 insertions(+) create mode 100755 scripts/cpu-plasma.2s.sh create mode 100755 scripts/laptopdet create mode 100755 scripts/mem-plasma.2s.sh diff --git a/scripts/cpu-plasma.2s.sh b/scripts/cpu-plasma.2s.sh new file mode 100755 index 0000000..1c695be --- /dev/null +++ b/scripts/cpu-plasma.2s.sh @@ -0,0 +1,7 @@ +#!/bin/sh +# awk '{u=$2+$4; t=$2+$4+$5; if (NR==1){u1=u; t1=t;} else print ($2+$4-u1) * 100 / (t-t1) "%"; }' \ + # <(rg 'cpu ' /proc/stat) <(sleep 1;rg 'cpu ' /proc/stat) +# echo 100 - $(mpstat | rg all | cut -d \ -f43) | bc +cpu="$(mpstat 1 1 | rg Average | awk '{print $3+$4+$5}' | sed 's/\(.*\)/\1%/g')" + +echo " $cpu | color=#5af78e font='VictorMono Nerd Font' size=11" diff --git a/scripts/laptopdet b/scripts/laptopdet new file mode 100755 index 0000000..a7237c9 --- /dev/null +++ b/scripts/laptopdet @@ -0,0 +1,7 @@ +#!/bin/fish +#detect whether running on laptop or not +if hostname = "syl" + echo true + else + echo false + diff --git a/scripts/mem-plasma.2s.sh b/scripts/mem-plasma.2s.sh new file mode 100755 index 0000000..a4f0ff9 --- /dev/null +++ b/scripts/mem-plasma.2s.sh @@ -0,0 +1,10 @@ +#!/bin/bash +# Get the percentage of used memory and print it +read used total <<< $(free -m | awk '/Mem/{printf $2" "$3}') + +percent=$(bc -l <<< "100 * $total / $used") + +mem=$(awk -v u=$used -v t=$total -v p=$percent 'BEGIN {printf "%sMi/%sMi %.1f% ", t, u, p}'| awk '{printf $2}') + + +echo " $mem | color=#ff9f43 font='VictorMono Nerd Font' size=11"