add cwd to TabBarData

this option add current working directory to the tab by using active windows child directory.
This commit is contained in:
noval
2022-07-26 09:33:55 +07:00
parent fe8892ec54
commit 237bfc9a6e
3 changed files with 17 additions and 8 deletions

View File

@@ -230,6 +230,11 @@ class Tab: # {{{
ans += 1
return ans
@property
def get_cwd(self) -> str:
w = self.active_window
return w.cwd_of_child if w and w.cwd_of_child else self.cwd
def set_title(self, title: str) -> None:
self.name = title or ''
self.mark_tab_bar_dirty()
@@ -1078,13 +1083,14 @@ class TabManager: # {{{
title = (t.name or t.title or appname).strip()
needs_attention = False
has_activity_since_last_focus = False
cwd = os.path.abspath(t.get_cwd)
for w in t:
if w.needs_attention:
needs_attention = True
if w.has_activity_since_last_focus:
has_activity_since_last_focus = True
ans.append(TabBarData(
title, t is at, needs_attention,
title, t is at, needs_attention, cwd,
len(t), t.num_window_groups, t.current_layout.name or '',
has_activity_since_last_focus, t.active_fg, t.active_bg,
t.inactive_fg, t.inactive_bg