Fix a regression that caused automatic color themes to not be re-applied after config file reload

The reload was only happening if the auto theme config file had its mtime
updated, since the last time it was checked.

Fixes #8530
This commit is contained in:
Kovid Goyal
2025-04-12 13:48:27 +05:30
parent 82e2fe82d6
commit 56954b2e48
3 changed files with 18 additions and 2 deletions

View File

@@ -101,6 +101,8 @@ Detailed list of changes
- diff kitten: Add half page and full page scroll vim-like bindings (:pull:`8514`)
- Fix a regression that caused automatic color themes to not be re-applied after config file reload (:iss:`8530`)
0.41.1 [2025-04-03]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@@ -2695,8 +2695,10 @@ class Boss:
for tm in self.all_tab_managers:
tm.apply_options()
# Update colors
if theme_colors.applied_theme and theme_colors.refresh():
theme_colors.apply_theme(theme_colors.applied_theme, notify_on_bg_change=False)
if theme_colors.has_applied_theme:
theme_colors.refresh()
if theme_colors.has_applied_theme: # in case the theme file was deleted
theme_colors.apply_theme(theme_colors.applied_theme, notify_on_bg_change=False)
for w in self.all_windows:
if w.screen.color_profile.default_bg != bg_colors_before.get(w.id):
self.default_bg_changed_for(w.id)

View File

@@ -83,6 +83,18 @@ class ThemeColors:
found = True
return found
@property
def has_applied_theme(self) -> bool:
match self.applied_theme:
case '':
return False
case 'dark':
return self.has_dark_theme
case 'light':
return self.has_light_theme
case 'no_preference':
return self.has_no_preference_theme
@property
def has_dark_theme(self) -> bool:
return self.dark_mtime > -1