Complete Computing Environment: Laptop Mode

Table of Contents

Using CCE on a laptop formfactor

Using CCE with a screen and full sized keyboard is the primary usage scenario of CCE right now; I spend all day at work on this laptop in the environment and it needs to work damn well. That said, the support shouldn't shoe-box me in to a certain way of working, and that is why cce-laptop does little more than define cce/laptop-minor-mode and activate it if I'm indeed running on a laptop.

For now, cce-laptop-minor-mode is simply a wrapper for display-time-mode and display-battery-mode but should eventually encompass other common keybindings and such that are only applicable on a Laptop.

(provide 'cce-laptop)
(define-minor-mode cce-laptop-minor-mode
  "Affordances for using CCE on a laptop"
  :global t
  :init-value nil
  :lighter "[LAPTOP]"
  :keymap nil
  (if cce-laptop-minor-mode
      (cce/enable-laptop-mode)
    (cce/disable-laptop-mode)))

(add-to-list 'desktop-minor-mode-table '(cce-laptop-minor-mode . nil))

(defun cce/enable-laptop-mode ()
  (display-battery-mode 1)
  (display-time-mode 1)
  (setq cce-mode 'laptop))

(defun cce/disable-laptop-mode ()
  (display-battery-mode -1)
  (display-time-mode -1)
  (setq cce-mode nil))

(add-hook 'after-cce-hook
          (lambda ()
            (cce/with-any-domain '("work" "main" "pocket")
                                 (cce-laptop-minor-mode 1))))
(setq display-time-format "%Y%b%d %H:%M ")

Author: Ryan Rix

Created: 2017-10-03 Tue 10:06

Validate XHTML 1.0