From 88752c0a76a01c8242e4231331c69ea7d910343a Mon Sep 17 00:00:00 2001 From: Ly-sec Date: Sat, 9 May 2026 19:45:56 +0200 Subject: [PATCH] fix(GSR): potentially fix hot reload state recovery --- assets/scripts/screen_recorder.lua | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/assets/scripts/screen_recorder.lua b/assets/scripts/screen_recorder.lua index 595f6fb40..49d2d293f 100644 --- a/assets/scripts/screen_recorder.lua +++ b/assets/scripts/screen_recorder.lua @@ -23,7 +23,7 @@ local function cfg(key, default) end local function isProcessRunning() - local exitCode = noctalia.runSync("pgrep -f '[g]pu-screen-recorder' >/dev/null 2>&1") + local exitCode = noctalia.runSync("ps -eo args= | grep '[g]pu-screen-recorder' | grep -v ' -r ' | grep -q .") return exitCode == 0 end @@ -290,6 +290,12 @@ local function checkProcessState() state = "idle" noctalia.notify("Replay buffer stopped") end + elseif state == "idle" then + if isReplayProcessRunning() then + state = "replaying" + elseif isProcessRunning() then + state = "recording" + end end end @@ -335,6 +341,13 @@ function update() if not checkedAvailability then checkedAvailability = true isAvailable = checkAvailability() + if isAvailable then + if isReplayProcessRunning() then + state = "replaying" + elseif isProcessRunning() then + state = "recording" + end + end end if tickCount % CHECK_TICKS == 0 then