Add session restore support#800
Conversation
|
current implementation works, but I want to improve automatic launch recovery so common apps do not require as much manual session_launch configuration |
|
Updated this draft with a stronger automatic launch-command recovery path. Since the original draft, Mango now:
That reduces the need for manual |
e87731f to
3aa9a90
Compare
|
tested on multiple programs and they all restore with no issues
Give it a test and let me know what you think |
3aa9a90 to
f78d3b9
Compare
0d3ed31 to
5267649
Compare
|
Small follow-up: I have been using this for a while now with no bugs i can find, multi-monitor restore works fine. I also tightened the branch since the original draft with portable desktop-entry lookup, improved launcher recovery, and a trusted session-file check. @DreamMaoMao whenever you have time, I’d appreciate any feedback on this. |
|
I'm still not sure if I want to add this feature. |
|
Thanks for the reply. Understood. To help me judge whether this is worth pressing further, can i ask what your hesitation mainly about? I’m happy to reduce scope further if needed, but if the concern is that session restore itself is out of scope for Mango, that’s also useful for me to know. |
f78d3b9 to
f86ec68
Compare
| session_save_now(true); | ||
| session_shutdown(); |
There was a problem hiding this comment.
Maybe i'm wrong on this, but from my understanding this two function gonna be call for everyone and not only the one who have session restore on the config
There was a problem hiding this comment.
This is intentional. The session hooks are always called from the compositor lifecycle, but the feature gate is inside the session module.
| void mango_session_spawn_tracker_init(void); | ||
| void mango_session_spawn_tracker_shutdown(void); | ||
| void mango_session_track_spawned_command(pid_t pid, const char *command); | ||
| void mango_session_attach_spawn_command(Client *c); | ||
| void mango_session_remember_client_launch_command(Client *c, | ||
| const char *command); | ||
| static char *mango_session_recover_process_command(pid_t pid); | ||
| static void mango_session_attach_process_command(Client *c); | ||
| static char *mango_session_find_desktop_exec(const char *app_id); | ||
| static char *mango_session_find_flatpak_command(const char *app_id); | ||
| static char *mango_session_normalize_launch_command(Client *c, pid_t pid); |
There was a problem hiding this comment.
WHAT THE FUCK DO I WROTE ?
Sorry, idk why i'm thinking function declaration was global constant ....
| struct wl_list link; | ||
| pid_t pid; | ||
| time_t created_at; | ||
| char command[1024]; |
There was a problem hiding this comment.
Good point. I’ll replace those with named constants so the limits are defined in one place instead of repeating raw buffer sizes.
| char title[512]; | ||
| char monitor[128]; | ||
| char launch_command[1024]; | ||
| int32_t pid; |
| void mango_session_spawn_tracker_init(void); | ||
| void mango_session_spawn_tracker_shutdown(void); | ||
| void mango_session_track_spawned_command(pid_t pid, const char *command); | ||
| void mango_session_attach_spawn_command(Client *c); | ||
| void mango_session_remember_client_launch_command(Client *c, | ||
| const char *command); | ||
| static char *mango_session_recover_process_command(pid_t pid); | ||
| static void mango_session_attach_process_command(Client *c); | ||
| static char *mango_session_find_desktop_exec(const char *app_id); | ||
| static char *mango_session_find_flatpak_command(const char *app_id); | ||
| static char *mango_session_normalize_launch_command(Client *c, pid_t pid); |
There was a problem hiding this comment.
WHAT THE FUCK DO I WROTE ?
Sorry, idk why i'm thinking function declaration was global constant ....
Adds opt-in session save/restore support to Mango.
When
session_restore=1:launch_commandWhen
session_restore=0:Supported config:
'session_restore=0|1'
Optional override config:
'session_launch=app_id|command'
'session_launch=app_id|title|command'
Current launch-command priority:
session_launchsession_launchapp_idNormalization currently implemented:
Exec=commandValidated:
footwindows with title-specific mappingsexec-oncelaunches