omarchy icon indicating copy to clipboard operation
omarchy copied to clipboard

ScreenRecording bar indicator stuck 'active' after boot despite no gpu-screen-recorder process running

Open AmanKRoy opened this issue 2 months ago • 3 comments

Summary

The ScreenRecording bar indicator (shell/plugins/bar/indicators/ScreenRecording.qml) shows the "Stop recording" (active) state immediately after every shell/session restart or reboot, even though no gpu-screen-recorder process is actually running. This has persisted across multiple real reboots, not just shell restarts, so it isn't a leftover in-memory flag — the false-positive is regenerated fresh every boot.

Environment

  • Omarchy 4.0.2-1 (Arch Linux, Hyprland)
  • Dual-monitor setup (two bar instances, so two ScreenRecording indicator instances load concurrently at startup)

Evidence

  1. No real process ever exists. Direct /proc scan for any process whose exe symlink resolves to gpu-screen-recorder, run repeatedly across restarts and reboots, finds nothing. pgrep -af "^gpu-screen-recorder" (unanchored, no --quiet) also finds nothing at any point I checked, including a 5-second 100ms-interval poll spanning a full shell restart.

  2. The widget's own script agrees nothing is recording. Manually running omarchy-capture-screenrecording --stop-recording (the exact command the indicator's onPressed handler runs when it believes recording is active) hits the script's own screenrecording_active() check (a pgrep -f "^gpu-screen-recorder" call), finds nothing, and exits 1 via the elif [[ $STOP_RECORDING == "true" ]]; exit 1 branch — i.e. the production script's own logic confirms no recording is active.

  3. The indicator's internal pgrep call still reports exitCode: 0 (match found). I temporarily instrumented a local copy of ScreenRecording.qml with console.log calls around refresh() and the statusProc Process, reinstalled it, and restarted the shell (omarchy-restart-shell) while tailing the journal. Every time, statusProc's onExited handler fires with exitCode: 0, and root.recording flips to true — reproduced on repeated restarts.

    [SR-DEBUG] Component.onCompleted
    [SR-DEBUG] refresh() called. bar: true statusProc.running: false
    [SR-DEBUG] statusProc launched
    [SR-DEBUG] statusProc.running changed: true
    [SR-DEBUG] statusProc EXITED, exitCode: 0
    [SR-DEBUG] recording changed to true
    [SR-DEBUG] active changed to true
    
  4. But the match itself doesn't exist. I then changed the command from pgrep --quiet -f "^gpu-screen-recorder" to pgrep -af "^gpu-screen-recorder" (dropping --quiet, adding -a to print the matched line) and piped stdout through a SplitParser logging every line. exitCode: 0 still fires on every restart, but zero matched lines are ever printed — i.e. pgrep is reporting a match was found while producing no output describing what matched.

  5. Ruled out: no systemd user unit is active (gpu-screen-recorder.service is disabled/inactive (dead)), no Hyprland exec-once entry references the recorder, and grep -r "gpu-screen-recorder" across /usr/share/omarchy only matches the indicator itself and the omarchy-capture-screenrecording script — nothing else in Omarchy ever invokes the binary.

Suspected cause

This system has two monitors, so two ScreenRecording indicator instances mount concurrently at shell startup, each independently constructing an identical Process (pgrep --quiet -f "^gpu-screen-recorder") and setting running = true within the same event loop tick (Component.onCompleted / onBarChanged). Given the exitCode: 0 combined with the total absence of matched output, this looks like a race in Quickshell's Process exit-code delivery when two Process objects with the same command are started back-to-back/concurrently — the exit code from one may be getting cross-delivered, or a stale/default value is being read before the real child has actually reported. I haven't dug into Quickshell's C++ internals to confirm the exact mechanism.

Impact

Purely cosmetic — no real recording ever starts, so there's no risk of an unbounded video file or actual background recording. But the indicator is misleading (looks like an active recording is running for days), and clicking it fires omarchy-capture-screenrecording --stop-recording for no reason.

