Fix unfocused windows in which a bell occurs not changing their border color to red until a relayout

This commit is contained in:
Kovid Goyal 2020-08-29 18:12:17 +05:30
parent f01c0945da
commit c99f7c554f
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 11 additions and 0 deletions

View File

@ -30,6 +30,9 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
wheel events to scroll the scrollback buffer, instead send them to the wheel events to scroll the scrollback buffer, instead send them to the
program (:iss:`2939`) program (:iss:`2939`)
- Fix unfocused windows in which a bell occurs not changing their border color
to red until a relayout
0.18.3 [2020-08-11] 0.18.3 [2020-08-11]
------------------- -------------------

View File

@ -489,9 +489,14 @@ class Window:
return return
call_watchers(weakref.ref(self), 'on_focus_change', {'focused': focused}) call_watchers(weakref.ref(self), 'on_focus_change', {'focused': focused})
if focused: if focused:
changed = self.needs_attention
self.needs_attention = False self.needs_attention = False
if self.screen.focus_tracking_enabled: if self.screen.focus_tracking_enabled:
self.screen.send_escape_code_to_child(CSI, 'I') self.screen.send_escape_code_to_child(CSI, 'I')
if changed:
tab = self.tabref()
if tab is not None:
tab.relayout_borders()
else: else:
if self.screen.focus_tracking_enabled: if self.screen.focus_tracking_enabled:
self.screen.send_escape_code_to_child(CSI, 'O') self.screen.send_escape_code_to_child(CSI, 'O')
@ -516,9 +521,12 @@ class Window:
env['KITTY_CHILD_CMDLINE'] = ' '.join(map(shlex.quote, self.child.cmdline)) env['KITTY_CHILD_CMDLINE'] = ' '.join(map(shlex.quote, self.child.cmdline))
subprocess.Popen(self.opts.command_on_bell, env=env, cwd=self.child.foreground_cwd) subprocess.Popen(self.opts.command_on_bell, env=env, cwd=self.child.foreground_cwd)
if not self.is_active: if not self.is_active:
changed = not self.needs_attention
self.needs_attention = True self.needs_attention = True
tab = self.tabref() tab = self.tabref()
if tab is not None: if tab is not None:
if changed:
tab.relayout_borders()
tab.on_bell(self) tab.on_bell(self)
def change_titlebar_color(self) -> None: def change_titlebar_color(self) -> None: