Skip to content

fix: linux screensaver, lock screen and DPMS blocked by session-desktop#1940

Open
BonesGit wants to merge 1 commit into
session-foundation:devfrom
BonesGit:fix/linux-screensaver-idle
Open

fix: linux screensaver, lock screen and DPMS blocked by session-desktop#1940
BonesGit wants to merge 1 commit into
session-foundation:devfrom
BonesGit:fix/linux-screensaver-idle

Conversation

@BonesGit
Copy link
Copy Markdown

@BonesGit BonesGit commented Apr 1, 2026

Fixes #1437

Summary

  • On Linux, prevent-app-suspension maps to systemd-inhibit --what=idle which blocks the entire idle pipeline (screensaver, lock screen, DPMS) — not just suspend
  • Changed systemd-inhibit to use --what=sleep so only suspend is blocked
  • Changed the Electron fallback to use prevent-display-sleep on Linux for the same reason
  • On macOS/Windows, prevent-app-suspension remains correct

Test plan

  • On Linux: verify screensaver, lock screen, and DPMS activate normally while Session is running
  • On Linux: verify Session maintains network connections through system idle
  • On macOS/Windows: verify existing behaviour unchanged

🤖 Generated with Claude Code

On Linux, 'prevent-app-suspension' maps to systemd-inhibit --what=idle
which blocks the entire idle pipeline (screensaver, lock screen, DPMS).
Changed systemd-inhibit to use --what=sleep, and the Electron fallback
to use 'prevent-display-sleep', so only suspend is blocked.

Fixes session-foundation#1437

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
@Bilb
Copy link
Copy Markdown
Collaborator

Bilb commented Apr 2, 2026

Hey,
I don't think this is enough to prevent the system from suspending the app.
This is the root issue here, so system will put Session on idle, and when that happens, no messages will be fetched.
From what I can see, your change would allow the system to be put on idle, which would bring the "no messages except when actively using the app" issue.

@BonesGit
Copy link
Copy Markdown
Author

BonesGit commented Apr 2, 2026

Will double check it

@BonesGit
Copy link
Copy Markdown
Author

BonesGit commented Apr 2, 2026

From what I can tell Session is still running when screen is locked and display goes off. I received messages while in that state. the idle state on linux is what leaves apps running, that's the core of the fix here. Do you want a log to look through it? I captured output from start-prod and it shows messages coming in during the time the screen was locked from idle/sleep state. Anything specific you are looking for?

This fix will still block sleep state. Which is when processes are actually paused via suspend.

@BonesGit
Copy link
Copy Markdown
Author

BonesGit commented Apr 2, 2026

From systemd inhibitor docs:

Seven distinct inhibitor lock types may be taken, or a combination of them:

  1. sleep inhibits system suspend and hibernation requested by (unprivileged) users
  2. shutdown inhibits high-level system power-off and reboot requested by (unprivileged) users
  3. idle inhibits that the system goes into idle mode, possibly resulting in automatic system suspend or shutdown depending on configuration.
  4. handle-power-key inhibits the low-level (i.e. logind-internal) handling of the system power hardware key, allowing (possibly unprivileged) external code to handle the event instead.
  5. Similar, handle-suspend-key inhibits the low-level handling of the system hardware suspend key.
  6. Similar, handle-hibernate-key inhibits the low-level handling of the system hardware hibernate key.
  7. Similar, handle-lid-switch inhibits the low-level handling of the systemd hardware lid switch.

I changed to use "sleep" which allows idle (screensavers, lock, dpms) but still inhibits sleep (suspend and hibernate). This allows Session to stay awake and run and receive messages while the display is off.

But if someone wants their system to go into suspend state then they should know they won't get messages any longer until they wake from suspend.

@BonesGit
Copy link
Copy Markdown
Author

BonesGit commented Apr 8, 2026

This works. Have a look please.
To summarize:

  • This allows the system to go into idle (screensaver, lock, dpms) and keeps Session networking running and working.
  • But it still blocks sleep mode to prevent the system from going into suspend/hibernate which would stop Session networking.

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.

[BUG] session-desktop 1.16.0+ blocks power saving and screen locking

2 participants