mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-06-26 02:41:54 +00:00
Report color scheme preference change on config reload even when application has overriden the background color
Fixes #9253
This commit is contained in:
parent
ccb3d666f4
commit
eb44fa1682
2 changed files with 14 additions and 2 deletions
|
|
@ -2871,7 +2871,9 @@ class Boss:
|
|||
window.refresh()
|
||||
|
||||
def apply_new_options(self, opts: Options) -> None:
|
||||
bg_before = get_options().background
|
||||
bg_colors_before = {w.id: w.screen.color_profile.default_bg for w in self.all_windows}
|
||||
configured_bg_changed = bg_before != opts.background
|
||||
# Update options storage
|
||||
set_options(opts, is_wayland(), self.args.debug_rendering, self.args.debug_font_fallback)
|
||||
apply_options_update()
|
||||
|
|
@ -2908,6 +2910,12 @@ class Boss:
|
|||
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)
|
||||
elif configured_bg_changed:
|
||||
# the application running in the window could have set the
|
||||
# background color, so it wont change because of a config
|
||||
# reload, but the application might still want to be notified
|
||||
# that the user's color scheme preference has changed.
|
||||
w.report_color_scheme_preference_if_wanted()
|
||||
w.refresh(reload_all_gpu_data=True)
|
||||
load_shader_programs.recompile_if_needed()
|
||||
|
||||
|
|
|
|||
|
|
@ -1393,12 +1393,16 @@ class Window:
|
|||
return self.screen.color_profile.default_bg.is_dark
|
||||
|
||||
def on_color_scheme_preference_change(self, via_escape_code: bool = False) -> None:
|
||||
if self.screen.color_preference_notification and not via_escape_code:
|
||||
self.report_color_scheme_preference()
|
||||
if not via_escape_code:
|
||||
self.report_color_scheme_preference_if_wanted()
|
||||
self.call_watchers(self.watchers.on_color_scheme_preference_change, {
|
||||
'is_dark': self.is_dark, 'via_escape_code': via_escape_code
|
||||
})
|
||||
|
||||
def report_color_scheme_preference_if_wanted(self) -> None:
|
||||
if self.screen.color_preference_notification:
|
||||
self.report_color_scheme_preference()
|
||||
|
||||
def report_color_scheme_preference(self) -> None:
|
||||
n = 1 if self.is_dark else 2
|
||||
self.screen.send_escape_code_to_child(ESC_CSI, f'?997;{n}n')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue