From 3e501eabb5e12bc48f77bb198cade9e87d50ae5f Mon Sep 17 00:00:00 2001 From: William Carroll Date: Fri, 17 Dec 2021 12:05:18 -0500 Subject: fix(wpcarro/emacs): Ensure laptop battery shows in modeline 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 --- users/wpcarro/emacs/.emacs.d/wpc/device.el | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'users/wpcarro/emacs/.emacs.d/wpc/device.el') 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 -- cgit 1.4.1