aboutsummaryrefslogtreecommitdiff
path: root/templates/.bin/get_cpu
diff options
context:
space:
mode:
authorBen Burwell <ben@benburwell.com>2019-08-13 14:40:54 -0400
committerBen Burwell <ben@benburwell.com>2019-08-13 14:40:54 -0400
commitc09d91fe95fca4367f47c06fc808cd02a1a8e6a5 (patch)
tree6c5c8dee0c219ab701dc1ff4c39e905dbac08e70 /templates/.bin/get_cpu
add bins
Diffstat (limited to 'templates/.bin/get_cpu')
-rwxr-xr-xtemplates/.bin/get_cpu7
1 files changed, 7 insertions, 0 deletions
diff --git a/templates/.bin/get_cpu b/templates/.bin/get_cpu
new file mode 100755
index 0000000..4f66833
--- /dev/null
+++ b/templates/.bin/get_cpu
@@ -0,0 +1,7 @@
+#!/usr/bin/zsh
+
+idle=$(mpstat -o JSON 1 1 | jq '.sysstat.hosts[0].statistics[0]["cpu-load"][0].idle')
+used=$((100.0 - $idle))
+temp=$(acpi --thermal | cut -d':' -f2 | cut -d',' -f2 | sed 's/[^0-9\.]//g')
+
+printf "<span font='FontAwesome'></span> %d%% %d°C\n" $used $temp