From 30620b7a5ab4a5fafccc27c1d782d0aa9e0e16af Mon Sep 17 00:00:00 2001 From: Henrik Klee Date: Fri, 20 Nov 2026 03:15:03 +0800 Subject: [PATCH 1/2] simulator: hook the GPU desktop before either form of Labwc's start The VM's GPU-desktop switch went in before `exec /usr/bin/labwc -m`, which omarchy-a's login script no longer ends with once the session starts locked (a restart loop follows its OMARCHY_START_LOCKED export). The hook now goes before whichever of the two the script has, so new disks get the GPU desktop with released images and the start-locked ones alike. Assisted-by: LLM --- simulator/prepare-vm-linux.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/simulator/prepare-vm-linux.sh b/simulator/prepare-vm-linux.sh index 22f10167..40a8ff20 100755 --- a/simulator/prepare-vm-linux.sh +++ b/simulator/prepare-vm-linux.sh @@ -76,8 +76,12 @@ PY # Packaged releases (0.3.2 on) install it in /usr/libexec, earlier ones in /usr/local/libexec. session=$MOUNT/usr/libexec/arch-ipad-login-session [[ -e $session ]] || session=$MOUNT/usr/local/libexec/arch-ipad-login-session -grep -q '^exec /usr/bin/labwc -m$' "$session" || { echo "$session: no Labwc start to hook" >&2; exit 1; } -sed -i 's|^exec /usr/bin/labwc -m$|# Orchard Simulator: the GPU desktop on Mesa software OpenGL (/etc/omarchy-a/simulator-gpu).\nif [[ -e /etc/omarchy-a/simulator-gpu ]]; then export WLR_RENDERER=gles2 WLR_RENDERER_ALLOW_SOFTWARE=1; unset QT_QUICK_BACKEND; fi\nexec /usr/bin/labwc -m|' "$session" +# The hook goes before Labwc starts: its `exec` in releases up to 0.3.x, the +# start-locked export (followed by the restart loop) since the session +# starts locked. +hook='^\(exec /usr/bin/labwc -m\|export OMARCHY_START_LOCKED=1\)$' +grep -q "$hook" "$session" || { echo "$session: no Labwc start to hook" >&2; exit 1; } +sed -i "\\%$hook%i # Orchard Simulator: the GPU desktop on Mesa software OpenGL (/etc/omarchy-a/simulator-gpu).\\nif [[ -e /etc/omarchy-a/simulator-gpu ]]; then export WLR_RENDERER=gles2 WLR_RENDERER_ALLOW_SOFTWARE=1; unset QT_QUICK_BACKEND; fi" "$session" mkdir -p "$MOUNT/etc/omarchy-a" touch "$MOUNT/etc/omarchy-a/simulator-gpu" From 40616e1df84e40ad31856691e202e348834617ae Mon Sep 17 00:00:00 2001 From: Henrik Klee Date: Fri, 20 Nov 2026 05:20:52 +0800 Subject: [PATCH 2/2] simulator: switching the desktop starts a new session, locked Since Omarchy A starts its desktop from greetd's initial_session (no login screen), greetd starts it once per boot and notes that in its runfile; the bridge's plain `systemctl restart greetd` then showed greetd's fallback, and the old desktop lived on in its abandoned session. The bridge now stops greetd, ends the seat's sessions (kill-session: an abandoned session's processes outlive terminate-session here), removes the runfile and starts greetd: a new desktop with the chosen renderer, at the lock screen as after a boot. Assisted-by: LLM --- simulator/vm-support/orchard-vm-bridge.py | 36 +++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/simulator/vm-support/orchard-vm-bridge.py b/simulator/vm-support/orchard-vm-bridge.py index 42f6c4a6..86cd40a6 100644 --- a/simulator/vm-support/orchard-vm-bridge.py +++ b/simulator/vm-support/orchard-vm-bridge.py @@ -74,14 +74,46 @@ def commands(): pass elif line in (b'desktop gpu', b'desktop software'): # The GPU desktop on software OpenGL, or the software desktop; - # the session starts again with it (back to the PIN screen). + # the session starts again with it (back to the lock screen). flag = '/etc/omarchy-a/simulator-gpu' if line == b'desktop gpu': os.makedirs(os.path.dirname(flag), exist_ok=True) open(flag, 'a').close() elif os.path.exists(flag): os.unlink(flag) - subprocess.run(['/usr/bin/systemctl', 'restart', 'greetd'], check=False) + restart_desktop() + + +def restart_desktop(): + """A new desktop session, as at boot. + + greetd starts the desktop (initial_session) once per boot and notes that + in its runfile; restarted alone it would show its fallback instead. So + the old session ends, the note goes, and greetd starts the desktop + again, locked as at boot. + """ + subprocess.run(['/usr/bin/systemctl', 'stop', 'greetd'], check=False) + sessions = subprocess.run(['/usr/bin/loginctl', 'list-sessions', '--no-legend'], + capture_output=True, text=True, check=False).stdout + seat = [row.split()[0] for row in sessions.splitlines() if row.split()[3:4] == ['seat0']] + # With greetd stopped its sessions are abandoned: terminate-session only + # marks them closing (user processes outlive a session here), so their + # processes are signalled, and killed if they are not gone in 5 s. + for signal in ('SIGTERM', 'SIGKILL'): + for session in seat: + subprocess.run(['/usr/bin/loginctl', 'kill-session', session, f'--signal={signal}'], + capture_output=True, check=False) + deadline = time.monotonic() + 5 + while time.monotonic() < deadline and subprocess.run(['/usr/bin/pgrep', '-x', 'labwc'], + capture_output=True).returncode == 0: + time.sleep(0.1) + for session in seat: + subprocess.run(['/usr/bin/loginctl', 'terminate-session', session], capture_output=True, check=False) + try: + os.unlink('/run/greetd.run') + except FileNotFoundError: + pass + subprocess.run(['/usr/bin/systemctl', 'start', 'greetd'], check=False) threading.Thread(target=report_brightness, daemon=True).start()