Commit graph

29 commits

Author SHA1 Message Date
Zhizhen He
1e273aa289 Docs: Correct protocol references, examples and generated help 2026-10-28 13:24:43 +08:00
Kovid Goyal
24201d3080
Implement session saving on Logout for Linux as well 2026-10-19 10:49:22 +05:30
Kovid Goyal
dad7089d10
make a note that saved session data can be read by any process that runs as the user 2026-10-16 17:21:40 +05:30
Kovid Goyal
8f0b7eff31
Encrypt sessions saved at logout with a key in the macOS Keychain
Every snapshot is encrypted with AES-256-GCM using a random key, stored
in the login keychain under a random id. The name of every file is
authenticated, so files cannot be swapped. The key is deleted before the
snapshot whenever it is removed, so copies of the snapshot left on disk
or in backups cannot be read.

The keychain is never allowed to show any UI. If storing the key fails
nothing is saved, if reading it fails the snapshot is deleted, with the
error logged in both cases.

The key is generated, stored and read only in C, in mlocked memory that
is cleared when freed, via a new random_secret() and the Keychain
functions in cocoa_window.m.
2026-10-16 11:57:31 +05:30
Kovid Goyal
76a00e5142
macOS: Optionally restore kitty, including scrollback, after logging out
A new option restore_session_after_logout. When macOS asks kitty to quit
because the user is logging out, restarting or shutting down, every kitty
instance saves a snapshot: its session, including OS Window geometry, the
scrollback of every window and the command line, working directory and
environment of the instance.

The next kitty started without a session or command to run claims all
snapshots, restores the one saved by an instance with the same command
line itself and starts a separate kitty instance for each of the others,
so every instance keeps its own command line arguments and environment.
Snapshots are deleted only after their windows have been created. A
snapshot that fails to restore twice, for example because kitty crashed,
is deleted. Snapshots from an earlier logout that were never restored are
deleted when saving, using the wall clock start time of the process.

Restored scrollback is parsed before the child is allowed to run, after
the window has its final size. Only the scrollback and screen are saved,
not the scrollback pager history. Before parsing, everything except SGR,
OSC 8 and OSC 66 is removed, so a modified snapshot cannot run escape
codes such as OSC 52, and the restored output has no shell integration
marks. Programs other than the shell are not started again.

A quit is treated as being for a logout only if it is confirmed within
LOGOUT_CONFIRMATION_TIMEOUT of the logout request, and not if the quit
was cancelled in between.

Fixes #1197
2026-10-16 11:41:27 +05:30
Kovid Goyal
d4eb2b34e6
Sessions: Add os_window_position and save_as_session --os-window-geometry
The geometry of fullscreen OS Windows is the one from before they were made
fullscreen. On macOS this is now also recorded when using native fullscreen
via the window buttons/menu.
2026-10-16 11:29:28 +05:30
Kovid Goyal
c53ef1048a
Fix #10627 2026-10-10 10:05:17 +05:30
LazyStability
4504b5febe
feat(sessions): add active-only to goto_session
Allows to specify whether or not to switch only to an active session
2026-02-14 16:23:27 +01:00
shfc
51a08d23cd
fix: typos in documentation 2025-12-14 22:42:24 +10:30
Arsenii Kvachan
8a1f4bda3b Allow browsing a directory with sessions
- interpret a directory argument by listing only *.kitty-session and similar files
  - reuse the existing sorting logic for the directory chooser and document the workflow
2025-11-12 17:37:13 +01:00
Kovid Goyal
fde16d16e9
... 2025-10-27 22:17:42 +05:30
Jackie Li
2a129f2b3b
remove --focus-tab and add docs 2025-10-26 17:32:23 +00:00
Jackie Li
75537187a8
support search_syntax in focus_tab 2025-10-26 09:44:29 +00:00
Jackie Li
e0bea0cac4
add doc + changelog 2025-10-26 09:44:29 +00:00
Kovid Goyal
2ceddba923
goto_session: Add --sort-by=alphabetical
Have the interactive session picker list the sessions in a fixed order
rather than by most recent.
2025-09-29 13:03:23 +05:30
Kovid Goyal
e1d8565fb6
Add os_window_title to sessions 2025-09-01 19:30:50 +05:30
Kovid Goyal
cbca4d6593
Implement tab_bar_filter
Useful to manage multiple sessions in a single kitty OS Window.
Add some docs to sessions.rst describing this use case.
2025-08-24 12:25:15 +05:30
Kovid Goyal
21579e6fcb
... 2025-08-23 13:30:36 +05:30
Kovid Goyal
e176b723f5
When creating a new window/tab with the same cwd as the current window automatically put the newwindow into the same session as the current window 2025-08-23 13:24:48 +05:30
Kovid Goyal
d3c46a829d
Add action to close a session 2025-08-23 09:17:27 +05:30
Kovid Goyal
dcf4fc72f6
Add an example of saving remote sessions to the docs 2025-08-22 21:31:55 +05:30
Kovid Goyal
5e6c397356
Document using negative numbers with goto_session 2025-08-22 07:24:58 +05:30
Kovid Goyal
746a80487a
... 2025-08-19 22:12:27 +05:30
Kovid Goyal
d7070d3b97
Document how to update the currently active session 2025-08-19 22:08:19 +05:30
Kovid Goyal
6d21ebd383
... 2025-08-19 16:21:57 +05:30
Kovid Goyal
03792a1717
A new --add-to-session flag for launch
useful to optionally have new windows/tab join the active session when launched.
2025-08-19 16:06:49 +05:30
Kovid Goyal
41488fe8ba
Allow showing the currently active session name in the tab bar 2025-08-19 06:49:14 +05:30
Kovid Goyal
a2d76a6c34
Document the save_as_session action 2025-08-17 14:44:26 +05:30
Kovid Goyal
c982978e82
Add some docs for the new session features 2025-08-17 14:27:19 +05:30