Galaxy Shell / docs
Docs / Interface and features

Lock screen

openspec/specs/lock-screen/spec.md · Edit on GitHub ↗

On this page

Lock screen

Purpose

Lock the desktop session so that only a PAM-checked password, or the client that holds an ext-session-lock-v1 lock, can release it. Smithay hides the desktop, a protected web page draws the lock interface and a small helper checks the password.

Requirements

Requirement: Content hidden from the lock request

The system SHALL hide all regular content from the first lock request, draw plain black until the lock content is ready, and send locked to a protocol client only after a frame without regular content reached the screen. Full text: section Compositor.

Scenario: Protocol client asks for the lock

  • WHEN a protocol client requests the lock
  • THEN regular content is hidden at once and the client receives locked only after a frame without regular content reached the screen

Requirement: Input stays on the lock content

The system SHALL give keyboard and pointer focus only to the lock content and stop all shortcuts while locked. Only the VT switch (Ctrl+Alt+F1..F12) remains, and it leaves the session without unlocking it. Full text: section Compositor.

Scenario: Super key while locked

  • WHEN the session is locked and the user presses Super or the terminal shortcut
  • THEN nothing happens, because every shortcut stops

Requirement: Minimal control socket while locked

The control socket SHALL accept only state, acknowledge_input, lock, unlock and lock_host while locked (idle_display_off joins them). Capture, previews, focus, launch, workspace and theme commands MUST fail with "Session is locked". Full text: sections Compositor and Limits and decisions.

Scenario: Launch while locked

  • WHEN a launch command arrives on the control socket while locked
  • THEN it fails with "Session is locked"

Requirement: Shell lock needs a registered host

A shell lock SHALL require a registered host; without one the lock request MUST fail and the screen MUST stay unlocked, so the screen never goes blank with no way to unlock it. Full text: section Compositor.

Scenario: No host registered

  • WHEN a shell lock is requested and no host is registered
  • THEN the request fails and the screen stays unlocked

Requirement: Lock host identity and lock authority

lock_host SHALL be accepted only when the named pid is the parent of the process that connected the control client. Only the control connection that registered the host MAY send unlock; another pid is refused while the host lives. When the host process exits, the compositor SHALL drop the trust and the lock authority at once. Full text: section Compositor.

Scenario: Another pid while the host lives

  • WHEN lock_host names another pid while the host process lives
  • THEN it fails with "Lock host is another live process"

Requirement: Control connection table

The control socket SHALL keep at most 8 connections. When the table is full, a new connection MUST replace the oldest connection that is not the lock host, and the connection of the lock host MUST never be replaced. Full text: section Compositor.

Scenario: Ninth connection

  • WHEN a ninth connection arrives and the table is full
  • THEN the oldest connection that is not the lock host is replaced

Requirement: Lock survives a compositor restart

On a lock the compositor SHALL write the marker $XDG_RUNTIME_DIR/agent-native-session-lock-<XDG_SESSION_ID> (regular file, mode 0600, never through a link) and the unlock MUST remove it. A compositor started with --session that finds the marker of its login SHALL start locked by the shell, black, until the user unlocks with the password. Full text: section Compositor.

Scenario: Restart in the same login

  • WHEN the compositor restarts in the same login while the marker exists
  • THEN it starts locked and black with no host registered, until the restarted core registers and the user unlocks

Requirement: No fallback release over a lock

A login supervisor MUST NOT start a fallback release over a lock. When the active compositor exits with an error and any entry or an unreadable path exists at the marker path, scripts/smithay-session.py SHALL end the login and record ended-locked with the reason session-locked; scripts/project-session.py applies the same rule. Full text: section Compositor.

Scenario: Crash while locked

  • WHEN the compositor exits with an error while the marker path has an entry
  • THEN the login ends and returns to the login screen instead of starting the fallback root

Requirement: Window cap with a lock host reserve

The compositor SHALL hold at most 128 windows and close a window over that cap, except that the windows of the registered lock host process keep a reserve of 8 more. Full text: section Compositor.

Scenario: Window flood

  • WHEN other clients open windows up to the cap
  • THEN further windows are closed but the lock host can still open its lock panel

Requirement: Lock panel binding and visibility

