summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmin Bandali <bandali@gnu.org>2022-12-24 16:27:43 -0500
committerAmin Bandali <bandali@gnu.org>2022-12-24 16:27:43 -0500
commit7c054dcebe12d7121f067b279a772f874b29d3da (patch)
tree0b2c9cefdfa7275520c95421d44d1b789d7649e5
parent188c64b591f6341844f4bc6906e8cc9b23ad3b14 (diff)
downloadconfigs-7c054dcebe12d7121f067b279a772f874b29d3da.tar.gz
configs-7c054dcebe12d7121f067b279a772f874b29d3da.tar.xz
configs-7c054dcebe12d7121f067b279a772f874b29d3da.zip
* .emacs.d/init.el (b/invert-default-face): Improve.
Take a prefix argument that when set, will have the function invert the faces across all frames rather than just (selected-frame). Also, if we're running EXWM refresh the system tray background colour.
-rw-r--r--.emacs.d/init.el19
1 files changed, 13 insertions, 6 deletions
diff --git a/.emacs.d/init.el b/.emacs.d/init.el
index 8d05845..b4a16cc 100644
--- a/.emacs.d/init.el
+++ b/.emacs.d/init.el
@@ -418,12 +418,19 @@ Make N (default: 1) copies of the current line or region."
(dotimes (_ (abs n1))
(insert text))))))
-(defun b/invert-default-face ()
- "Invert the `default' face (swap its background and foreground).
-Effectively a very simple light/dark theme toggle switch."
- (interactive)
- (invert-face 'default (selected-frame))
- (invert-face 'mode-line (selected-frame)))
+(defun b/invert-default-face (arg)
+ "Invert the `default' and `mode-line' faces for the current frame.
+Swap the background and foreground for the two `default' and
+`mode-line' faces, effectively acting like a simple light/dark
+theme toggle. If prefix argument ARG is given, invert the faces
+for all frames."
+ (interactive "P")
+ (let ((frame (unless arg
+ (selected-frame))))
+ (invert-face 'default frame)
+ (invert-face 'mode-line frame))
+ (when (fboundp #'exwm-systemtray--refresh-background-color)
+ (exwm-systemtray--refresh-background-color 'remap)))
(defun b/export-frame ()
(interactive)