gala icon indicating copy to clipboard operation
gala copied to clipboard

If "suspend when inactive" is enabled, system goes to sleep despite io.elementary.files copying files.

Open deafboy opened this issue 2 years ago • 4 comments

What Happened?

While copying files from the phone over MTP, using io.elementary.files, system went to sleep due to inactivity.

Steps to Reproduce

  1. Set "Suspend when inactive" timer
  2. Connect an Android device
  3. Start a large copy job from the phone to a home folder
  4. 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

deafboy avatar Mar 12 '24 12:03 deafboy

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?

jeremypw avatar Mar 12 '24 15:03 jeremypw

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.

jeremypw avatar Mar 04 '25 10:03 jeremypw

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.

jeremypw avatar Mar 04 '25 10:03 jeremypw

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

danirabbit avatar Mar 04 '25 16:03 danirabbit