Allow showing the currently active session name in the tab bar

This commit is contained in:
Kovid Goyal 2025-08-19 06:49:14 +05:30
parent 4c0752fd07
commit 41488fe8ba
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
4 changed files with 19 additions and 0 deletions

View file

@ -60,6 +60,21 @@ In this manner you can define as many projects/sessions as you like and easily
switch between them with a keypress.
Displaying the currently active session name
----------------------------------------------
You can display the name of the currently active session file in the kitty tab
bar using :opt:`tab_title_template`. For example, using the value::
{session_name} {title}
will show you the name of the session file the current tab was loaded from, as
well as the normal tab title. Or alternatively, you can set the tab title
directly to a project name in the session file itself when creating the tab,
like this::
new_tab My Project Name
.. _complex_sessions:
More complex sessions

View file

@ -1471,6 +1471,8 @@ use :code:`{sup.index}`. All data available is:
The tab index usable with :ac:`goto_tab N <goto_tab>` shortcuts.
:code:`layout_name`
The current layout name.
:code:`session_name`
The name of the kitty session file from which this tab was created, if any.
:code:`num_windows`
The number of windows in the tab.
:code:`num_window_groups`

View file

@ -51,6 +51,7 @@ class TabBarData(NamedTuple):
num_of_windows_with_progress: int
total_progress: int
last_focused_window_with_progress_id: int
session_name: str
class DrawData(NamedTuple):

View file

@ -1374,6 +1374,7 @@ class TabManager: # {{{
has_activity_since_last_focus, t.active_fg, t.active_bg,
t.inactive_fg, t.inactive_bg, t.num_of_windows_with_progress,
t.total_progress, t.last_focused_window_with_progress_id,
t.created_in_session_name,
))
return ans