2 ms·
I have GNOME do the auto dark theme thing automatically, so all Emacs has to do is listen to dbus signals and act accordingly: (defun theme-switcher (value)
by sph 4y ago
I have GNOME do the auto dark theme thing automatically, so all Emacs has to do is listen to dbus signals and act accordingly:
(defun theme-switcher (value)
(pcase value
;; No Preference. Used by GNOME to indicate light theme.
(0 (sph/load-light-theme))
;; Prefers dark
(1 (sph/load-dark-theme))
;; Prefers light
(2 (sph/load-light-theme))
(_ (message "Invalid key value"))))
(defun handler (value)
(theme-switcher (car (car value))))
(defun signal-handler (namespace key value)
(if (and
(string-equal namespace "org.freedesktop.appearance")
(string-equal key "color-scheme"))
(theme-switcher (car value))))
(dbus-call-method-asynchronously
:session
"org.freedesktop.portal.Desktop"
"/org/freedesktop/portal/desktop"
"org.freedesktop.portal.Settings"
"Read"
#'handler
"org.freedesktop.appearance"
"color-scheme")
(dbus-register-signal
:session
"org.freedesktop.portal.Desktop"
"/org/freedesktop/portal/desktop"
"org.freedesktop.portal.Settings"
"SettingChanged"
#'signal-handler)
- hprotagonist 4y agooh, very good. i3 lacks such chrome, i think, but that’s ok