diff options
author | Miguel Ángel Moreno <mail@migalmoreno.com> | 2022-07-26 09:01:36 +0200 |
---|---|---|
committer | Miguel Ángel Moreno <mail@migalmoreno.com> | 2022-07-26 09:01:36 +0200 |
commit | b69033f2b688ce4267c16d5e3e397887f3c840ee (patch) | |
tree | 83b46a2fc7c9f220be6fe50b7220add01bb3dc0d | |
parent | b5ad5c6e46bd90e8e99eb3677d9d89971590a15f (diff) |
tailor.lisp: Re-order and add a pause for timers
-rw-r--r-- | tailor.lisp | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/tailor.lisp b/tailor.lisp index fc78816..fad4e2c 100644 --- a/tailor.lisp +++ b/tailor.lisp @@ -156,6 +156,18 @@ 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 (or (not (themes mode)) + (find (theme *browser*) (themes mode) :test #'equal) + *current-theme*) + (or (select-automatic-theme mode) + (when main + (typecase (main mode) + (string + (select-theme (find main (themes mode) :key #'name :test #'string=) mode)) + (t + (select-theme (name main) mode)))) + (select-theme (name (car (themes mode))) mode)) + (hooks:add-hook (nyxt:buffer-before-make-hook *browser*) #'theme-handler)) (unless (equal auto-p :gtk) (unless *light-theme-timer* (sb-ext:schedule-timer (setf *light-theme-timer* @@ -165,6 +177,7 @@ of `GTK_THEME', or if a matching theme name, it will always choose that theme on (local-time:timestamp-to-universal light-theme-threshold) :absolute-p t :repeat-interval (* 24 60 60))) + (sleep 0.001) (unless *dark-theme-timer* (sb-ext:schedule-timer (setf *dark-theme-timer* (sb-ext:make-timer (lambda () @@ -172,19 +185,7 @@ of `GTK_THEME', or if a matching theme name, it will always choose that theme on :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*) - (or (select-automatic-theme mode) - (when main - (typecase (main mode) - (string - (select-theme (find main (themes mode) :key #'name :test #'string=) mode)) - (t - (select-theme (name main) mode)))) - (select-theme (name (car (themes mode))) mode)) - (hooks:add-hook (nyxt:buffer-before-make-hook *browser*) #'theme-handler))))) + :repeat-interval (* 24 60 60))))))) (defmethod nyxt:disable ((mode tailor-mode) &key) (hooks:remove-hook (nyxt:buffer-before-make-hook *browser*) #'theme-handler) |