Trigger an XSETTINGS update when -theme and -icon-theme are set

This commit is contained in:
Steven Allen 2023-12-28 07:43:54 -08:00
parent 810fc57de5
commit ef32724cd7

View file

@ -37,6 +37,13 @@
"Return t if VALUE is a valid RGBA color." "Return t if VALUE is a valid RGBA color."
(and (numberp value) (<= 0 value 1))) (and (numberp value) (<= 0 value 1)))
(defun exwm-xsettings--custom-set (symbol value)
"Setter used by `exwm-xsettings' customization options.
SYMBOL is the setting being updated and VALUE is the new value."
(set-default-toplevel-value symbol value)
(exwm-xsettings--update-settings))
(defcustom exwm-xsettings nil (defcustom exwm-xsettings nil
"Custom XSETTINGS. "Custom XSETTINGS.
These settings take precedence over `exwm-xsettings-theme' and `exwm-xsettings-icon-theme'." These settings take precedence over `exwm-xsettings-theme' and `exwm-xsettings-icon-theme'."
@ -64,23 +71,25 @@ These settings take precedence over `exwm-xsettings-theme' and `exwm-xsettings-i
:match exwm-xsettings--rgba-match :match exwm-xsettings--rgba-match
:value 1.0)))) :value 1.0))))
:initialize #'custom-initialize-default :initialize #'custom-initialize-default
:set (lambda (symbol value) :set #'exwm-xsettings--custom-set)
(set-default-toplevel-value symbol value)
(exwm-xsettings--update-settings)))
(defcustom exwm-xsettings-theme nil (defcustom exwm-xsettings-theme nil
"The system-wide theme." "The system-wide theme."
:group 'exwm :group 'exwm
:type '(choice (string :tag "Theme") :type '(choice (string :tag "Theme")
(cons (string :tag "Light Theme") (cons (string :tag "Light Theme")
(string :tag "Dark Theme")))) (string :tag "Dark Theme")))
:initialize #'custom-initialize-default
:set #'exwm-xsettings--custom-set)
(defcustom exwm-xsettings-icon-theme nil (defcustom exwm-xsettings-icon-theme nil
"The system-wide icon theme." "The system-wide icon theme."
:group 'exwm :group 'exwm
:type '(choice (string :tag "Icon Theme") :type '(choice (string :tag "Icon Theme")
(cons (string :tag "Light Icon Theme") (cons (string :tag "Light Icon Theme")
(string :tag "Dark Icon Theme")))) (string :tag "Dark Icon Theme")))
:initialize #'custom-initialize-default
:set #'exwm-xsettings--custom-set)
(defvar exwm-xsettings--serial 0) (defvar exwm-xsettings--serial 0)