Update add_title_pane() to match set_title()

This commit is contained in:
2Shirt 2023-04-09 16:33:11 -07:00
parent b834be9f00
commit 7aafcd7c01
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C

View file

@ -65,13 +65,18 @@ class TUI():
# Add pane # Add pane
self.layout['Info']['Panes'].append(tmux.split_window(**tmux_args)) self.layout['Info']['Panes'].append(tmux.split_window(**tmux_args))
def add_title_pane(self, text) -> None: def add_title_pane(self, line1, line2=None, colors=None) -> None:
"""Add additional pane to title row.""" """Add pane to title row."""
lines = [line1, line2]
colors = colors if colors else self.title_colors.copy()
if not line2:
lines.pop()
colors.pop()
tmux_args = { tmux_args = {
'behind': True, 'behind': True,
'lines': TMUX_TITLE_HEIGHT, 'lines': TMUX_TITLE_HEIGHT,
'target_id': None, 'target_id': None,
'text': text, 'text': ansi.color_string(lines, colors, sep='\n'),
'vertical': True, 'vertical': True,
} }
if self.layout['Title']['Panes']: if self.layout['Title']['Panes']:
@ -186,6 +191,7 @@ class TUI():
), ),
) )
# Functions # Functions
def fix_layout(layout, forced=False): def fix_layout(layout, forced=False):
"""Fix pane sizes based on layout.""" """Fix pane sizes based on layout."""