feat(session): restore the last session from a keybinding

Besides the --session=last startup option, the saved state can now be brought
back in a running kitty with restore_last_session, mapped to kitty_mod+alt+r.
The option types are regenerated so the shortcut is actually part of the
default configuration.
This commit is contained in:
BlackAngelTV committed 2026-11-11 21:39:45 +01:00
1 parent ea4faeb5ac
commit 38ec8c86d7
7 files changed
+62 -1

No files matched your search

+17
View File
@@ -4649,6 +4649,23 @@ shortcuts. For a full description see :doc:`hints kitten </kittens/hints>`.
""") # }}}
# shortcuts.session {{{
agr('shortcuts.session', 'Sessions')
map(
'Restore the last session',
'restore_last_session --allow-fallback=shifted,ascii kitty_mod+alt+r restore_last_session',
long_text="""
Restores the tabs, windows, layouts and working directories of the session that
was saved when kitty last quit, without restarting kitty. The state is written
by :code:`quit`; see :ref:`sessions`. If there is nothing to restore, a bell is
rung instead.
""",
)
egr() # }}}
# shortcuts.misc {{{
agr('shortcuts.misc', 'Miscellaneous')
+1
View File
@@ -4,6 +4,7 @@
#include "to-c.h"
static void
convert_from_python_font_size(PyObject *val, Options *opts) {
opts->font_size = PyFloat_AsDouble(val);
+3 -1
View File
@@ -1024,12 +1024,14 @@ defaults.map = [
KeyDefinition(is_sequence=True, trigger=SingleKey(mods=256, key=112), rest=(SingleKey(key=110),), options=KeyMapOptions(when_focus_on='', new_mode='', mode='', on_unknown='beep', on_action='keep', timeout=None, allow_fallback=(KeyFallbackType.shifted, KeyFallbackType.alternate)), definition='kitten hints --type linenum'),
# open_selected_hyperlink
KeyDefinition(is_sequence=True, trigger=SingleKey(mods=256, key=112), rest=(SingleKey(key=121),), options=KeyMapOptions(when_focus_on='', new_mode='', mode='', on_unknown='beep', on_action='keep', timeout=None, allow_fallback=(KeyFallbackType.shifted, KeyFallbackType.alternate)), definition='kitten hints --type hyperlink'),
# restore_last_session
KeyDefinition(trigger=SingleKey(mods=258, key=114), options=KeyMapOptions(when_focus_on='', new_mode='', mode='', on_unknown='beep', on_action='keep', timeout=None, allow_fallback=(KeyFallbackType.shifted, KeyFallbackType.alternate)), definition='restore_last_session'),
# show_kitty_doc
KeyDefinition(trigger=SingleKey(mods=256, key=57364), definition='show_kitty_doc overview'),
# command_palette
KeyDefinition(trigger=SingleKey(mods=256, key=57366), definition='command_palette'),
# file_manager
KeyDefinition(trigger=SingleKey(mods=5, key=101), definition='launch --type=window-dock --dock-edge=right --dock-size=60 kitten file-manager'),
KeyDefinition(trigger=SingleKey(mods=5, key=101), definition='launch --type=window-dock --dock-edge=left --dock-size=60 kitten file-manager'),
# toggle_fullscreen
KeyDefinition(trigger=SingleKey(mods=256, key=57374), definition='toggle_fullscreen'),
# toggle_maximized