summaryrefslogtreecommitdiff
path: root/src/gizmo/wasp-heartrate.el
diff options
context:
space:
mode:
authorLLLL Colonq <llll@colonq>2025-03-13 21:30:13 -0400
committerLLLL Colonq <llll@colonq>2025-03-13 21:30:13 -0400
commitb21ecce6645fc17c520b722de3d96e550c77c490 (patch)
treeea43d01bd3e36c36eb7b43945ef662088aee3cb7 /src/gizmo/wasp-heartrate.el
parenta2d075656ca6a07c6263eee588e15cf2ee802995 (diff)
Update
Diffstat (limited to 'src/gizmo/wasp-heartrate.el')
-rw-r--r--src/gizmo/wasp-heartrate.el10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/gizmo/wasp-heartrate.el b/src/gizmo/wasp-heartrate.el
index 62994680..a195e0c5 100644
--- a/src/gizmo/wasp-heartrate.el
+++ b/src/gizmo/wasp-heartrate.el
@@ -14,10 +14,19 @@
(let ((res (shell-command-to-string "uptime")))
(string-to-number (s-trim (car (s-split "," (cadr (s-split "load average:" res))))))))
+(defun w/get-disk-usage (disk)
+ "Get the current usage percent for DISK"
+ (let ((res (shell-command-to-string (format "df %s" disk))))
+ (string-to-number (s-chop-suffix "%" (nth 4 (s-split " " (cadr (s-lines res)) t))))))
+
(defun w/get-heartrate ()
"Get the streamer's heart rate."
(* 100 (w/get-load)))
+(defun w/get-blood-pressure ()
+ "Get the streamer's blood pressure."
+ (format "%s/%s" (w/get-disk-usage "/") (w/get-disk-usage "/home")))
+
(defface w/heartrate-big
'((t
:foreground "white"
@@ -57,6 +66,7 @@
(let* ((inhibit-read-only t))
(erase-buffer)
(w/write-line (format "%3d bpm" (w/get-heartrate)) 'w/heartrate-big)
+ (w/write-line (format "blood pressure: %s" (w/get-blood-pressure)) 'w/heartrate-small)
(w/write (format "arbitrary counter: %s times" w/chat-bpm-count) 'w/heartrate-small))))
(defvar w/heartrate-timer nil)