Skip to content

keep awake: option to also block suspend and the lid switch - #3942

Merged
bbedward merged 4 commits into
duxlabs-dev:masterfrom
pltanton:keep-awake-lid-closed
Nov 4, 2026
Merged

bbedward merged 4 commits into
duxlabs-dev:masterfrom
pltanton:keep-awake-lid-closed

Conversation

@pltanton

@pltanton pltanton commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Description

Keep Awake only blocks the Wayland idle timer, so closing the lid still suspends. This adds a "Stay awake with the lid closed" toggle to the Keep Awake page. While Keep Awake is on and the toggle is on, the core holds a logind sleep:handle-lid-switch block inhibitor.

Suspend no longer locks the session in that case, so the core locks it on lid close, if "Lock before suspend" is on and logind doesn't report the machine as docked.

  • core: loginctl.setKeepAwake, lid-close lock, tests
  • QML: keepAwakeBlocksSleep setting, sync in SessionService, toggle in IdleInhibitorDetail

Code was written with Claude Code; I reviewed and tested it.

Type of change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that changes existing behavior)
  • Refactor / internal cleanup
  • Documentation
  • Other

Related issues

Closes #2836

Screenshots / video

keep-awake-lid

Checklist

  • My code follows the conventions in CONTRIBUTING.md
  • I have tested my changes locally
  • New user-facing strings are wrapped in I18n.tr() with translator context, reusing existing terms where possible
  • Go changes: ran make fmt, added/updated tests, make test passes, and go mod tidy is clean
  • QML changes: ran make lint-qml with no new warnings

pltanton and others added 2 commits October 26, 2026 16:39
Keep Awake only inhibits the Wayland idle timer, so closing the lid still
suspends (duxlabs-dev#2836). With the new "Stay awake with the lid closed" option, the
core holds a logind sleep:handle-lid-switch block inhibitor while Keep Awake
is on. Since suspend no longer locks the session, the core locks it on lid
close when lock before suspend is on and logind does not report the machine
as docked.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@pltanton

Copy link
Copy Markdown
Contributor Author

The original plugin (https://github.com/pltanton/dms-vibe-shift) has more: its own bar icon and a custom duration field with a parser (90m, 2h30m, 23:30). I left them out to keep this PR small. Happy to send them as follow-ups if you want them.

@iSparsh

iSparsh commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

this is really cool, would love if the devs fast-tracked this :)

@bbedward

Copy link
Copy Markdown
Member

/claude review

@claude

claude Bot commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

Claude review

The lid-close lock never fires, because logind does not emit change signals for LidClosed.

  • With Keep Awake on, closing the lid leaves the session unlocked: logind never announces LidClosed changes, so use UPower LidIsClosed. core/internal/server/loginctl/monitor.go:206
    Checked: core loginctl inhibitor/handler/signal-match changes and their cleanup, the QML setting and SessionService sync, the toggle, I18n, and deprecated shims. Model: claude-opus-5-5.

logind before v256 and elogind do not emit LidClosed changes.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@pltanton

Copy link
Copy Markdown
Contributor Author

Fixed in 8e24e6d: the lid-close lock now uses UPower LidIsClosed, the logind lid match is gone. Tested: lid closed 38 min, locked, no suspend.

@bbedward

bbedward commented Nov 4, 2026

Copy link
Copy Markdown
Member

/claude review

@claude

claude Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Claude review

No issues found. The earlier lid finding is fixed: the lock now uses UPower LidIsClosed.
Checked: core loginctl.setKeepAwake inhibitor acquire/release and Close cleanup, the handler and its test, the SessionService sync on toggle/expiry/capabilities, the lid-close lock path through the existing UPower subscription, the toggle (I18n, D* widgets, deprecated shims), and the settings spec. Model: claude-opus-5-5.

@bbedward
bbedward merged commit f822666 into duxlabs-dev:master Nov 4, 2026
4 checks passed
dux-ci Bot pushed a commit that referenced this pull request Nov 4, 2026
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.

Keep Awake even when lid is closed

3 participants