Suggested fix directions (not attached as a PR — wanted to flag this with full repro evidence first since I haven't been able to confirm the exact mechanism at the Quickshell layer)

  • Share a single status check across all ScreenRecording indicator instances (e.g. a shared/singleton poll) instead of each monitor's indicator spawning its own concurrent identical Process, removing the suspected race by construction.
  • Add a periodic re-poll (the indicator currently only refreshes on bar/indicatorHost signals, so if it does get a false positive once, nothing corrects it afterward).

Happy to help test a fix if useful.

AmanKRoy avatar Sep 05 '26 11:09 AmanKRoy

Thanks for the detailed instrumentation. I couldn't reproduce this here, but the check you instrumented is no longer on quattro. That change hasn't shipped in a release yet (none through v4.0.4 has it), so testing it on your machine is what will settle this.

What changed on quattro. In 4.0.2 the indicator runs pgrep --quiet -f "^gpu-screen-recorder" (shell/plugins/bar/indicators/ScreenRecording.qml:18). That matches any process, under any user, whose command line starts with that text, whatever binary it really is. In e1b0e5e9b (#14431) the indicator switched to omarchy-capture-screenrecording --status, which goes through the new bin/omarchy-capture-screenrecording-process. That helper only counts your own processes named exactly gpu-screen-recorder or wf-recorder, and checks the binary each one runs through /proc/<pid>/exe. Separately, 454b67d95 (#11015) stopped building the horizontal and vertical indicator trees side by side, so on 4.0.2 each of your bars was running more than one of these checks at startup.

What I ran, on a disposable Omarchy VM at quattro 35a55fd23:

  • With no recorder running, both checks report idle.
  • A process whose argv[0] is gpu-screen-recorder-decoy (really sleep): the 4.0.2 check reports recording and --status reports idle. The 4.0.2 check is fooled by a lookalike name, and the new one isn't.
  • A binary that really is named gpu-screen-recorder: --status sees it, and sees it disappear when it exits.
  • 200 pairs of the 4.0.2 pgrep started at the same moment: none matched. Two concurrent pgreps don't match each other, because their own command lines start with pgrep.
  • screenrecording-process-test.sh, screenrecording-concurrency-test.sh and screenrecording-test.sh all pass.

None of that explains how your machine got exit 0 with no matched line, so the cause isn't confirmed. A second review by Codex Medium (Codex at medium effort) agreed that this can't be called fixed without a retest. It added two points I hadn't considered:

  • The indicator reads exitCode and ignores exitStatus, which Qt only guarantees for a normal exit. That still holds on quattro.
  • The indicator never re-checks on its own, so one false start stays until something requests a refresh. #9296 proposes a periodic re-check.

Could you test this? It fits into your existing setup without changing your install:

  1. Save bin/omarchy-capture-screenrecording-process from commit 35a55fd236598598130711249a647e0071532e9a to ~/.local/bin/ and make it executable.
  2. In your instrumented copy of the indicator, change the command to ["omarchy-capture-screenrecording-process"]. With no arguments it does exactly what --status does when nothing was started by the script.
  3. Log both arguments of onExited: function(exitCode, exitStatus), then restart the shell and reboot as before.

If it still lights up, please post that log, whether omarchy-shell -q omarchy.indicators refresh clears it, whether it happens with one monitor connected, and your quickshell, qt6-base and procps-ng versions. To test the whole of quattro instead, clone it and run omarchy dev link <checkout>, then omarchy dev unlink to go back. That's a large jump from 4.0.2, so only do it on a machine you're comfortable recovering.

This is waiting on your result.

omarchybot avatar Oct 11 '26 06:10 omarchybot

Retest result: the indicator logic isn't the cause, and this supersedes my earlier two-monitor race theory.

Thanks for the pointers. Short version: on my machine the shell process starts with SIGCHLD ignored, inherited from Hyprland, and with that every Quickshell Process reports exitCode=0 exitStatus=1 (CrashExit), whatever the child really did.

Setup: Omarchy 4.0.6, Quickshell 0.3.2.r7.g2b4501a-1, Qt 6.12.0-3, Hyprland 0.56.2-4.

  • With omarchy-capture-screenrecording-process in the indicator, the log was exitCode=0 exitStatus=1 on every check. A ["false"] command logged the same, so the helper itself is fine (it exits 1 when idle).
  • The running shell had SigIgn: 0x1011006, which includes SIGCHLD (0x10000). Hyprland has the same bit set. The shell is started from Hyprland (exec_cmd("omarchy-launch-shell"), also from omarchy-restart-shell), so it inherits the ignore.
  • A standalone quickshell -p <test.qml> reports exits correctly even when its parent ignores SIGCHLD, so I can't say what in the full shell needs it. The trigger may be the Quickshell or Qt upgrade (this started after 2026-10-19); I haven't bisected it.
  • Launching the same shell with SIGCHLD at default gave the right behavior: icon off when idle, "Stop Screenrecording" absent from the capture menu when idle.
  • The menu symptom is the same bug. Menu.qml's guardProc treats exitStatus != 0 as "killed" and keeps every row.
  • Workaround that fixes both: systemd-cat -t omarchy-shell -- env --default-signal=CHLD quickshell -n -p "$OMARCHY_PATH/shell" in omarchy-launch-shell. Afterwards SigIgn is 0x1001006, and the icon and menu row behave correctly (recording lights the icon, stop clears it).

So the new --status helper isn't needed for my case. The bug is the inherited signal disposition, and any Process.onExited check in the shell is affected. Since this is broader than the indicator, I filed it separately with the full evidence: #17181.

AmanKRoy avatar Oct 31 '26 19:10 AmanKRoy

Thanks for the retest and for tracking it down to SIGCHLD. I reproduced it, and the fix is up as #17302.

What I ran, on a disposable Omarchy VM at quattro e2c7007c1 (quickshell 0.3.2.r7.g2b4501a-5, qt6-base 6.12.0-3, Hyprland 0.57.0-2):

  • In a minimal Quickshell config, Process running false, sh -c 'exit 3' and omarchy-capture-screenrecording --status reported 1, 3 and 1 with SIGCHLD at its default. Started under env --ignore-signal=CHLD, all three reported exitCode=0 exitStatus=1, exactly as you saw. Standalone Quickshell is affected here too, so the full shell isn't needed to trigger it.
  • On this stock install the shell doesn't inherit the ignore (Hyprland SigIgn: 0x1001000, shell 0x1001006), so it doesn't happen out of the box with these packages. Hyprland's own reapZombieChildrenAutomatically() sets SIG_DFL with SA_NOCLDWAIT in both 0.56.2 and 0.57.0, which doesn't ignore the signal. Where the ignore comes from on your machine is still open.
  • With the current launcher started from a parent that ignores SIGCHLD, it's worse on quattro than the indicator: the stranded-lock check also reads the 0 as a stranded lock, so the screen locks as soon as the shell starts.

Current quattro launcher, started with SIGCHLD ignored: the screen locks as the shell starts

The fix. #17302 does what you suggested: omarchy-launch-shell starts Quickshell through env --default-signal=CHLD. Every shell start goes through that launcher: autostart, omarchy-restart-shell, and its own relaunches. Started the same way, the fixed shell comes up with SIGCHLD at its default, stays unlocked, and shows no recording indicator. launch-shell-test.sh now covers it, and it fails with the fix reverted. The other failures in the full suite on that VM also fail on quattro without the change.

Fixed launcher, started with SIGCHLD ignored: normal bar, no recording indicator

Second opinion. Codex Medium and muse-wonder (via pi, thinking high) reviewed the diagnosis and the fix and agreed with both. Their independence isn't guaranteed. Codex traced the mechanism into Qt: forkfd zeroes the status before waitid, and nothing checks the ECHILD failure, so the zeroes come back as exit 0 with CrashExit. Between them they listed more handlers affected the same way, including SystemUpdate.qml, PasswordlessSudo.qml, the Tailscale panel and the menu's guards.

This issue will close when #17302 merges, which is waiting on the maintainer. If you'd like to confirm it on your machine, the change is that one line in omarchy-launch-shell, which you're already running as your workaround.

omarchybot avatar Nov 01 '26 23:11 omarchybot