Menu ▾ ▴

#34 shell: lock the screen before suspend and on loginctl lock-session

open
nobody
None
2026-11-16
2026-11-16
Anonymous
No

Originally created by: idiazraz

Found on the ASUS X510UNR: closing the lid suspended the laptop, and opening it went straight back to the desktop. The lock screen only ever appeared with Windows+L.

Change (shell/qml/Lock.qml)

  • gdbus monitor --system --dest org.freedesktop.login1 sets Desktop.locked on Manager.PrepareForSleep (true), and on Session.Lock for this session's path (loginctl lock-session, which idle tools and other apps use).
  • login1 escapes the session id's leading digit, so session 3 is .../session/_33.
  • While unlocked, the shell holds a systemd-inhibit --what=sleep --mode=delay inhibitor. It lets go 300 ms after the lock surface is up, so logind waits for the lock before sleeping and the desktop never flashes on resume. logind's default InhibitDelayMaxSec is 5 s.
  • gdbus restarts after 2 s if it exits, the same way kriss-shell-toplevels does.

Tested on the laptop (live via shell/dev-push)

  • systemd-inhibit --list shows KrissOS Shell … sleep Lock the screen first delay.
  • Lid close, then open: the laptop resumes to the lock screen, and the password unlocks it.
  • loginctl lock-session locks.

Note for [#31] (shell/dev-push)

On one push, Quickshell reloaded while tar was still writing files and failed with QuickSettings.qml[311:33]: Expected token ). The next push loaded fine.

Related

Tickets: #31

Discussion


Log in to post a comment.