diff --git a/docs/sessions.rst b/docs/sessions.rst index fa96607bf..41b7ae315 100644 --- a/docs/sessions.rst +++ b/docs/sessions.rst @@ -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 diff --git a/kitty/options/definition.py b/kitty/options/definition.py index 5537ca732..d792f81d9 100644 --- a/kitty/options/definition.py +++ b/kitty/options/definition.py @@ -1471,6 +1471,8 @@ use :code:`{sup.index}`. All data available is: The tab index usable with :ac:`goto_tab N ` 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` diff --git a/kitty/tab_bar.py b/kitty/tab_bar.py index b54270ddd..e0d07d1ca 100644 --- a/kitty/tab_bar.py +++ b/kitty/tab_bar.py @@ -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): diff --git a/kitty/tabs.py b/kitty/tabs.py index 13cbe6721..9be92fe0e 100644 --- a/kitty/tabs.py +++ b/kitty/tabs.py @@ -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