OPINIONATED OMARCHY
TROUBLESHOOTING CORPUS
790
RECORDS
790
AUDITED
0
UNCHECKED
2388
SOURCES
LIVE
display-monitors critical common DISPUTE

Stop closing the lid from killing every GUI app at once

omarchyhyprlandwaylandlaptopintel
CORRECTED An auditor found the fix wrong or incomplete and rewrote it.
AUDIT NOTE

The diagnosis is solid: basecamp/omarchy#7853 exists with a matching title, and quattro's bin/omarchy-hyprland-monitor-clamshell does exactly what is described (disable_internal writes hl.monitor({ output = "eDP-1", disabled = true }) into the toggle file then reloads), while bin/omarchy-hyprland-monitor-watch retries sync_clamshell at 1s/3s/7s after monitoradded. The o.bind signature and { locked = true } option are correct, omarchy-brightness-display really does accept off/on, and the toggle paths and uwsm stop are right. But the replacement bind has three real defects. (a) Per Omarchy's own config/hypr/bindings.lua, an existing default must be unbound first. o.bind on a key the defaults already claim does not reliably replace it. (b) The stock switch:on:Lid Switch bind runs omarchy-system-lid-close, which locks the session when the lid closes with no external monitor attached. Silently replacing it means the laptop no longer locks on lid close. (c) omarchy-brightness-display off acts on the *focused* monitor, which in a docked lid-close is usually the external one, so it will blank the wrong screen unless you pass --monitor.

The cause above was not rewritten and may still contain the error described. The fix below is the corrected version.
RISK

Rebinding the lid switch means the laptop panel is no longer removed from the layout when you close the lid. Windows stay on an output you cannot see. Check with hyprctl monitors before assuming a workspace is lost.

Symptom

Plug in HDMI, close the laptop lid a couple of seconds later, and every GUI app dies at once: terminals, Nautilus, Brave, the bar, portals, fcitx5, XWayland. Hyprland itself stays up. Journal shows wl_registry#2: error 0: global wl_output (79) is unavailable, The Wayland connection experienced a fatal error: Protocol error and XWAYLAND: (EE) failed to dispatch Wayland events: Protocol error. Afterwards xprop -root hangs and X11 apps will not start until you log out.

Cause

A Hyprland 0.56.2 registry-bind race: the wl_output global is destroyed while clients are still binding it, and every client that was mid-bind gets a fatal protocol error. Omarchy's clamshell helper is what fires that path on a stock laptop. On monitoradded it runs hyprctl reload (with retries at 1s/3s/7s), and on lid close it writes hl.monitor({ output = "eDP-1", disabled = true }) into a toggle file that is loaded as config, then reloads again. A specific-output disable of the panel is what turns 'one client dies' into a whole-session wipe.

Fix

Until the compositor fix lands, stop Omarchy from destroying the internal wl_output on lid close. Unbind the defaults first, then point the lid switch at a backlight blank of the *internal* panel, and keep the lock, which the stock omarchy-system-lid-close provides and a bare backlight bind would silently drop. In ~/.config/hypr/bindings.lua:


hl.unbind("switch:on:Lid Switch")
hl.unbind("switch:off:Lid Switch")

o.bind("switch:on:Lid Switch", nil,
  "omarchy-system-lock; omarchy-brightness-display --monitor eDP-1 off", { locked = true })
o.bind("switch:off:Lid Switch", nil,
  "omarchy-brightness-display --monitor eDP-1 on", { locked = true })

Substitute your own internal connector for eDP-1 (omarchy-hyprland-monitor-laptop prints it). Drop the omarchy-system-lock; half only if you deliberately do not want the laptop to lock when the lid shuts.

And clear any toggle that is already persisted:


rm -f ~/.local/state/omarchy/toggles/hypr/internal-monitor-clamshell.lua
rm -f ~/.local/state/omarchy/toggles/hypr/internal-monitor-disable.lua
hyprctl reload

Operationally: plug the external display in *first*, wait for it to settle, and only then close the lid. If the session is already wiped, XWayland is not respawned, so log out with uwsm stop and log back in.

Verify

Plug in HDMI, wait, close the lid: hyprctl clients | wc -l stays roughly the same and journalctl -b -g 'wl_output.*unavailable' returns nothing.

Sources

clamshell-lid-close-kills-all-gui-clients