summaryrefslogtreecommitdiff
path: root/emacs/inits/02-modeline.el
diff options
context:
space:
mode:
authortslil clingman <>2020-04-24 17:55:37 -0700
committertslil clingman <>2020-04-24 17:55:37 -0700
commitb15702ecef80740f8d2284eb5afad7e62028a1ef (patch)
tree9bcd7ae9763d7db224faa71d4d7f4aa85a1a675b /emacs/inits/02-modeline.el
parentf9bfebc7b029df463d2e03bf9af178a8bb442ca3 (diff)
Switched to battery applet when under EXWM, fixed workspaces (final?)
Diffstat (limited to 'emacs/inits/02-modeline.el')
-rw-r--r--emacs/inits/02-modeline.el34
1 files changed, 18 insertions, 16 deletions
diff --git a/emacs/inits/02-modeline.el b/emacs/inits/02-modeline.el
index aba6e9c..bae0a37 100644
--- a/emacs/inits/02-modeline.el
+++ b/emacs/inits/02-modeline.el
@@ -1,26 +1,28 @@
-;; Time-stamp: <2020-04-24 14:49:48 (tslil@bison)>
+;; Time-stamp: <2020-04-24 17:53:33 (tslil@bison)>
;; -----------------------------------------------------------------------------
;; Battery status and CPU temperature
-(defvar sys-status "")
-(defvar sys-status-cpu-temp-threshold "45")
+(unless (fboundp 'exwm-systemtray-enable)
+ (defvar sys-status "")
+ (defvar sys-status-cpu-temp-threshold "45")
-(defun linux-sys-status ()
- (let ((bat-s (string-trim (shell-command-to-string "~/.local/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")
- (let ((temp (substring-no-properties (buffer-string) 0 -4)))
- (if (string-greaterp temp sys-status-cpu-temp-threshold)
- (concat " " temp "C") ""))))))
- (if (and (string-blank-p bat-s) (string-blank-p temp-s))
- "" (format " [%s%s]" bat-s temp-s))))
+ (defun linux-sys-status ()
+ (let ((bat-s (string-trim (shell-command-to-string (expand-file-name "~/.local/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")
+ (let ((temp (substring-no-properties (buffer-string) 0 -4)))
+ (if (string-greaterp temp sys-status-cpu-temp-threshold)
+ (concat " " temp "C") ""))))))
+ (if (and (string-blank-p bat-s) (string-blank-p temp-s))
+ "" (format " [%s%s]" bat-s temp-s))))
-(defun sys-status-update ()
- (setq sys-status (linux-sys-status)))
+ (defun sys-status-update ()
+ (setq sys-status (linux-sys-status)))
+
+ (defvar sys-status-update-timer (run-at-time nil 60 'sys-status-update)))
-(defvar sys-status-update-timer (run-at-time nil 60 'sys-status-update))
;; -----------------------------------------------------------------------------
;; Remind me of my mortality