The Complete Computing Environment

Hydra Dipswitches

(provide 'cce/hydra-dipswitch)

I have a Hydra function called hydra-dipswitch which exposes some common important Emacs variables, allowing me to quickly toggle common systems. I would love to expand this some day to include system-level things like Wi-Fi, power management, etc…

(defhydra hydra-dipswitch ()
  ("e" toggle-debug-on-error "Debug on Error")
  ("q" toggle-debug-on-quit "Debug on Quit")
  ("r" tasshin/read-write-toggle "Read/Write")
  ("w" whitespace-mode "Whitespace")
  ("l" lsp-ui-mode "LSP UI")
  ("f" focus-mode "Focus")
  ("t" bh/set-truncate-lines "Truncate")
  ("n" cce/toggle-theme "Light/Dark")
  ("d" visible-mode "Visible Mode")
  ("v" variable-pitch-mode "Variable Pitch"))

(with-eval-after-load 'evil-leader
  (evil-leader/set-key "t" 'hydra-dipswitch/body))
(defun tasshin/read-write-toggle ()
  "Toggles read-only in any relevant mode: ag-mode, Dired, or
just any file at all."
  (if (equal major-mode 'ag-mode)
      ;; wgrep-ag can support ag-mode
    ;; dired-toggle-read-only has its own conditional:
    ;; if the mode is Dired, it will make the directory writable
    ;; if it is not, it will just toggle read only, as desired
(defun bh/set-truncate-lines ()
  "Toggle value of truncate-lines and refresh window display."
  (setq truncate-lines (not truncate-lines))
  ;; now refresh window display (an idiom from simple.el):
    (set-window-start (selected-window)
                      (window-start (selected-window)))))