The lock panel SHALL be the window bound to the role lock, declared by the host with a lock token. A shell lock MUST be refused with "No lock window is declared" while the registered host holds no lock token, and a window of role lock MUST never be shown, presented or given the keyboard outside the lock scene. Full text: section Compositor.

Scenario: Lock before the token is declared

  • WHEN a shell lock arrives while the registered host holds no lock token
  • THEN it is refused with "No lock window is declared"

Requirement: Lock client death and second client

If a protocol client dies, the session SHALL stay locked and show black, and the shell then takes the lock over. A second protocol client that asks for a held lock MUST be refused and lose its connection with a protocol error. Full text: section Compositor.

Scenario: Lock client crashes

  • WHEN the protocol client that holds the lock dies
  • THEN the session stays locked and black until the shell takes over

Requirement: Every output shows lock content or black

The lock SHALL cover every output the compositor drives: each output MUST show either its own lock content or plain black, never windows, the bar, panels, wallpaper, overlays, previews or transitions. A shell lock panel covers the primary output only and extra outputs stay black. Full text: section Several outputs.

Scenario: Output hot-plugged while locked

  • WHEN an output is hot-plugged while locked
  • THEN it is black until the client creates and commits a lock surface for it

Requirement: Locked is sent after every output

The system SHALL send locked only after every driven output showed a frame without regular content, and send_to_output and every window command MUST fail with "Session is locked". Full text: section Several outputs.

Scenario: Window command while locked

  • WHEN send_to_output is sent while locked
  • THEN it fails with "Session is locked"

Requirement: Lock page token and isolation

The lock page SHALL get its own token and MUST never receive the general shell token, and the general token MUST NOT open the lock routes. The lock page loads nothing of the chat, recovery or panel documents, and has no plain fallback. Full text: section Core and host.

Scenario: Shell token on a lock route

  • WHEN a request to a lock route carries the general shell token
  • THEN the route does not accept it

Requirement: Lock page password field

The password field SHALL be a plain uncontrolled <input> read once through a ref when the form is sent, and the password MUST never be in React state, props or a store. The colors are fixed and MUST NOT follow the profile color. Full text: section Core and host.

Scenario: Form submission

  • WHEN the user sends the form
  • THEN the field is read once through a ref and cleared, with no copy in React state

Requirement: Lock window of the host

The Electron host SHALL open the lock window while the shell holds the lock, close it after the unlock, and open it again if it closes or crashes while locked. The window is opaque and frameless with no menu, no developer tools and no navigation. Full text: section Core and host.

Scenario: Lock window crashes

  • WHEN the lock window crashes while the session is locked
  • THEN the host opens it again

Requirement: Password only through stdin to PAM

The password SHALL travel as raw bytes of 1 to 1024 bytes to the standard input of lock-auth-helper.py; the core MUST never parse, convert to text or log the body and MUST zero each chunk. The helper takes the user from its own process owner and prints only a fixed reason word on standard error. Full text: section Password path.

Scenario: Password submitted

  • WHEN the page sends the password bytes
  • THEN the core streams them to the helper stdin and zeroes each chunk after the pipe took it

Requirement: Only PAM acceptance unlocks

Only helper exit code 0 SHALL make the core send unlock to the compositor; 1 means denied and 2 means error. An empty password MUST always be refused, and the PAM service name from AGENT_NATIVE_LOCK_PAM_SERVICE MUST match ^[A-Za-z0-9_-]{1,32}$. Full text: section Password path.

Scenario: Wrong password

  • WHEN the helper exits with 1
  • THEN the core does not send unlock

Status

Doc status: current contract. Shell and client lock with PAM, lock page on shadcn/ui since 2026-11-04. Checked 2026-11-10.

Introduction

Status: implemented in source and covered by automated tests on 2026-10-31, for one output and for two outputs (the primary output and one extra output). The direct session can drive more outputs, and the lock rules cover each one (see Several outputs); the lock tests use at most two at a time. It is not yet proven in the real session, in Electron, on real hardware or with a real second monitor. See Not proven.

Smithay hides the desktop and keeps focus on the lock content. A protected web page draws the interface, and PAM checks the password through a small helper. Smithay draws no native interface.

How it works

Two owners can hold the lock. Only one holds it at a time.

Owner Started by Lock content Released by
Shell Super+L, the quick settings "Bloquear tela" control, or the control socket lock command The protected lock-screen web page, drawn by the Electron host The core, after PAM accepted the password
Client Any Wayland client that speaks ext-session-lock-v1 The lock surfaces of that client That client, with unlock_and_destroy

The compositor implements ext-session-lock-v1 with Smithay. A shell lock uses the same hiding, input and recovery rules. Chromium cannot create an ext-session-lock-v1 surface, so the web page is a normal toplevel that the compositor promotes while the shell holds the lock.

Compositor

  • From the first request, all regular content is hidden. The frame is plain black until the lock content is ready.
  • A protocol client receives locked only after a frame without regular content reached the screen. On DRM this is the vblank that follows the queued frame. In the nested backend it is the submitted frame.
  • Only the lock content gets keyboard and pointer focus. All shortcuts stop, including Super, Super+Escape, workspace gestures and the terminal shortcut. Only the VT switch (Ctrl+Alt+F1..F12) remains, and it leaves the session without unlocking it.
  • The control socket accepts only state, acknowledge_input, lock, unlock and lock_host while locked. Capture, previews, focus, launch, workspace and theme commands fail with "Session is locked". Pending previews are not rendered.
  • A shell lock needs a registered host. Without one, the lock request fails and the screen stays unlocked, so the screen never goes blank with no way to unlock it.
  • The lock host is a process, and its registration has two parts. The trust identity is the host process: its windows are the shell windows. The lock authority is the control connection that registered it: only that connection can send unlock. lock_host names the pid of the host, and the compositor accepts it only when that pid is the parent of the process that connected the control client (/proc/<peer>/stat, with the peer read by SO_PEERCRED and proved alive by SO_PEERPIDFD, or by a pidfd opened at connect on an older kernel). The Electron host starts the core, so the core can name the host and no other process of the user can, unless it is a child of the host. While the host process lives, lock_host with another pid fails with "Lock host is another live process", also on the registering connection, and lock_host from another connection fails with "Lock host is registered by another connection". lock stays open to every connection. When the connection closes, the lock authority ends and the session stays locked; the host windows stay trusted, so a core that reconnects with the same pid keeps the shell. When the host process exits (its pidfd becomes readable, or without pidfd_open its start time changes), the compositor drops the trust and the lock authority at once, so a new host and its core can register; an old core that lost its parent cannot.
  • The control socket keeps at most 8 connections. When the table is full, a new connection replaces the oldest connection that is not the lock host, so other processes of the user cannot keep a restarted core out. The connection of the lock host is never replaced.
  • A lock survives a restart of the compositor inside the same login. On a lock, the compositor writes the marker $XDG_RUNTIME_DIR/agent-native-session-lock-<XDG_SESSION_ID> (a regular file, mode 0600, never through a link, that holds the session id). The unlock removes it. A compositor started with --session that finds the marker of its login starts locked by the shell: black, with no host registered, until the restarted core registers the lock host and the user unlocks with the password. Any entry at that path counts, so a marker that cannot be read keeps the session locked. Another login has another session id and starts unlocked. Without a valid XDG_SESSION_ID (letters, digits, _ and -, at most 64) there is no marker; the nested backend never writes one.
  • A login supervisor never starts a fallback release over a lock. When the active compositor exits with an error, scripts/smithay-session.py checks the marker path of XDG_SESSION_ID with the same rule as the compositor. If any entry is there, or the path cannot be read, it ends the login and returns to the login screen instead of starting the fallback root, because a fallback built before the marker would start unlocked. It records the phase ended-locked with the reason session-locked in supervisor-smithay-recovery.json. The project dispatcher scripts/project-session.py applies the same rule before its own fallback and records ended-locked in project-session.json.
  • The compositor holds at most 128 windows. A window over that cap is closed, except that the windows of the registered lock host process keep a reserve of 8 more. So many windows from other clients cannot refuse the lock panel and leave the lock black.
  • The lock panel is the window bound to the role lock (openspec/specs/window-layers/spec.md, phase 2). The Electron host declares one lock token at start, before its other windows and without waiting for them, through the main-key route /host-window (the core sends window_declare, which the compositor accepts while locked for the role lock only). Every lock window of the host uses the title anos-window:<token> of that token in turn, and the host never forgets it at a close, so the next lock window binds to it once the old one is gone. hardenLockWindow lets a page title through only when it equals the title that the window was created with, so the lock page cannot rename the hidden window before its toplevel maps. On a compositor without capabilities.windowDeclarations the core answers "unsupported", and the lock window takes the legacy lock title Agent Native Panel:lock-screen, which only that older compositor reads (one of the two compatibility titles of openspec/specs/window-layers/spec.md, Version skew). Until the token is declared, no lock window opens. Since window layers phase 4 the compositor reads no title: a lock window that did not bind is an undeclared host-owned root, never the lock panel, and a shell lock is refused with "No lock window is declared" while the registered host holds no lock token, so the lock scene never runs with nothing that can unlock it. The host declares the lock token at start, so the refusal only shows in the short gap before that, or with a host from before phase 2. Every change of the host identity (a host or core restart) drops the tokens, so the gap comes again after each restart, until the new host declares its lock token. A press of Super+L in that gap is not lost: it waits up to 10 s for the declare of a lock token and locks then (lock_key, PENDING_LOCK). A lock of the core (the quick settings button) asks again every 250 ms for up to 5 s (SessionLock.lock) and then shows the refusal. Trust still needs a Wayland client of the registered host process that connected after that process started (the connect time of the client and the start time of the host, both in clock ticks after boot): a connection that an older process with a reused pid left open is not the host. The panel never shows while the session is unlocked: a window of role lock is never shown, presented or given the keyboard outside the lock scene (visible_window). The id lock-screen also stays reserved in web-panels.json.
  • If a protocol client dies, the session stays locked and shows black. The shell then takes the lock over, and its lock page returns. A new protocol client cannot take over.
  • A second protocol client that asks for a held lock is refused and loses its connection with a protocol error. Smithay does not tell the handler which client sent unlock_and_destroy, so a refused client must not keep a lock object.

Several outputs

The direct session drives a primary output and any number of extra outputs, all with the role secondary (see several monitors). The lock covers every output that the compositor drives:

  • Each output shows either its own lock content or plain black. It never shows windows, the bar, panels, the wallpaper, overlays, previews or transitions, on any output.
  • A protocol lock surface belongs to the wl_output that the client named in get_lock_surface. It is configured to the size of that output, and it is drawn, hit tested and sent frame callbacks on that output only. When the mode of an output changes while locked, its lock surfaces get a new configure with the new size; an unchanged size sends nothing.
  • An output whose lock surface has no committed buffer yet is black. This covers the gap after the lock request and an output that is hot-plugged while locked: the new output is black until the client creates and commits a lock surface for it.
  • When an output is unplugged while locked, its lock surface stops counting. The lock stays, and the other outputs keep their lock content.
  • The shell lock panel covers the primary output. Every extra output stays black during a shell lock.
  • The pointer moves across all outputs. While locked it reaches only the lock surface of the output under it, or nothing. Keyboard focus goes to the lock surface on the output under the pointer, else to the first lock surface of the owner.
  • locked is sent only after every driven output showed a frame without regular content. An extra output that is removed before that stops counting.
  • send_to_output and every window command fail with "Session is locked", so no window moves to another output or appears while locked.
  • A dialog that names its parent while locked is not bound then, because the binding is a window command. The compositor keeps the request and applies it at the unlock: the dialog moves to the workspace of its parent, or to the extra output of the parent when the parent is there.
  • If the lock client dies, every output is black and the session stays locked.

The nested backend has one output and keeps the single-output rule.

Core and host

  • core/session-lock.js decides lock and unlock. core/lock-routes.js serves /api/lock/status and /api/lock/unlock. core/lock-auth-helper.py calls PAM.
  • The lock page gets its own token. It never receives the general shell token, and the general token does not open the lock routes.
  • The lock page is React with shadcn/ui since 2026-11-04 (openspec/specs/shadcn-migration/spec.md, phase 8), after HeroUI from 2026-11-02. The password field is a plain uncontrolled <input>, because the Base UI Input commits its value to the state of its Field control. host/lock-screen.html loads /theme.css, /shadcn-lock.css, /lock-screen.css and the classic script /shadcn-lock.js, its own bundle with its own React, the copied Button and one lucide icon. It loads nothing of the chat, recovery or panel documents, and the lock partition lets through only these routes, the page and the unlock route. There is no plain fallback: a broken lock bundle means no unlock in that login, and the way out is a VT switch and the end of the session. When the bundle does not load or fails before its first render, the page keeps a static text inside #lock-root that names this way out; it is text only, not a form. The form keeps the IDs of the plain page (#clock, #date, #unlock, #password, #submit, #status) and takes the focus at mount, when it is enabled again, on window focus and on any click. The colors are fixed (lock-screen.css), never the profile color.
  • The Electron host reads GET /lock-state with the launch cookie every 250 ms. It opens the lock window while the shell holds the lock, closes it after the unlock, and opens it again if it closes or crashes while the session is locked. The window is opaque and frameless, and it has no menu, no developer tools and no navigation. The window is created hidden and shows on the first of ready-to-show and the end of the page load (did-finish-load): under Wayland a hidden window may never get the first frame that ready-to-show needs, as for the panel windows. This second signal was added on 2026-11-02, after a nested run where the lock window never showed.
  • The host sets AGENT_NATIVE_LOCK_HOST_PID for the core it starts. The core registers that process id with the compositor (lock_host) on its control connection, and sends unlock on the same connection. A core started by another route registers nothing, and the lock stays unavailable. A restarted core registers again when it connects.

Password path

  1. The page encodes the field to bytes, clears the field, and sends the bytes as application/octet-stream with Content-Length from 1 to 1024. The field is an uncontrolled input: the React form reads it once through a ref when the form is sent, and the password is never in React state, props or a store. React's own input value tracker keeps a copy for the life of the field text and clearing the field clears it, so this does not mean that no copy exists in the renderer while the user types. The page client (ui-src/host/lock-client.js) sends the bytes once and zeroes them after the request ends.
  2. The core streams the request body into the standard input of lock-auth-helper.py. It never parses the body, never converts it to text and never logs it. It zeroes each chunk after the pipe took it.
  3. The helper reads standard input only, takes the user name from its own process owner, and calls pam_authenticate and pam_acct_mgmt through libpam.so.0 and ctypes. It needs no package and no header.
  4. The helper exits with 0 (accepted), 1 (denied) or 2 (error), prints nothing on standard output, and prints only a fixed reason word on standard error.
  5. Only exit code 0 makes the core send unlock to the compositor.

The PAM service name comes from AGENT_NATIVE_LOCK_PAM_SERVICE. It must match ^[A-Za-z0-9_-]{1,32}$ and defaults to login. This change creates and edits no file in /etc. An empty password is always refused, even if the account allows one.

Security properties and the test that proves each

# Property Test
1 Content is hidden from the lock request, before any lock surface is ready session_lock::tests::content_is_hidden_from_the_request_until_the_owner_unlocks; a_locked_plain_frame_holds_only_the_lock_content_on_every_output (wgpu_scene_tests.rs) finds no application item before the lock surface is ready; the GPU test native_wgpu_renderer_lock_protocol_client_draws_only_its_surface_and_the_application_returns (and _on_gl) reads the pixels (black, then the lock surface color only, then the application after the unlock)
2 The lock is confirmed (locked sent) only after a frame without regular content was shown locked_is_confirmed_only_after_a_hidden_frame_reached_the_screen; a_protocol_client_locks_after_a_hidden_frame_and_unlocks_by_itself (client receives locked only after the frame)
3 Only the lock surface is drawn, and it covers the output a_protocol_lock_on_one_output_draws_only_its_lock_surface_and_the_application_returns (the lock surface is the only item, with placement and clip equal to the whole output) and the GPU test native_wgpu_renderer_lock_protocol_client_draws_only_its_surface_and_the_application_returns plus _on_gl (every pixel is the lock surface color, no application color)
4 Only the registered host process can present the lock panel, and only while the shell holds the lock only_the_registered_host_can_present_the_lock_panel_and_it_gets_the_focus; the_plain_shell_lock_holds_only_the_host_lock_panel_and_it_is_hidden_unlocked and the_plain_shell_lock_panel_is_the_only_item_on_the_primary_output_and_no_wallpaper_or_chat (wgpu_scene_tests.rs; no panel item while unlocked or when the registered process id differs), and the GPU test native_wgpu_renderer_shell_lock_draws_only_the_host_lock_panel plus _on_gl (pixels: only the host lock panel on the primary output, the second output black, the application back after the unlock)
5 Keyboard and pointer focus stay on the lock content keyboard_and_pointer_focus_never_leave_the_lock_content, pointer_focus_is_cleared_when_the_session_locks, a_locked_session_has_no_shortcut_except_leaving_through_a_vt
6 The control socket cannot read, move or launch anything while locked the_control_socket_is_closed_while_locked_except_for_state_and_unlock, lock_commands_are_typed_and_the_locked_allow_list_is_minimal
7 A client that crashes does not unlock the session a_crashed_lock_client_leaves_the_session_locked_until_the_shell_recovers; Node the shell takes over a lock whose program died, and only then
8 A second client cannot take, keep or release a held lock a_second_client_cannot_take_a_held_lock_or_release_it, only_the_lock_owner_gets_a_configured_lock_surface, a_refused_client_cannot_unlock_the_session_it_does_not_own (both requests in one batch)
9 A shell lock cannot be released by a protocol client, and a client lock cannot be released by the shell a_shell_lock_cannot_be_taken_or_released_by_a_protocol_client, unlocking_an_unlocked_session_is_refused
10 The screen never goes blank without a registered lock interface a_shell_lock_needs_a_registered_host_and_a_valid_pid, a_shell_lock_without_a_registered_host_is_refused_and_hides_nothing, the lock host is registered only when the Electron host names itself
11 The password goes only to the helper, through standard input the PAM helper gets the password on stdin only, with a bare environment; Python test_arguments_are_refused_so_a_password_never_travels_in_argv
12 The password is never stored, logged or echoed the core code never writes the password to a log, a correct password unlocks and a wrong one is a plain 401, an unknown error never leaks its text; Python test_the_input_never_appears_in_any_output; lock-http checks the core output and the lock bundle (no storage, no cookie); shadcn-lock checks the lock sources (no console, no storage, no state, reducer or store for the password, no HTML from a string), scans the React tree for the typed text and checks that the field is empty when the request leaves
13 The core wipes its copy of each chunk the copy of the password held by the core is wiped after it is written
14 A wrong password never unlocks; only exit code 0 does a correct password unlocks and a wrong one never does, helper exit codes map to accepted, denied and unavailable, a helper failure is neither a success nor a wrong password
15 Guessing is slowed, and attempts do not overlap repeated failures back off, and the delay grows to a cap, only one attempt runs at a time, route test repeated wrong passwords answer 429 with Retry-After
16 A hostile body cannot overload or confuse the helper the body must be raw bytes of a bounded size, an oversized body kills the helper and never grants access, a hung helper is killed after the timeout, Python test_bad_input_never_reaches_pam
17 The helper authenticates only the owner of its process Python test_asks_pam_for_the_current_user_with_the_default_service; the user name has no input path
18 The PAM service name cannot be a path Python test_service_comes_from_the_environment_and_is_validated
19 The lock routes need the lock token, which generated HTML and the shell token cannot replace; cross-origin requests fail every lock route needs the lock token, which the shell token cannot replace, a foreign origin is refused even with the token, lock-http (page, state and routes against a real core)
20 The lock page has a strict content security policy and no inline script lock-http (CSP without unsafe-inline, no inline script); shadcn-lock (the React page under the real CSP: no violation, no <style> element, only the lock routes)
21 The lock window returns after a crash and cannot be navigated, closed by shortcuts or inspected lock-window tests
22 A core that starts during a lock can still unlock it, and restores the workspace afterwards a core that starts during a lock joins it and restores the workspace after the unlock, a core that joins a lock taken from the overview leaves the overview after the unlock
23 The helper reaches the real PAM stack Manual: one call with a synthetic wrong input returned exit code 1 for services login and other. No real password was used.
24 Every output shows its own lock surface or black, never desktop content, including before the commits, after a hot plug and after the client died every_output_gets_its_own_lock_surface_and_stays_black_until_it_commits; every_plain_output_shows_its_lock_surface_or_nothing_and_never_the_desktop (wgpu_scene_tests.rs, both plain output scenes as item lists: application items before the lock, then none, then each lock surface on its own output only, none on a hot-plugged output, none on both after the client died) and the GPU test native_wgpu_renderer_lock_every_output_draws_its_own_surface_or_black plus _on_gl (pixels: each output its own color, black without a buffer)
25 Input on any output reaches only the lock surfaces pointer_and_keyboard_on_every_output_reach_only_the_lock_surfaces (an application on the second output is reachable before the lock and never after)
26 An output hot-plugged while locked stays black until its lock surface commits; an unplug keeps the lock an_output_hot_plugged_while_locked_shows_nothing_until_its_lock_surface_commits
27 send_to_output and window commands cannot move or show anything while locked window_actions_and_send_to_output_are_refused_while_locked, lock_commands_are_typed_and_the_locked_allow_list_is_minimal
28 A dead lock client leaves every output black and the session locked a_dead_lock_client_leaves_every_output_black_and_locked
29 A shell lock shows its panel on the primary output only a_shell_lock_shows_its_panel_on_the_primary_output_only
30 locked waits for a hidden frame on every driven output locked_is_sent_only_after_every_output_showed_a_hidden_frame, session_lock::tests::locked_waits_for_every_output_and_a_removed_output_stops_counting
31 Only the control connection that registered the lock host can send unlock; another pid is refused while the host lives; its close ends the lock authority and keeps the lock only_the_lock_host_connection_can_unlock_and_its_close_ends_the_lock_authority (real control socket, two connections), session_lock::tests::only_the_host_connection_can_replace_the_host_or_release_a_shell_lock
32 A full control socket table cannot keep the core out, and never drops the lock host a_full_control_table_replaces_the_oldest_connection_and_keeps_the_lock_host (real control socket, nine connections)
33 A compositor restarted in the same login starts locked, and only the lock host unlocks it a_lock_survives_a_compositor_restart_in_the_same_login_until_the_unlock (private 0600 marker, shell and protocol locks, another login unlocked), session_lock::tests::a_restored_lock_belongs_to_the_shell_and_waits_for_a_host, session_lock::tests::the_lock_marker_names_one_login_inside_the_private_runtime_directory
34 A mode change while locked reconfigures the lock surface of that output only a_mode_change_while_locked_reconfigures_the_lock_surface_of_that_output
35 A dialog opened while locked moves nothing, and follows its parent after the unlock a_dialog_opened_while_locked_follows_its_parent_after_the_unlock
36 A flood of windows from other clients cannot refuse the lock panel a_full_window_table_still_takes_the_lock_panel_of_the_host (cap of 128, reserve of 8 for the lock host only)
37 A compositor failure while locked never starts an older, unlocked fallback Python test_a_crash_while_locked_ends_the_login_instead_of_an_unlocked_fallback, test_any_entry_or_an_unreadable_marker_path_keeps_the_fallback_off, test_a_marker_of_another_login_or_no_session_id_still_allows_the_fallback
38 lock_host names only the parent of the control client, and only while that client runs ipc::tests::a_lock_host_must_be_the_parent_of_the_control_client, ipc::tests::a_peer_that_exited_names_no_parent, only_the_lock_host_connection_can_unlock_and_its_close_ends_the_lock_authority (own pid and another pid refused)
39 The exit of the host ends the trust and the lock authority, so a new host registers host_trust_ends_when_the_host_process_exits, session_lock::tests::the_host_trust_ends_when_its_process_exits, session_lock::tests::a_watch_without_pidfd_sees_the_exit_by_the_start_time
40 A Wayland connection older than the host process is not trusted, also with the host pid a_connection_older_than_the_host_process_is_not_trusted, session_lock::tests::only_a_connection_newer_than_the_host_process_is_the_host

