diff options
| author | tslil clingman <> | 2020-03-24 10:19:15 -0700 |
|---|---|---|
| committer | tslil clingman <> | 2020-03-24 10:19:15 -0700 |
| commit | 131eae8d53e8bf41023e11da7382294f187ea41d (patch) | |
| tree | 5cf47fd38bff4c6586e6f3aef48a92bebcf155c0 /emacs/inits/02-modeline.el | |
| parent | 6e0beb56dd2fdfccba3094185ca52628091b1208 (diff) | |
Changes from bison
Diffstat (limited to 'emacs/inits/02-modeline.el')
| -rw-r--r-- | emacs/inits/02-modeline.el | 24 |
1 files changed, 2 insertions, 22 deletions
diff --git a/emacs/inits/02-modeline.el b/emacs/inits/02-modeline.el index 58b2cd1..f362af1 100644 --- a/emacs/inits/02-modeline.el +++ b/emacs/inits/02-modeline.el @@ -1,4 +1,4 @@ -;; Time-stamp: <2019-08-13 14:43:24 (tslil@basingstoke)> +;; Time-stamp: <2020-03-24 10:15:48 (tslil@bison)> ;; ----------------------------------------------------------------------------- ;; Battery status and CPU temperature @@ -7,27 +7,7 @@ (defvar sys-status-cpu-temp-threshold "45") (defun linux-sys-status () - (let ((bat-s (if (not (file-exists-p "/sys/class/power_supply/sbs-20-000b/uevent")) "" - (with-temp-buffer - (insert-file-contents "/sys/class/power_supply/sbs-20-000b/uevent") - (re-search-forward "POWER_SUPPLY_STATUS=\\(Discharging\\|Charging\\|Full\\)") - (let ((status (match-string 1))) - (if (string-equal "Full" status) "Full" - (let* ((perc (progn - (re-search-forward "POWER_SUPPLY_CAPACITY=\\([0-9]+\\)") - (match-string 1))) - (field (concat "POWER_SUPPLY_TIME_TO_" - (if (string-equal "Discharging" status) - "EMPTY" "FULL") - "_AVG=\\([0-9]+\\)")) - (seconds (progn - (re-search-forward field) - (string-to-number (match-string 1)))) - (hours (/ seconds 3600)) - (minutes (/ (- seconds (* hours 3600)) 60))) - (format "%s%s%% %dh%dm" - (substring status 0 1) - perc hours minutes))))))) + (let ((bat-s (string-trim (shell-command-to-string "~/bin/battery"))) (temp-s (if (not (file-exists-p "/sys/class/thermal/thermal_zone1/temp")) "" (with-temp-buffer (insert-file-contents "/sys/class/thermal/thermal_zone1/temp") |
