If "suspend when inactive" is enabled, system goes to sleep despite io.elementary.files copying files.
What Happened?
While copying files from the phone over MTP, using io.elementary.files, system went to sleep due to inactivity.
Steps to Reproduce
- Set "Suspend when inactive" timer
- Connect an Android device
- Start a large copy job from the phone to a home folder
- See it go to sleep in the middle of the job
Expected Behavior
Long running tasks should count as activity.
OS Version
7.x (Horus)
Software Version
Latest release (I have run all updates)
Log Output
No response
Hardware Info
HP EliteBook 8460p
Looks like Files does try to inhibit going to sleep using Gtk.Application.inhibit during file operations so maybe the system is not properly honoring that interface?
After some searching it looks like there are a lot of reports like this on various Linux platforms and relating to different apps. No simple solution found so far but will keep investigating. Ideally it should be solved at system level if possible as it can affect other apps and activities like showing video or downloading.
I guess one solution may be to temporarily set the sleep timeout programmatically to "Never" in the power settings schema. and set it back to the original setting after the file transfer ends. This risks the setting not being reverted should Files be force closed during a transfer though.
If files is already doing the right thing here and the issue can be reproduced then I think it can be moved to Gala. I'm fairly certain that's where the inhibit interface is implemented: https://github.com/elementary/gala/blob/b5d774d4b9d7de73820ec5b2e82b8e042dca6aa5/src/Widgets/ScreenShield.vala#L224