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

feat(notifications): user toggle for display-change toasts

Louis Beaumontd2d50f4e12b2
diff --git a/apps/screenpipe-app-tauri/components/settings/notifications-settings.tsx b/apps/screenpipe-app-tauri/components/settings/notifications-settings.tsx
index 17473077d..133417c9b 100644
--- a/apps/screenpipe-app-tauri/components/settings/notifications-settings.tsx
+++ b/apps/screenpipe-app-tauri/components/settings/notifications-settings.tsx
@@ -20,6 +20,7 @@ const defaultPrefs = {
appUpdates: true,
pipeSuggestions: true,
pipeNotifications: true,
+ displayChanges: true,
mutedPipes: [] as string[],
};
@@ -146,6 +147,20 @@ export function NotificationsSettings() {
onCheckedChange={(v) => updatePref("pipeNotifications", v)}
/>
</div>
+
+ {/* Display changes */}
+ <div className="flex items-center justify-between py-3 border-b border-border">
+ <div>
+ <p className="text-sm font-medium">Display changes</p>
+ <p className="text-xs text-muted-foreground">
+ Toast when a monitor is plugged, unplugged, or switched (clamshell, dock)
+ </p>
+ </div>
+ <Switch
+ checked={prefs.displayChanges ?? true}
+ onCheckedChange={(v) => updatePref("displayChanges", v)}
+ />
+ </div>
</div>
{/* Muted pipes */}
diff --git a/apps/screenpipe-app-tauri/lib/hooks/use-settings.tsx b/apps/screenpipe-app-tauri/lib/hooks/use-settings.tsx
index 4ba385e27..4c99cf9d5 100644
--- a/apps/screenpipe-app-tauri/lib/hooks/use-settings.tsx
+++ b/apps/screenpipe-app-tauri/lib/hooks/use-settings.tsx
@@ -250,6 +250,8 @@ export type Settings = SettingsStore & {
appUpdates: boolean;
pipeSuggestions: boolean;
pipeNotifications: boolean;
+ /** Toast when a monitor is plugged, unplugged, or switched (clamshell, dock). Default true. */
+ displayChanges?: boolean;
mutedPipes: string[];
};
/** Remote devices to monitor pipes on (LAN addresses) */
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/main.rs b/apps/screenpipe-app-tauri/src-tauri/src/main.rs
index a1411aad6..f93a38f5a 100755
--- a/apps/screenpipe-app-tauri/src-tauri/src/main.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/main.rs
@@ -1880,7 +1880,7 @@ async fn main() {
}
});
- crate::monitor_events::start();
+ crate::monitor_events::start(app_handle.clone());
#[cfg(target_os = "macos")]
crate::window::reset_to_regular_and_refresh_tray(&app_handle);
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/monitor_events.rs b/apps/screenpipe-app-tauri/src-tauri/src/monitor_events.rs
index 52b623d27..483db1540 100644
--- a/apps/screenpipe-app-tauri/src-tauri/src/monitor_events.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/monitor_events.rs
@@ -6,17 +6,23 @@
//! vision_manager and surface them as user-facing notifications via `/notify`.
use futures::StreamExt;
+use tauri::AppHandle;
use tracing::debug;
use crate::notifications::client;
+use crate::store::SettingsStore;
-pub fn start() {
+pub fn start(app: AppHandle) {
tauri::async_runtime::spawn(async move {
let mut sub = screenpipe_events::subscribe_to_event::<serde_json::Value>(
"monitor_topology_changed",
);
while let Some(event) = sub.next().await {
+ if !display_changes_enabled(&app) {
+ debug!("monitor topology event → notify: skipped (display-change toasts disabled)");
+ continue;
+ }
if let Some((title, body)) = format_event(&event.data) {
debug!("monitor topology event → notify: {} | {}", title, body);
client::send_typed(title, body, "system", Some(6000));
@@ -25,6 +31,25 @@ pub fn start() {
});
}
+/// Read `notificationPrefs.displayChanges` from the settings store.
+/// Default true (matches the frontend default). Missing store / parse
+/// failure also defaults to true — we'd rather show one extra toast
+/// than silently swallow plug events when the store hiccups.
+fn display_changes_enabled(app: &AppHandle) -> bool {
+ let settings = match SettingsStore::get(app) {
+ Ok(Some(s)) => s,
+ _ => return true,
+ };
+ let prefs = match settings.extra.get("notificationPrefs") {
+ Some(p) => p,
+ None => return true,
+ };
+ prefs
+ .get("displayChanges")
+ .and_then(|v| v.as_bool())
+ .unwrap_or(true)
+}
+
/// Pretty display name. Falls back to a generic label when the payload
/// didn't carry one (older event producer or stop-monitor returned no
/// cached name).