about summary refs log tree commit diff
path: root/users
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2021-12-17T17·05-0500
committerwpcarro <wpcarro@gmail.com>2021-12-20T02·25+0000
commit3e501eabb5e12bc48f77bb198cade9e87d50ae5f (patch)
tree025e91e5f609986d4bfe547af3c0faef55ca82e7 /users
parent5695b24f7f094d1cc180ac1781252644a92b8012 (diff)
fix(wpcarro/emacs): Ensure laptop battery shows in modeline r/3318
TL;DR:
- support marcus and diogenes in device.el
- define and consume device-laptop? fn

Change-Id: Ia6e1c2666cbd668466ef6b64a7c274d36b79d699
Reviewed-on: https://cl.tvl.fyi/c/depot/+/4392
Tested-by: BuildkiteCI
Reviewed-by: wpcarro <wpcarro@gmail.com>
Diffstat (limited to 'users')
-rw-r--r--users/wpcarro/emacs/.emacs.d/wpc/device.el10
-rw-r--r--users/wpcarro/emacs/.emacs.d/wpc/wpc-ui.el5
2 files changed, 11 insertions, 4 deletions
diff --git a/users/wpcarro/emacs/.emacs.d/wpc/device.el b/users/wpcarro/emacs/.emacs.d/wpc/device.el
index 0e7992fd79e7..39df8e11937a 100644
--- a/users/wpcarro/emacs/.emacs.d/wpc/device.el
+++ b/users/wpcarro/emacs/.emacs.d/wpc/device.el
@@ -21,9 +21,13 @@
 ;; Library
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
+;; TODO(wpcarro): Consider integrating this with Nix and depot instead of
+;; denormalizing the state.
 (defconst device-hostname->device
   '(("zeno.lon.corp.google.com" . work-desktop)
-    ("seneca" . work-laptop))
+    ("seneca" . work-laptop)
+    ("marcus" . personal-laptop)
+    ("diogenes" . personal-vm))
   "Mapping hostname to a device symbol.")
 
 ;; TODO: Should I generate these predicates?
@@ -46,5 +50,9 @@
   "Return t if the current device is owned by my company."
   (or (device-work-laptop?) (device-work-desktop?)))
 
+(defun device-laptop? ()
+  "Return t if the current device is a laptop."
+  (-contains? '(work-laptop personal-laptop) (device-classify)))
+
 (provide 'device)
 ;;; device.el ends here
diff --git a/users/wpcarro/emacs/.emacs.d/wpc/wpc-ui.el b/users/wpcarro/emacs/.emacs.d/wpc/wpc-ui.el
index 9483e338ade1..b5f426b3dfda 100644
--- a/users/wpcarro/emacs/.emacs.d/wpc/wpc-ui.el
+++ b/users/wpcarro/emacs/.emacs.d/wpc/wpc-ui.el
@@ -158,10 +158,9 @@
   :config
   (setq alert-default-style 'notifier))
 
-;; TODO: Should `device-work-laptop?' be a function or a constant that gets set
+;; TODO: Should `device-laptop?' be a function or a constant that gets set
 ;; during initialization?
-(when (device-work-laptop?)
-  (laptop-battery-display))
+(when (device-laptop?) (laptop-battery-display))
 
 (if window-system
     (progn