Open fossfreedom opened 6 years ago
Hey @fossfreedom , Sorry for taking so long. I tried your suggestion, but it only applies for suspend after timeout. It doesn't work when user manually suspends or hibernates. What works is using systemd to prevent suspend & hibernate. But that requires asking user to authenticate everytime suspend/hibernate is scheduled and also to reset the above changes. I am open to suggestions so, please help if you can !
just a suggestion - calculate the absolute time to complete e.g. 23:50hrs 2018/09/18 when the shutdown applet capability is initiated - then within the timer loop look at what the current time is compared with the "estimated time to complete" - if it is - for example 10 seconds or more later then the estimated completion time & date the user must have been through a suspension process. You can quit the timing loop at that point.
If the user initiates a suspension whilst the applet is running, after coming out of suspension the timer continues to work and then will initiate a second shutdown/suspension etc.
Kind of confusing.
Suggestion - disable suspension whilst running.
i.e. if the applet is running, read & store
/org/gnome/settings-daemon/plugins/power/sleep-inactive-ac-type
, temporarily set it tonothing
EDIT: similar key for on battery of a laptop on battery, the key is (of course)
/org/gnome/settings-daemon/plugins/power/sleep-inactive-battery-type
- both should be set to nothing.Then reset to what was previously set afterwards when the applet ended its job but before initiating shutdown/suspension etc.