Disable goggles pulse and smooth scrolling when on battery
This commit is contained in:
parent
07a458df37
commit
0907c0c157
40
init.el
40
init.el
|
@ -131,10 +131,12 @@
|
|||
(aw-dispatch-always t)
|
||||
(aw-scope 'frame)
|
||||
:config
|
||||
(require 'cl-lib)
|
||||
(dolist (c aw-dispatch-alist)
|
||||
(cond ((eq (car c) ?j) (setcar c ?J))
|
||||
((eq (car c) ?v) (setcar c ?s) (setcar (nthcdr 2 c) "Split Window"))
|
||||
((eq (car c) ?b) (setcar c ?v) (setcar (nthcdr 2 c) "Vertical Split"))))
|
||||
(cl-case (car c)
|
||||
(?j (setcar c ?J))
|
||||
(?v (setcar c ?s) (setcar (nthcdr 2 c) "Split Window"))
|
||||
(?b (setcar c ?v) (setcar (nthcdr 2 c) "Vertical Split"))))
|
||||
(with-eval-after-load 'catppuccin-theme
|
||||
(face-spec-set 'aw-leading-char-face `((t (:foreground
|
||||
,(catppuccin-get-color 'crust)
|
||||
|
@ -521,25 +523,26 @@
|
|||
(add-hook 'text-mode-hook #'word-wrap-whitespace-mode)
|
||||
|
||||
(defun scroll-down-3 ()
|
||||
"Scrolls down by 3"
|
||||
"Scroll down by 3."
|
||||
(interactive)
|
||||
(scroll-down 3))
|
||||
|
||||
(defun scroll-up-3 ()
|
||||
"Scrolls up by 3"
|
||||
"Scroll up by 3."
|
||||
(interactive)
|
||||
(scroll-up 3))
|
||||
|
||||
(defun frame-make-detect-term (frame)
|
||||
(defun frame-make-detect-term (&optional frame)
|
||||
"Check when frames are made in order to make terminal-only configurations"
|
||||
(unless (display-graphic-p frame)
|
||||
(xterm-mouse-mode)
|
||||
(global-set-key (kbd "<mouse-4>") #'scroll-down-3)
|
||||
(global-set-key (kbd "<mouse-5>") #'scroll-up-3)
|
||||
(setq after-make-frame-functions
|
||||
(remove 'frame-make-detect-term after-make-frame-functions))))
|
||||
(remove-hook 'after-make-frame-functions #'frame-make-detect-term)))
|
||||
|
||||
(add-to-list 'after-make-frame-functions #'frame-make-detect-term)
|
||||
(if (daemonp)
|
||||
(add-to-list 'after-make-frame-functions #'frame-make-detect-term)
|
||||
(frame-make-detect-term))
|
||||
|
||||
(defun my-sudo-edit ()
|
||||
"Edit current file as root."
|
||||
|
@ -554,3 +557,22 @@
|
|||
(when (daemonp)
|
||||
(with-current-buffer "*scratch*"
|
||||
(cd "~/")))
|
||||
|
||||
(defvar my-bat-previous-status nil
|
||||
"Whether battery was in use on last check.")
|
||||
|
||||
(require 'battery)
|
||||
(defun my-bat-check ()
|
||||
"Check if battery status has changed in order 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)
|
||||
(when (boundp 'goggles-pulse)
|
||||
(setq goggles-pulse (not bat-status)))
|
||||
(pixel-scroll-precision-mode (if bat-status 0 1)))))
|
||||
|
||||
(when battery-status-function
|
||||
(run-with-timer 30 30 #'my-bat-check)
|
||||
(add-hook 'emacs-startup-hook #'my-bat-check))
|
||||
|
|
Loading…
Reference in a new issue