fix(services): poll recorder state when utils are open (#1827)
* fix: sync recorder state with recordings started outside the shell The recorder only checked for a running gpu-screen-recorder proc when the shell itself started, stopped or paused a recording. A recording toggled by keybind therefore left the utilities card out of sync: after an external stop the card kept showing REC with the timer counting up, and an external start was only noticed when the card tried to start another recording. Poll pidof once a second while something is actually showing the state. The card takes a Ref on the service, so nothing is polled unless the utilities drawer (or sidebar) is open. Commands from the shell run pidof themselves, and the proc does not start/stop the instant the command is dispatched - `caelestia record` waits for the recorder to finalise the file before exiting, and for region recordings it waits on slurp before spawning it at all. Poll results are therefore only applied once they agree with the state we set, or after 10s if they never do, so a proc that is still shutting down is not mistaken for a new recording and a command that silently failed does not leave the card stuck. Also gate the elapsed counter on the running/paused state again - the Connections doing that was commented out, so the timer kept counting up while a recording was paused. * services: track the record command instead of a timeout Review feedback from @dxnnv on #1827. `caelestia record` owns the whole transition: it blocks on slurp for region captures, and when stopping it waits for the recorder to finalise the file before exiting. Neither has a bound the shell can assume, so the 10s backstop could expire mid-command and let a poll read a recorder that was still shutting down as a brand new recording. Running the command through a Process instead means its lifetime is the signal. Poll results are ignored while it is running, and reconciled when it exits, so no timeout is needed. Also move the `enabled` binding below the function declaration in the Connections, which the section-order convention requires, and suppress signal-handler-parameters on the new onExited the same way checkProc already does - without it qmllint fails on the unresolved QProcess::ExitStatus.
V
vansh rajput committed
d17cbf01019d2998c9ac2f2893b53303fc66167c
Parent: 9daef8c
Committed by GitHub <noreply@github.com>
on 9/18/2026, 7:45:38 AM