08-03-2021, 09:18 AM
Hello all. I've made some modest progress.
The script can be made to programmatically turn off the screen to save battery by the addition of this gdbus call to Mutter DisplayConfig:
gdbus call --session --dest org.gnome.Mutter.DisplayConfig --object-path /org/gnome/Mutter/DisplayConfig --method org.freedesktop.DBus.Properties.Set "org.gnome.Mutter.DisplayConfig" "PowerSaveMode" "<int32 3>"
Then it can be made to programmatically suspend again by calling "systemctl suspend" after some delay.
I speculate that a more complete solution:
1) Starts a timer just before suspending, using systemd's /lib/systemd/system-sleep/.
2) This timer wakes up after 30 min and immediately turns off the screen using the gdbus call above. Then it starts a timer to re-suspend after 1 minute.
3) If the user unlocks the phone during this timer, it is deactivated.
I'll post again with my progress.
The script can be made to programmatically turn off the screen to save battery by the addition of this gdbus call to Mutter DisplayConfig:
gdbus call --session --dest org.gnome.Mutter.DisplayConfig --object-path /org/gnome/Mutter/DisplayConfig --method org.freedesktop.DBus.Properties.Set "org.gnome.Mutter.DisplayConfig" "PowerSaveMode" "<int32 3>"
Then it can be made to programmatically suspend again by calling "systemctl suspend" after some delay.
I speculate that a more complete solution:
1) Starts a timer just before suspending, using systemd's /lib/systemd/system-sleep/.
2) This timer wakes up after 30 min and immediately turns off the screen using the gdbus call above. Then it starts a timer to re-suspend after 1 minute.
3) If the user unlocks the phone during this timer, it is deactivated.
I'll post again with my progress.