From 131eae8d53e8bf41023e11da7382294f187ea41d Mon Sep 17 00:00:00 2001 From: tslil clingman <> Date: Tue, 24 Mar 2020 10:19:15 -0700 Subject: Changes from bison --- emacs/inits/02-modeline.el | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) (limited to 'emacs/inits/02-modeline.el') 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") -- cgit v1.2.3