summaryrefslogtreecommitdiff
path: root/.local/bin/statusbar/cpuinfo
diff options
context:
space:
mode:
author0scar <qgt268@alumni.ku.dk>2021-06-03 21:33:31 +0000
committer0scar <qgt268@alumni.ku.dk>2021-06-03 21:33:31 +0000
commit6e4a15d79352ca2707a3b0d81d158228a7d14704 (patch)
treea526da4169c76175f1e528534d67772bc13dfabb /.local/bin/statusbar/cpuinfo
parenta38dc1a774d012b2da71716365d1d254b650dd48 (diff)
Add/move statusbar scripts
Diffstat (limited to '.local/bin/statusbar/cpuinfo')
-rwxr-xr-x.local/bin/statusbar/cpuinfo30
1 files changed, 30 insertions, 0 deletions
diff --git a/.local/bin/statusbar/cpuinfo b/.local/bin/statusbar/cpuinfo
new file mode 100755
index 0000000..f46121b
--- /dev/null
+++ b/.local/bin/statusbar/cpuinfo
@@ -0,0 +1,30 @@
+#!/usr/bin/env sh
+set -e
+
+case $BLOCK_BUTTON in
+ 1) notify-send --urgency=low \
+ "Process status" \
+ "$(ps -eo pid,pcpu,size,comm \
+ | sort -rnk 3 \
+ | awk '{printf "% 8s% 8s% 8s ", $1, $2, $3;
+ $1="";$2="";$3="";
+ print $0; c++}
+ c>10 {exit}')"
+ ;;
+ 3) notify-send --urgency=low \
+ "Process status" \
+ "$(ps -eo pid,pcpu,size,cmd \
+ | sort -rnk 3 \
+ | cut -b -45 \
+ | awk '{printf "% 8s% 8s% 8s ", $1, $2, $3;
+ $1="";$2="";$3="";
+ print $0; c++}
+ c>10 {exit}')"
+ ;;
+esac
+
+# Load
+sed -Ee 's/^([0-9]+\.[0-9]+) .*/[\1  /g' /proc/loadavg | tr -d '\n'
+
+# Thermals
+awk '{s+=$1}END{printf "%.1f°]", s / (1000*NR)}' /sys/class/thermal/thermal_zone*/temp