Skip to content

profiledefaults: don't automataically suspend by default if running in a virtual machine

Natalie Clarius requested to merge work/natalie/dont-suspend-in-vm into master

To avoid hangs in virtual environments which don't support suspension.

This will uncheck the "Suspend session" checkbox and set "When laptop lid closed:" to "Do nothing" for all modes in the energy saving settings on initial setup and when restoring defaults, if it is detected that the system runs on a virtual machine.

It is still possible for the user to change those settings and enable auto suspend, or manually invoke suspend, even on a VM. Instead of changing default for auto suspend, would it be more appropriate to always block suspend when running in a VM? Is it possible to run a Plasma session with the same user config sometimes in a VM and sometimes on bare metal? Are there use cases for having Plasma inside a VM handle power management, rather than the host system?

I didn't actually test this with a real VM with source-built Plasma as that would take a long time to set up; if someone has such a set-up lying around, it would be great if you could test this. I did confirm that the profiles change as desired when making the virtual machine check return a dummy. The check itself is taken over from what Gnome does (

BUG: 473835

Edited by Natalie Clarius

Merge request reports