aboutsummaryrefslogtreecommitdiff
path: root/.emacs.d/rul-init.d/themes.el
diff options
context:
space:
mode:
authorRaúl Benencia <id@rbenencia.name>2023-07-20 07:53:35 -0700
committerRaúl Benencia <id@rbenencia.name>2023-07-22 10:45:18 -0700
commit5860445da55ac3abc3935c6ffd5e9bb4539225c9 (patch)
tree2de3124b4c0577245a0b7e1dec30732af7fcc191 /.emacs.d/rul-init.d/themes.el
parentfd0754be08f4b2f9ef58625c17544a238afefade (diff)
emacs: move everything to ~/.emacs.d
Diffstat (limited to '.emacs.d/rul-init.d/themes.el')
-rw-r--r--.emacs.d/rul-init.d/themes.el47
1 files changed, 47 insertions, 0 deletions
diff --git a/.emacs.d/rul-init.d/themes.el b/.emacs.d/rul-init.d/themes.el
new file mode 100644
index 0000000..c94d4a1
--- /dev/null
+++ b/.emacs.d/rul-init.d/themes.el
@@ -0,0 +1,47 @@
+(use-package ef-themes :ensure t)
+
+(setq
+ modus-themes-mode-line '(accented borderless padded)
+ modus-themes-region '(bg-only)
+ modus-themes-bold-constructs t
+ modus-themes-italic-constructs t
+ modus-themes-paren-match '(bold intense)
+ modus-themes-headings (quote ((1 . (rainbow variable-pitch 1.3))
+ (2 . (rainbow 1.1))
+ (t . (rainbow))))
+ modus-themes-org-blocks 'tinted
+ )
+
+(use-package dbus)
+(defun mf/set-theme-from-dbus-value (value)
+ "Set the appropiate theme according to the color-scheme setting value."
+ (message "value is %s" value)
+ (if (equal value '1)
+ (progn (message "Switch to dark theme")
+ (modus-themes-select 'modus-vivendi-tinted))
+ (progn (message "Switch to light theme")
+ (modus-themes-select 'modus-operandi-tinted))))
+
+(defun mf/color-scheme-changed (path var value)
+ "DBus handler to detect when the color-scheme has changed."
+ (when (and (string-equal path "org.freedesktop.appearance")
+ (string-equal var "color-scheme"))
+ (mf/set-theme-from-dbus-value (car value))
+ ))
+
+;; Register for future changes
+(dbus-register-signal
+ :session "org.freedesktop.portal.Desktop"
+ "/org/freedesktop/portal/desktop" "org.freedesktop.portal.Settings"
+ "SettingChanged"
+ #'mf/color-scheme-changed)
+
+;; Request the current color-scheme
+(dbus-call-method-asynchronously
+ :session "org.freedesktop.portal.Desktop"
+ "/org/freedesktop/portal/desktop" "org.freedesktop.portal.Settings"
+ "Read"
+ (lambda (value) (mf/set-theme-from-dbus-value (caar value)))
+ "org.freedesktop.appearance"
+ "color-scheme"
+ )
nihil fit ex nihilo