Show a bell on the tab if a bell occurs in one of the windows in the tab and the window is not the currently focused window. Fixes #514

This commit is contained in:
Kovid Goyal
2018-05-02 21:44:14 +05:30
parent 2a52acdef4
commit efcd3a5df7
5 changed files with 41 additions and 4 deletions

View File

@@ -90,6 +90,7 @@ class Window:
def __init__(self, tab, child, opts, args, override_title=None):
self.action_on_close = None
self.needs_attention = False
self.override_title = override_title
self.overlay_window_id = None
self.overlay_for = None
@@ -214,6 +215,7 @@ class Window:
def focus_changed(self, focused):
if focused:
self.needs_attention = False
if self.screen.focus_tracking_enabled:
self.screen.send_escape_code_to_child(CSI, 'I')
else:
@@ -228,6 +230,17 @@ class Window:
def icon_changed(self, new_icon):
pass # TODO: Implement this
@property
def is_active(self):
return get_boss().active_window is self
def on_bell(self):
if not self.is_active:
self.needs_attention = True
tab = self.tabref()
if tab is not None:
tab.on_bell(self)
def change_titlebar_color(self):
val = self.opts.macos_titlebar_color
if val: