Skip to content

Daemon/WindowListener: Prevent auto-suspend/idle when going fullscreen#2852

Draft
flodavid wants to merge 1 commit into
elementary:mainfrom
flodavid:prevent-sleep-when-fullscreen
Draft

Daemon/WindowListener: Prevent auto-suspend/idle when going fullscreen#2852
flodavid wants to merge 1 commit into
elementary:mainfrom
flodavid:prevent-sleep-when-fullscreen

Conversation

@flodavid

@flodavid flodavid commented May 28, 2026

Copy link
Copy Markdown

When an application is in fullscreen, I think it should prevent the system going to sleep automatically. This is annoying especially when looking at videos (especially movies) or when gaming with something else than mouse and keyboard.
I did not found an existing issue about this.

This adds two methods to the gala daemon that are triggered by gala itself via dbus. One is used when any window goes fullscreen, to mark it as "inhibiting" automatic sleep to the session manager. The other method to "unhibit" for the same window when it exits fullscreen. Multiple windows can inhibit sleeping, they all must exit fullscreen to restore auto-sleep.

NB: If any window is fullscreen, auto sleep is disabled, even if it is not on the current virtual desktop.

TODO: add gschema setting for disabling auto suspend when fullscreen.

@flodavid flodavid force-pushed the prevent-sleep-when-fullscreen branch from 7a96025 to 5da1b9a Compare May 29, 2026 01:30
@leolost2605

Copy link
Copy Markdown
Member

Hmmm IMO the app should do that itself if it wants it rather than us uncoditionally for all fullscreen apps. E.g. it might make sense for videos but I for example use a handwritten note taking app in fullscreen and I definitely want my device to go to sleep if I went to the cafeteria and forgot to suspend it.

@flodavid flodavid force-pushed the prevent-sleep-when-fullscreen branch 2 times, most recently from dc06dc4 to a626f6a Compare May 31, 2026 00:08
Adds two methods to the gala daemon that are triggered by gala itself via dbus,
because the WindowListener is not inside a GTK Application.
One method used when any window goes fullscreen,
to mark it as "inhibiting"automatic sleep to the session manager.
The other method is to "unhibit" for the given window when it exits fullscreen.
Multiple windows can inhibit sleeping, they all must exit fullscreen
to restore auto-sleep.

NB: If any window is fullscreen, auto sleep is disabled,
even if it is not on the current virtual desktop.

TODO: add gschema setting for disabling auto suspend when fullscreen
@flodavid flodavid force-pushed the prevent-sleep-when-fullscreen branch from a626f6a to f60780c Compare May 31, 2026 00:09
@flodavid

Copy link
Copy Markdown
Author

Hmmm IMO the app should do that itself if it wants it rather than us uncoditionally for all fullscreen apps. E.g. it might make sense for videos but I for example use a handwritten note taking app in fullscreen and I definitely want my device to go to sleep if I went to the cafeteria and forgot to suspend it.

I mainly use fullscreen modes for videos or games and I do not know many apps that have one, but for those use cases auto-sleep is pretty annoying.
But it is also why I want to add a setting to enable/disable this behaviour. Maybe instead of disabling auto-sleep, I should set it to the maximum of two hours ? Or add a new setting to power options dedicated to fullscreen auto-sleep delay ? Or a setting in the "Applications" configurations ?

@leolost2605

leolost2605 commented May 31, 2026

Copy link
Copy Markdown
Member

But it is also why I want to add a setting to enable/disable this behaviour.

IMO while we could of course add a setting, settings always bring more untested code paths, more complexity etc. so a settings shouldn't be added lightly: https://docs.elementary.io/hig/design-philosophy/accessible-configuration
And I think in this case adding a setting to work around apps that just don't work the way they should isn't a good reason. Especially since the same thing is easily accesible from the quick settings. (In case you didn't know there's a prevent sleep toggle in the quick settings that does exactly that)

@flodavid

flodavid commented Jun 2, 2026

Copy link
Copy Markdown
Author

Yes, I know about this toggle. But when I launch a game I often forget to toggle it (or to untoggle it after) and it its not accessible when in fullscreen. And changing the virtual desktop can sometimes mess with the game. Same thing when I launch a movie, I forget to activate it before going in my couch. When the screen starts to go black, I do not have the time to jump on the keyboard to stop suspending. Also the computer sometimes just hangs while going to sleep or out of it, so it is extra annoying.
Maybe I should add a notification 1 minute (or like 5% of the time to sleep) before going to sleep, like many TV do. Or maybe a notification suggesting to activate the "Prevent sleep" option when going full-screen. But this one could may be annoying.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants