Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

fix(tray): flip recording status to Error on perm-denied early return

Louis Beaumont1ae6c1b39b70
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/health.rs b/apps/screenpipe-app-tauri/src-tauri/src/health.rs
index d71db6395..c685ecdf2 100644
--- a/apps/screenpipe-app-tauri/src-tauri/src/health.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/health.rs
@@ -192,8 +192,7 @@ pub fn set_audio_device_status(devices: Vec<AudioDeviceEntry>) {
*guard = devices;
}
-#[allow(dead_code)]
-fn set_recording_status(status: RecordingStatus) {
+pub fn set_recording_status(status: RecordingStatus) {
RECORDING_INFO
.write()
.unwrap_or_else(|e| e.into_inner())
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/main.rs b/apps/screenpipe-app-tauri/src-tauri/src/main.rs
index ba665673f..54edbb5e9 100755
--- a/apps/screenpipe-app-tauri/src-tauri/src/main.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/main.rs
@@ -1757,6 +1757,17 @@ async fn main() {
// boot the server + HTTP API + DB without TCC.
if !disable_vision && !permissions_check.screen_recording.permitted() {
warn!("Screen recording permission not granted: {:?}. Server will not start.", permissions_check.screen_recording);
+ // Flip the recording state to a terminal Error
+ // value so the tray stops showing "Starting…"
+ // forever. Without this the user sees a
+ // perpetual spinner with no signal that
+ // anything is wrong; clearing only `is_starting`
+ // leaves RECORDING_INFO at its default Starting
+ // value and the health poll has no
+ // ever_connected signal to recover from.
+ crate::health::set_recording_status(
+ crate::health::RecordingStatus::Error,
+ );
is_starting_clone.store(false, std::sync::atomic::Ordering::SeqCst);
return;
}
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/recording.rs b/apps/screenpipe-app-tauri/src-tauri/src/recording.rs
index 9e7c7a6cc..6d9765afa 100644
--- a/apps/screenpipe-app-tauri/src-tauri/src/recording.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/recording.rs
@@ -731,6 +731,11 @@ pub async fn spawn_screenpipe(
permissions_check.screen_recording
);
state.is_starting.store(false, Ordering::SeqCst);
+ state.is_starting_capture.store(false, Ordering::SeqCst);
+ // Flip the tray state machine to a terminal Error so the
+ // recording status indicator stops showing "Starting…" forever
+ // when the user has clicked "click to record" with TCC denied.
+ crate::health::set_recording_status(crate::health::RecordingStatus::Error);
return Err(
"Screen recording permission required. Please grant permission and restart the app."
.to_string(),