diff --git a/init.el b/init.el index 0b94b37..0bd411a 100644 --- a/init.el +++ b/init.el @@ -723,6 +723,11 @@ (term-exec . with-editor-export-editor) (vterm-mode . with-editor-export-editor)) +(use-package nyan-mode + :custom + (nyan-animate-nyancat t) + (nyan-wavy-trail t)) + (use-package smtpmail :ensure nil :custom @@ -920,20 +925,27 @@ (with-current-buffer "*scratch*" (cd "~/"))) -(defvar my-bat-previous-status nil - "Whether battery was in use on last check.") +(defvar my-ac-previous-status t + "Whether battery was not in use on last check.") (require 'battery) (defun my-bat-check () "Check if battery status has changed. -Used to toggle `goggles-pulse' and `pixel-scroll-precision-mode'." - (let ((bat-status (string-equal (cdr (assq ?L (funcall battery-status-function))) - "BAT"))) - (unless (eq bat-status my-bat-previous-status) - (setq my-bat-previous-status bat-status) +Used to toggle `goggles-pulse', `pixel-scroll-precision-mode', and `nyan-mode'." + (let ((ac-status (not (string= + (cdr (assq ?L (funcall battery-status-function))) + "BAT")))) + (unless (eq ac-status my-ac-previous-status) + (setq my-ac-previous-status ac-status) (when (boundp 'goggles-pulse) - (setq goggles-pulse (not bat-status))) - (pixel-scroll-precision-mode (if bat-status 0 1))))) + (setq goggles-pulse ac-status)) + (when nyan-mode + (if ac-status + (nyan-start-animation) + (nyan-stop-animation))) + (setq nyan-animate-nyancat ac-status + nyan-wavy-trail ac-status) + (pixel-scroll-precision-mode (if ac-status 1 0))))) (when battery-status-function (run-with-timer 0 30 #'my-bat-check))