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(timeline): restore sidebar shortcut

Louis Beaumont9dc2139872a6
diff --git a/apps/screenpipe-app-tauri/app/(main)/home/page.tsx b/apps/screenpipe-app-tauri/app/(main)/home/page.tsx
index 3156120ce..4ba1b1fbb 100644
--- a/apps/screenpipe-app-tauri/app/(main)/home/page.tsx
+++ b/apps/screenpipe-app-tauri/app/(main)/home/page.tsx
@@ -1196,7 +1196,10 @@ function HomeContent() {
palette use teaches the direct key. Home window only: the settings
page binds its own ⌘K for search focus while mounted. */}
{/* Routes actions the native timeline window cannot perform itself. */}
- <NativeTimelineBridge onReturnToActivity={returnToActivity} />
+ <NativeTimelineBridge
+ onReturnToActivity={returnToActivity}
+ onToggleSidebar={toggleSidebar}
+ />
<CommandPalette
open={commandPaletteOpen}
diff --git a/apps/screenpipe-app-tauri/components/rewind/native-timeline-attach.test.tsx b/apps/screenpipe-app-tauri/components/rewind/native-timeline-attach.test.tsx
index c78d62853..f9942c16c 100644
--- a/apps/screenpipe-app-tauri/components/rewind/native-timeline-attach.test.tsx
+++ b/apps/screenpipe-app-tauri/components/rewind/native-timeline-attach.test.tsx
@@ -63,7 +63,7 @@ vi.mock("@/components/rewind/timeline/daily-summary", () => ({
vi.mock("@/lib/chat-utils", () => ({ showChatWithPrefill: vi.fn() }));
vi.mock("@/components/ui/use-toast", () => ({ toast: vi.fn() }));
-import { NativeTimeline } from "./native-timeline";
+import { NativeTimeline, NativeTimelineBridge } from "./native-timeline";
class ResizeObserverMock {
observe() {}
@@ -132,4 +132,23 @@ describe("native timeline startup API config", () => {
);
});
});
+
+ it("routes the native timeline sidebar shortcut back to its Home shell", async () => {
+ const onToggleSidebar = vi.fn();
+ render(<NativeTimelineBridge onToggleSidebar={onToggleSidebar} />);
+
+ await waitFor(() => {
+ expect(mocks.listen).toHaveBeenCalledWith(
+ "timeline-toggle-sidebar",
+ expect.any(Function),
+ );
+ });
+ const handler = mocks.listen.mock.calls.find(
+ ([eventName]) => eventName === "timeline-toggle-sidebar",
+ )?.[1] as (() => void) | undefined;
+
+ act(() => handler?.());
+
+ expect(onToggleSidebar).toHaveBeenCalledTimes(1);
+ });
});
diff --git a/apps/screenpipe-app-tauri/components/rewind/native-timeline.tsx b/apps/screenpipe-app-tauri/components/rewind/native-timeline.tsx
index fd6824a77..d114da077 100644
--- a/apps/screenpipe-app-tauri/components/rewind/native-timeline.tsx
+++ b/apps/screenpipe-app-tauri/components/rewind/native-timeline.tsx
@@ -154,8 +154,10 @@ export function shouldClearActivityReturn(
*/
export function NativeTimelineBridge({
onReturnToActivity,
+ onToggleSidebar,
}: {
onReturnToActivity?: () => void;
+ onToggleSidebar?: () => void;
} = {}) {
const [dailySummaryRequest, setDailySummaryRequest] = useState<{
date: Date;
@@ -171,6 +173,9 @@ export function NativeTimelineBridge({
listen("timeline-open-chat", () => {
void commands.showWindow("Chat");
}),
+ listen("timeline-toggle-sidebar", () => {
+ onToggleSidebar?.();
+ }),
listen("timeline-return-to-activity", () => {
onReturnToActivity?.();
}),
@@ -269,7 +274,7 @@ export function NativeTimelineBridge({
void subscription.then((unlisten) => unlisten());
}
};
- }, [onReturnToActivity]);
+ }, [onReturnToActivity, onToggleSidebar]);
if (!dailySummaryRequest) return null;
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/commands/native_actions.rs b/apps/screenpipe-app-tauri/src-tauri/src/commands/native_actions.rs
index d0ec33a09..fb0eea516 100644
--- a/apps/screenpipe-app-tauri/src-tauri/src/commands/native_actions.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/commands/native_actions.rs
@@ -215,6 +215,9 @@ fn native_timeline_action_callback_inner(action_ptr: *const std::os::raw::c_char
TimelineAction::OpenChat => {
emit_timeline_event(&app, target.as_deref(), "timeline-open-chat", ());
}
+ TimelineAction::ToggleSidebar => {
+ emit_timeline_event(&app, target.as_deref(), "timeline-toggle-sidebar", ());
+ }
TimelineAction::OpenRecordingSettings => {
let _ = app.emit("timeline-open-recording-settings", ());
}
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/native_timeline.rs b/apps/screenpipe-app-tauri/src-tauri/src/native_timeline.rs
index 54c3bb863..6968f9eda 100644
--- a/apps/screenpipe-app-tauri/src-tauri/src/native_timeline.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/native_timeline.rs
@@ -172,6 +172,7 @@ pub enum TimelineAction {
OpenSearch,
OpenDailySummary { date: String },
OpenChat,
+ ToggleSidebar,
OpenRecordingSettings,
CopyFrame { frame_id: String },
CopyText,
@@ -232,6 +233,7 @@ impl TimelineAction {
date: date.to_string(),
},
("open_chat", _) => Self::OpenChat,
+ ("toggle_sidebar", _) => Self::ToggleSidebar,
("open_recording_settings", _) => Self::OpenRecordingSettings,
("copy_frame", Some(id)) => Self::CopyFrame {
frame_id: id.to_string(),
@@ -505,6 +507,10 @@ mod tests {
);
assert_eq!(TimelineAction::parse("open_search"), TimelineAction::OpenSearch);
assert_eq!(TimelineAction::parse("open_chat"), TimelineAction::OpenChat);
+ assert_eq!(
+ TimelineAction::parse("toggle_sidebar"),
+ TimelineAction::ToggleSidebar
+ );
assert_eq!(
TimelineAction::parse("open_recording_settings"),
TimelineAction::OpenRecordingSettings
diff --git a/apps/screenpipe-app-tauri/src-tauri/swift/timeline/TimelineWindow.swift b/apps/screenpipe-app-tauri/src-tauri/swift/timeline/TimelineWindow.swift
index e91594819..6d8ac63d2 100644
--- a/apps/screenpipe-app-tauri/src-tauri/swift/timeline/TimelineWindow.swift
+++ b/apps/screenpipe-app-tauri/src-tauri/swift/timeline/TimelineWindow.swift
@@ -215,6 +215,9 @@ struct TimelineKeyHandler {
model.emitAction("copy_text")
}
return true
+ case "b" where command && !shift && !option && !control && embedded:
+ model.emitAction("toggle_sidebar")
+ return true
case "l" where control && command:
if let action = model.askAISelectionAction() {
model.emitAction(action)
diff --git a/apps/screenpipe-app-tauri/src-tauri/swift/timeline_interaction_tests.swift b/apps/screenpipe-app-tauri/src-tauri/swift/timeline_interaction_tests.swift
index 6d55dfbb6..4f9ede2f8 100644
--- a/apps/screenpipe-app-tauri/src-tauri/swift/timeline_interaction_tests.swift
+++ b/apps/screenpipe-app-tauri/src-tauri/swift/timeline_interaction_tests.swift
@@ -894,6 +894,17 @@ private func testKeyboardThroughWindow(window: NSWindow, model: TimelineViewMode
_ = handler.handle(TimelineKeyEvent(keyCode: TimelineKeyEvent.leftArrow))
expectEqual(model.currentIndex, 51, "left arrow steps older through the window's handler")
+ _ = TimelineActionBridge.shared.drainEmitted()
+ let embeddedHandler = TimelineKeyHandler(model: model, embedded: true)
+ let consumed = embeddedHandler.handle(
+ TimelineKeyEvent(keyCode: 11, characters: "b", command: true)
+ )
+ expect(consumed, "Command-B is consumed by an embedded timeline")
+ expect(
+ TimelineActionBridge.shared.drainEmitted().contains("toggle_sidebar"),
+ "Command-B asks the owning Home shell to toggle its sidebar"
+ )
+
// A key monitor must be installed while the window is up, or nothing the
// keyboard does reaches the timeline.
expect(window.isVisible, "the window must still be visible for key handling")