diff options
author | Miguel Ángel Moreno <mail@migalmoreno.com> | 2022-07-11 10:58:41 +0200 |
---|---|---|
committer | Miguel Ángel Moreno <mail@migalmoreno.com> | 2022-07-11 10:58:41 +0200 |
commit | e3aef46a13eb0edff749d11b83e58782e9a6e2fa (patch) | |
tree | 46891cf8ff59f6d09ae399a6df32254e2800aeed | |
parent | f2148fb54a2cbe9da98a1fec2eee3aecf8438609 (diff) |
tailor.lisp: Amends timers invocation
-rw-r--r-- | tailor.lisp | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/tailor.lisp b/tailor.lisp index 2193d15..3eef560 100644 --- a/tailor.lisp +++ b/tailor.lisp @@ -147,7 +147,7 @@ of `GTK_THEME', or if a matching theme name, it will always choose that theme on (setf main (cons (find-theme (car main)) (find-theme (cdr main)))))))) (defmethod nyxt:enable ((mode tailor-mode) &key) - (with-slots (main) mode + (with-slots (main auto-p) mode (let ((light-theme (or (when (consp main) (car main)) (find-theme-variant mode))) @@ -156,21 +156,23 @@ of `GTK_THEME', or if a matching theme name, it will always choose that theme on (find-theme-variant mode :dark t))) (light-theme-threshold (local-time:timestamp+ (today) (light-theme-threshold mode) :sec)) (dark-theme-threshold (local-time:timestamp+ (today) (dark-theme-threshold mode) :sec))) - (unless *light-theme-timer* - (sb-ext:schedule-timer (setf *light-theme-timer* - (sb-ext:make-timer (lambda () - (select-theme (name light-theme) mode)) - :thread t)) - (local-time:timestamp-to-universal light-theme-threshold) - :repeat-interval (* 24 60 60))) - (unless *dark-theme-timer* - (sb-ext:schedule-timer (setf *dark-theme-timer* - (sb-ext:make-timer (lambda () - (select-theme (name dark-theme) mode)) - :thread t)) - (local-time:timestamp-to-universal dark-theme-threshold) - :absolute-p t - :repeat-interval (* 24 60 60))) + (unless (equal auto-p :gtk) + (unless *light-theme-timer* + (sb-ext:schedule-timer (setf *light-theme-timer* + (sb-ext:make-timer (lambda () + (select-theme (name light-theme) mode)) + :thread t)) + (local-time:timestamp-to-universal light-theme-threshold) + :absolute-p t + :repeat-interval (* 24 60 60))) + (unless *dark-theme-timer* + (sb-ext:schedule-timer (setf *dark-theme-timer* + (sb-ext:make-timer (lambda () + (select-theme (name dark-theme) mode)) + :thread t)) + (local-time:timestamp-to-universal dark-theme-threshold) + :absolute-p t + :repeat-interval (* 24 60 60)))) (unless (or (not (themes mode)) (find (theme *browser*) (themes mode) :test #'equal) *current-theme*) |