Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A way to save/dump sessions from a running instance #3328

Closed
dflock opened this issue Feb 17, 2021 · 2 comments
Closed

A way to save/dump sessions from a running instance #3328

dflock opened this issue Feb 17, 2021 · 2 comments

Comments

@dflock
Copy link

dflock commented Feb 17, 2021

Is your feature request related to a problem? Please describe.
You can start kitty with a session file, but as far as I know, you have to write the session file by hand. It would seem that most/all the information that you'd want in a session dump are in kitty @ ls.

Describe the solution you'd like
It would be nice if there were a way to ask kitty to dump out the current session to a file. This would create a valid kitty session file that could be loaded using the --session parameter. This would close the loop on the session feature and would allow you to have your kitty session survive restarting the machine, by saving & restoring it to a file.

Describe alternatives you've considered
I guess I could write en external script that could parse the output from kitty @ ls and turn it into a session file - although I'm not sure if you can get the output from kitty @ ls in an external script?

Note that I use --single-instance for all my kitty windows, which simplifies this, I think, as it's just one instance that contains everything in the session.

@kovidgoyal
Copy link
Owner

dup of #1197

@dflock
Copy link
Author

dflock commented Feb 24, 2021

If anyone is interested, or comes here via google, I wrote a script which converts the output of kitty @ ls into a kitty session file, so that you can do:

# Dump the current kitty session:
$ kitty @ ls > kitty-dump.json
# Convert this JSON file into a kitty session file:
$ cat kitty-dump.json | python3 ./kitty-convert-dump.py > kitty-session.kitty
# Start kitty from that session file:
$ kitty --session kitty-session.kitty

It's here if anyone wants to use it: https://github.com/dflock/kitty-save-session

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants