omarchy icon indicating copy to clipboard operation
omarchy copied to clipboard

Closed-lid session stays unlocked and accepts invisible input after its last external monitor disconnects

Open SmithLabsLLC opened this issue 3 months ago • 1 comments

System details

Intel Core i5-1235U / Intel Iris Xe, Omarchy 4.0.1-1, Hyprland 0.56.2-1, Quickshell 0.3.1-1, kernel 7.1.9-arch1-2

What's wrong?

When a laptop is used in clamshell mode with its lid closed and one active external monitor, powering off or disconnecting that final monitor leaves the session unlocked and able to accept keyboard input while no display is visible.

This was reproduced twice with a scratch editor. It is an input-safety and secure-state bug: the user cannot see where input is going, but the previously focused client remains active and receives keys until a usable display returns.

Steps to reproduce

  1. Connect exactly one external monitor to a laptop.
  2. Open a scratch editor containing no sensitive information and leave it focused.
  3. Close the laptop lid. Confirm the external monitor remains active and the internal panel is disabled for clamshell operation.
  4. Physically power off or disconnect the final external monitor.
  5. While no display is visible, briefly hold a harmless letter key.
  6. Power on or reconnect the external monitor.

Actual behavior

  • Hyprland removes the external output.
  • Omarchy's clamshell reconciliation enables/modesets the internal panel even though the lid remains physically closed.
  • No visible output is available to the user.
  • The session does not lock; the previously focused application continues receiving keyboard input.
  • When the external display returns, the session is still unlocked and the unseen input is present in the scratch editor.

Expected behavior

When a closed-lid session loses its final active external monitor, Omarchy should immediately enter a secure state before further keyboard input reaches the focused client. When a usable display returns, the user should see the lock screen and authenticate before returning to the application.

Open-lid unplugging, removing one of several external monitors, and already-locked sessions should retain their current behavior.

Sanitized display evidence

The relevant sequence was the same on both reproductions:

drm: Connector DP-1 disconnected
drm: Disabling output DP-1
drm: DP-1 is not connected, clearing stale crtc
drm: Modesetting eDP-1
drm: Connector eDP-1 enabledState changed false -> true

There was no accompanying USB/HID device removal or re-enumeration during either reproduction.

Source-level path and possible fix direction

bin/omarchy-hyprland-monitor-watch handles monitor-removal events and invokes clamshell reconciliation. bin/omarchy-hyprland-monitor-clamshell disables the internal panel only while clamshell mode is true and an external output remains active. After the final external output disappears, that condition becomes false and the helper enables the physically hidden internal panel. Neither path checks for the combination of closed lid plus no remaining external display before returning input to the live session.

One fix direction is for the existing monitor watcher to serialize the removal event, verify that the lid is closed and no external display remains, check that no lock is already active or pending, and request omarchy-system-lock. Existing display recovery should still run so the lock screen becomes visible when a usable output returns.

I generated omarchy-debug --no-sudo --print locally, but the full output contains unrelated host, network, storage, and application identifiers, so I am not attaching it. The relevant versions and sanitized event sequence are included above.

SmithLabsLLC avatar Aug 31 '26 04:08 SmithLabsLLC

Thanks for the careful report. The missing lock is confirmed in source, and the fix is up as #14711.

omarchy-system-lid-close locks when the lid shuts with no external display, but when the last external disappears while the lid is already shut, omarchy-hyprland-monitor-watch only reconciles the panel: omarchy-hyprland-monitor-clamshell re-enables the internal display and nothing asks for a lock. On a stock install, logind's default lid handling then suspends the machine once it no longer sees an external display, and the sleep lock secures the session at that point, so there the exposure is the few seconds before suspend. Your session staying unlocked until the monitor came back suggests logind did not act on the lid on your machine (a HandleLidSwitch setting or a lid-switch inhibitor would do it); either way the session should not depend on that.

#14711 makes the watcher apply the lid-close rule when a monitor is removed: lid closed and no external display still connected means lock, before the panel is re-enabled, and nothing when the session is already locked. Removing one of several externals and unplugging with the lid open behave as before. A new shell test drives the real watcher with a removal event; on a worker built from the Omarchy ISO it fails on quattro and passes with the fix. The physical unplug itself could not be reproduced on a VM, which has no lid or hot-pluggable display.

The diagnosis and the fix were reviewed separately by Codex at medium effort. It agreed with the mechanism, and its findings on the test's timing are folded into the fix; its last round was clean. The pull request now waits on the maintainer.

omarchybot avatar Oct 09 '26 10:10 omarchybot