Limits and decisions

History: the first version of this work (branch of 2026-10-31, before the two-monitor integration) supported one output only and drew every lock surface on the first output. The integration replaced that rule with the per-output contract above.

  • The control socket is private (mode 0600, directory 0700). The lock protects against a person at the keyboard, not against code that already runs as the user. Before the parent rule, one race remained: a process of the user could force a gap without a registered host (stop the compositor for more than 3 s, so the RPC of the core times out, or end the core), connect within the 30 ms of the control timer and register its own pid. Its window titled Agent Native Panel:lock-screen (before phase 4; since phase 4 its declared lock token) then became the lock panel and could receive the password, and it could send unlock without PAM. A silent variant registered the real host pid instead, so nothing looked wrong except that the restarted core failed to register. The parent rule, the refusal of another pid while the host lives and the release on host death close both variants for processes that are not children of the host. The remaining paths need code that already runs as the user: end the host and then, in the gap before the new host registers, name its own parent as the host (a job of the core can name the core and then send unlock), or run as a child of the host. A refused core retries every 2 s on the same connection and reports the refusal in GET /health (lockHost: {expected, registered, error}) and once per refusal text in its log ("Smithay lock host: ..."). The replacement rule of a full connection table gives the core a slot. The same code can also remove the restart marker or connect many times in a loop.
  • The restart marker lives in $XDG_RUNTIME_DIR, which the user owns. It protects against a compositor crash or a supervisor restart, not against code that runs as the user. It needs XDG_SESSION_ID from the login; a session without it restarts unlocked, as before. A restart that happens between the lock request and the marker write, or a failed write (logged as "Session lock marker not written"), also restarts unlocked. A logind lock hint is not used.
  • The shell lock panel is one Electron window. It covers the primary output only; every extra output is black during a shell lock.
  • After a rejected client, Smithay keeps the output in its list of locked outputs until some unlock_and_destroy clears it. A refused client loses its connection before it can create a surface, so this cannot be triggered by the normal flow.
  • The lock does not stop applications from running. It also does not lock other virtual terminals.
  • unlock_and_destroy before the lock is confirmed by the owner itself is accepted, because the owner may always release its own lock.
  • A new lock request while a live client holds the lock fails with a protocol error. This is stricter than the protocol, which asks for finished.
  • Idle timeout, lock on suspend and user switching are not part of this work. Since 2026-11-11 a locked session turns the display off after 30 seconds with no input (idle-display-off.md); that turns no lock on and changes no rule of this document, and idle_display_off joins the commands that the control socket accepts while locked.

