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: track chat, search, and timeline opens in PostHog

Louis Beaumont61177220a154
diff --git a/apps/screenpipe-app-tauri/components/shortcut-reminder.tsx b/apps/screenpipe-app-tauri/components/shortcut-reminder.tsx
index 71130abf6..ae9499b53 100644
--- a/apps/screenpipe-app-tauri/components/shortcut-reminder.tsx
+++ b/apps/screenpipe-app-tauri/components/shortcut-reminder.tsx
@@ -12,8 +12,11 @@ export function ShortcutTracker() {
useEffect(() => {
const unsubscribers: (() => void)[] = [];
+ // Shortcut events → "shortcut_used" PostHog event
const shortcuts = [
{ event: "shortcut-show", name: "show_screenpipe" },
+ { event: "shortcut-show-chat", name: "show_chat" },
+ { event: "open-search", name: "show_search" },
{ event: "shortcut-start-recording", name: "start_recording" },
{ event: "shortcut-stop-recording", name: "stop_recording" },
{ event: "shortcut-start-audio", name: "start_audio" },
@@ -30,6 +33,24 @@ export function ShortcutTracker() {
});
});
+ // Tray menu click events → "view_opened" PostHog event
+ const trayEvents = [
+ { event: "tray-show-timeline", view: "timeline" },
+ { event: "tray-show-search", view: "search" },
+ { event: "tray-show-chat", view: "chat" },
+ ];
+
+ trayEvents.forEach(({ event, view }) => {
+ listen(event, () => {
+ posthog.capture("view_opened", {
+ view,
+ source: "tray_menu",
+ });
+ }).then((unlisten) => {
+ unsubscribers.push(unlisten);
+ });
+ });
+
return () => {
unsubscribers.forEach((unlisten) => unlisten());
};
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/main.rs b/apps/screenpipe-app-tauri/src-tauri/src/main.rs
index 5bbc57585..4a280ba48 100755
--- a/apps/screenpipe-app-tauri/src-tauri/src/main.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/main.rs
@@ -463,6 +463,7 @@ async fn apply_shortcuts(app: &AppHandle, config: &ShortcutConfig) -> Result<(),
config.is_disabled("show_chat"),
|app| {
info!("show chat shortcut triggered");
+ let _ = app.emit("shortcut-show-chat", ());
// Toggle the chat window - hide if visible, show if not.
// Use order_out (not close) to preserve the pre-created panel
// so it can reappear on fullscreen Spaces without re-creation.
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/tray.rs b/apps/screenpipe-app-tauri/src-tauri/src/tray.rs
index 70be1a1d6..e76f512f1 100644
--- a/apps/screenpipe-app-tauri/src-tauri/src/tray.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/tray.rs
@@ -403,15 +403,18 @@ fn handle_menu_event(app_handle: &AppHandle, event: tauri::menu::MenuEvent) {
match event.id().as_ref() {
"show" => {
show_main_window(app_handle, false);
+ let _ = app_handle.emit("tray-show-timeline", ());
}
"show_search" => {
// Search is a modal on the main window, not a separate window.
// Show main window first, then emit event to open the search modal.
show_main_window(app_handle, false);
let _ = app_handle.emit("open-search", ());
+ let _ = app_handle.emit("tray-show-search", ());
}
"show_chat" => {
let _ = ShowRewindWindow::Chat.show(app_handle);
+ let _ = app_handle.emit("tray-show-chat", ());
}
"start_recording" => {
let _ = app_handle.emit("shortcut-start-recording", ());