Mac OS offers the option to resume all your open apps after a shutdown, Apple's version of hibernate, I guess. Terminal.app actually restores the ouput/history in the windows that were open when you shut the system down.
While that's nice, just restoring windows to the positions and sizes they had when shutting down would be plenty for me. Previous versions of kitty restored the positions, not the size. The current version (0.12.3) doesn't for me.
Note that I don't like the remember_window_size setting, I want new terminals to open at 80x24, it's just some long running terminals I'd like to restore to whatever size I made them.
On a similar note, I've been unable to change kitty windows's sizes using applescript, this was a nice QoL improvement with Terminal.app because the Mac OS window manager is so impotent.
kitty has no code to restore window positions, so I am surprised it would ever have happened. As I recall, cocoa has some special APIs for saving/restoring application state. These are not wrapped by glfw (the toolkit kitty uses) so they would need to be implement in kitty/cocoa_window.m instead. This is too much effort for me personally, but patches are welcome.
I assume this holds for applescript control as well?
How about simply opening at startup if it was open at shutdown? Does that also require implementation?
How hard/easy would it be to build kitty? Maybe I can git bisect to find where the behavior was lost?
No idea about aplescript control. Isn't applescript going to be retired by apple? opening at startup is the same thing as far as i know. see https://sw.kovidgoyal.net/kitty/build.html for how to build from source
It would be very nice to have this feature. :)
After looking into this a little, I think this is the necessary related documentation.
setFrameAutosaveName might also work to solve it too, apparently.
Here is the related StackOverflow where I found them. It took a while to figure out the right thing to search for.
This is the only missing feature blocked me using kitty in Mac, after reboot the workspace will be gone.
@kovidgoyal my preferred way for you to implement something like this, if you ever did, would be to have the opposite of ls so that the output of kitty @ ls can be re-used. I'd be pretty happy with something like:
kitty @ ls > savestate
kitty @ fromjson < savestate
In an ideal world, kitty ls would support --match and so it would also be trivial to save a subset of the window state.
A less good implementation could be some sort of kitty @ save-session feature that would dump a session file that approximated the current setup. I think that'll be worse by definition as session files don't have all the information that is already in ls and it's surely less work to add the right info into the ls JSON structure and rehydrate from there.
While I'm not usually intentionally restoring, the restore feature comes in very handy when the OS crashes (which does happen...). Even if the windows aren't resized/placed correctly, at least having them all pop up again with the previous scrollback content is really, really useful.
I also wish there were a CMD+SHIFT+T "restore closed tab" feature for when I fat finger CMD+W.
Restoring working directories probably requires something like #3091.
To be clear, my original issue report is just about restoring window size and location.
You should probably open a new issue to talk about restoring terminal state like Terminal.app does.
Most helpful comment
This is the only missing feature blocked me using kitty in Mac, after reboot the workspace will be gone.