feat(session): restore the last session with --session=last #40

Closed
BlackAngelTV wants to merge 25 commits from feat/session-restore into main
pull from: feat/session-restore
Showing only changes of commit 2b93f8c72b - Show all commits
+12
View File
@@ -2528,6 +2528,7 @@ class Boss:
if not self._call_on_quit_watchers({'confirmed': True}):
set_application_quit_request(NO_CLOSE_REQUESTED)
return
self.save_last_session()
self.save_session_if_logging_out()
set_application_quit_request(IMPERATIVE_CLOSE_REQUESTED)
return
@@ -2557,9 +2558,20 @@ class Boss:
if not self._call_on_quit_watchers({'confirmed': True}):
set_application_quit_request(NO_CLOSE_REQUESTED)
return
self.save_last_session()
self.save_session_if_logging_out()
set_application_quit_request(IMPERATIVE_CLOSE_REQUESTED if confirmed else NO_CLOSE_REQUESTED)
def save_last_session(self) -> None:
# Must run before the quit request is set: the C side then closes the windows and there is
# nothing left to serialize. Saving an empty session is a no-op, so this never clobbers a
# good state with a torn down one.
from .main import is_panel_kitten
from .session_restore import save_session_of
if not is_panel_kitten():
save_session_of(self)
def save_session_if_logging_out(self) -> None:
from .logout_session import is_logout_in_progress