Narrower pixel proof since step 8

The GLES pixel tests (egl_*) were deleted with the GLES renderer (steps 7 and 8 of the GLES removal plan). The pixel proof of the lock is now the wgpu GPU tests named in the table, on Vulkan and on OpenGL: the protocol lock (one output, then the application back), every output with its own surface or black, and the shell lock (only the host lock panel on the primary output, the second output black, the application back after the unlock). Three cases are checked only as element lists, with no pixel test: a hot-plugged output stays black until its lock surface commits, every output stays black when the lock client dies, and a lock surface of a foreign process title shows plain black. The element lists are what the scene draws, so they are strong evidence, but nobody read those pixels.

Not proven

  • Real Electron: the lock window creation, removeMenu, focus on the compositor-placed panel and the 250 ms polling were tested only with fakes.
  • A live session: Super+L, the quick settings control and the unlock were not run in the shared session, by design.
  • Real hardware: the vblank-based confirmation on DRM and a real GPU scanout were not exercised. The GPU tests render offscreen.
  • A real password: PAM acceptance of a correct password was not tested, by design. Only denial and the library binding were.
  • Third-party lockers such as swaylock were not tried.
  • A real second monitor: two lock surfaces on two KMS outputs, the per-output vblank confirmation, cable hotplug while locked and a VT switch with two outputs were not exercised. The multi-output tests use synthetic outputs and render offscreen.
  • A restart of the compositor by a real supervisor while locked: the marker, the black start and the unlock after the core registers again were tested in process only. The refusal of the fallback over a lock was tested with a synthetic marker and a mocked compositor run.
  • Visual quality and accessibility of the lock page. The React form is proven in headless Chromium against a synthetic core, not yet in the live session. The HeroUI form of 2026-11-02 also had a nested run (openspec/changes/archive/2026-11-02-heroui-migration/design.md, "Phase 11 result").

Commands that need the new binary and host: a next login with the updated compositor and a rebuilt host. Reloading Electron does not replace the compositor.