Created
December 19, 2018 22:42
-
-
Save itoshkov/850c46746705e32e2039fb0112a75ec7 to your computer and use it in GitHub Desktop.
Change the emacs theme to light or dark variant (GTK+-3)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun set-emacs-frames (variant) | |
(dolist (frame (frame-list)) | |
(let* ((window-id (frame-parameter frame 'outer-window-id)) | |
(id (string-to-number window-id)) | |
(cmd (format "xprop -id 0x%x -f _GTK_THEME_VARIANT 8u -set _GTK_THEME_VARIANT \"%s\"" | |
id variant))) | |
(call-process-shell-command cmd)))) | |
(defun set-emacs-theme-light () | |
(interactive) | |
(load-theme 'solarized-light t) | |
(set-emacs-frames "light")) | |
(defun set-emacs-theme-dark () | |
(interactive) | |
(load-theme 'solarized-dark t) | |
(set-emacs-frames "dark")) | |
(if (window-system) | |
(set-emacs-theme-light)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In its current version, unlikely. It uses
xprop
, which is X11 tool. Also thewindow-id
part might not work either. But perhaps it won't be too hard to fix.I'm still not running Wayland so I haven't tried it.