simonwalz / screen-save

A tool to make screen sessions persistent = survive system reboot.
MIT License
26 stars 4 forks source link

Vision screen-save: Users do not have to worry about rebooting, saving or restoring sessions – the screen sessions are just there. #20

Open simonwalz opened 2 months ago

simonwalz commented 2 months ago

Hallo @camlafit,

With the PRs for systemd, I have realised the vision you have in mind and I really like it. I always thought of screen-save as an additional tool to be used with the screen. Only for advanced individual users who save and restore their sessions manually.

The vision I see now is that screen-save forms a fusion with screen. With systemd services enabled, all screen sessions would be restored, even for basic users. The user would not have to worry about rebooting, saving or restoring sessions. This is a new USP for end users!

I am motivated to help you - how do you do that?

What do you think?

simonwalz commented 2 months ago

A note for later discussion:

For this vision we don't need much - but some aspects still need to be investigated, for example:

camlafit commented 2 months ago

Hello

Thanks a lot :) I've only continue your logic and try to be more transparent about each manual action and integrate them wrapped in packaging logic.

I think #10 is more or less complete. Many tests must be done, but I think all logic is now here. At least it's working on my laptop. Is no so bad :)

As suggest, looks better to finish my work with #10 . To split this work looks me a bit complicate as I do it step by step and with many try/error experiment. Could be seen with these push --force on the branch.

To complete this discussion :

Thanks

simonwalz commented 2 months ago

The procedure is fine with me. I will suggest changes or perhaps make small adjustments before merging the PRs so that it corresponds to my understanding of quality (secure, easy to understand, modular).

Discussion about "manual kill session": Yes, I would suggest to save all screen sessions of a user into a separate, fixed directory (SAVE_DIR=~/.screen-save/) and wiping that directory before saving all the sessions. To make that scripts easier to understand, I would split the screen-save-all-sessions script into two scripts: One that runs as root and just call the second script for every user, that has a SAVE_DIR (just for every user, that has active sessions is not enogh, as the user could have killed all this active sessions – and thus the saved sessions would not be removed). The second script then just wipes with SAVE_DIR and saves all active sessions for that user. In that way it is modular and secure ;-) – This is just a suggestion, you can just try your ideas and I will help you with them.

camlafit commented 2 months ago

Hi

Another note :

camlafit commented 2 months ago

The procedure is fine with me. I will suggest changes or perhaps make small adjustments before merging the PRs so that it corresponds to my understanding of quality (secure, easy to understand, modular).

Of course, my approach was try , validate and secure later. It's clearly not perfect. Modular and secure part looks as a requirement to provide a stable script/package

Discussion about "manual kill session": Yes, I would suggest to save all screen sessions of a user into a separate, fixed directory (SAVE_DIR=~/.screen-save/) and wiping that directory before saving all the sessions

Looks a nice idea, and easy to implement. But we need in this case manage manual save to automatic. We could get some trouble with autostart. Maybe an option to add.

. To make that scripts easier to understand, I would split the screen-save-all-sessions script into two scripts: One that runs as root and just call the second script for every user, that has a SAVE_DIR (just for every user, that has active sessions is not enough, as the user could have killed all this active sessions – and thus the saved sessions would not be removed). The second script then just wipes with SAVE_DIR and saves all active sessions for that user. In that way it is modular and secure ;-) – This is just a suggestion, you can just try your ideas and I will help you with them.

Oh I understand better. Sorry I've needed to re*read it. (We have took my poor english limit ^^). I thinks we need to split these different element with different function. All of these is only related to saving feature, but indeed we could split logic with different function to be more readable. Then we could have at least 3 functions, save_all_session() save_current_user_session() wipe_current_user()

we can add different arguments to save all , partial or specific session