Score:1

Warn when other workspace session is open or when programs still running (20.04)

jp flag

When pressing the "Power Off" button in Ubuntu 20, is there a way to prevent the system from shutting down when any programs (especially in other workspaces) are still open? Or to at least provide a warning that let's one abort the shutdown process? I frequently experience unwanted forced program terminations and would like to prevent this in the future. I would prefer not to run a shell script when shutting down the computer. Just pressing the regular "Power Off" button should be sufficient.

The question was asked before here for Ubuntu 18. The answer does not seem to address my issues properly because I would like to have a simple solution that just works on pressing the "Power Off" button (as opposed to running any scripts). This answer on Stackoverflow proposes running a script all the time in the background that handles any shutdown. I'm also not a big fan of this one as I believe there may be a more "native" and simpler feature in Ubuntu.

Background to the use case as per @vanadium's request in the comments

The use case would be less about lost data and more about "lost setup". In the first workspace, I often have one or two development environments, a browser with certain tabs, and some other programs running; then the same thing in another workspace along with Slack; and then another workspace with mostly spreadsheets and yet more browser tabs. It takes a long time to set all of this up again and the problem lies in losing my state of work for different projects. I usually save everything immediately, so this warning is unfortunately not helpful in this case.

vanadium avatar
cn flag
The system will always warn when unsaved documents are open or processes are still running in terminals. So by default, the system should protect you from harm when you shut it down. Do you have a specific use case in mind?
Jan Spörer avatar
jp flag
The use case would be less about lost data and more about "lost setup". In the first workspace, I often have one or two development environments, a browser with certain tabs, and some other programs running; then the same thing in another workspace along with Slack; and then another workspace with mostly spreadsheets and yet more browser tabs. It takes a long time to set all of this up again and the problem lies in losing my state of work for different projects. I usually save everything immediately, so this warning is unfortunately not helpful in this case.
vanadium avatar
cn flag
Would be good to add this to your question so the "scene" is fully set. No, there used to be "saved sessions" aimed to preserve setups between boots, but in Gnome these have been removed because they never worked well. XFCE still has "sessions". The alternative is to "suspend" or, if the computer supports it, "hibernate". There will be no "native" feature, although an advanced user could setup a custom shut down procedure.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.