From b34f789fb3bcaea67476a0eb8ecef6a2368982da Mon Sep 17 00:00:00 2001 From: wawow830 Date: Fri, 6 Nov 2026 10:14:48 +1100 Subject: [PATCH 1/2] feat(settings): add a switch for trackpad swipe back/forward navigation The desktop app's two-finger sideways swipe navigates history, with no way to turn it off. Add a client setting, on by default, that mounts HistorySwipeNavigation only when enabled. Shown under Settings > General > Display, with reset, restore-defaults and search entries. Co-authored-by: Claude Sonnet 5.5 --- .../settings/DesktopClientSettings.test.ts | 1 + apps/web/src/components/AppSidebarLayout.tsx | 5 ++-- .../components/settings/SettingsPanels.tsx | 29 +++++++++++++++++++ .../src/components/settings/settingsSearch.ts | 6 ++++ docs/user/keybindings.md | 2 ++ packages/contracts/src/settings.test.ts | 15 ++++++++++ packages/contracts/src/settings.ts | 2 ++ 7 files changed, 58 insertions(+), 2 deletions(-) diff --git a/apps/desktop/src/settings/DesktopClientSettings.test.ts b/apps/desktop/src/settings/DesktopClientSettings.test.ts index 0dab1c8d83cc6..6ac78ab3e9cb2 100644 --- a/apps/desktop/src/settings/DesktopClientSettings.test.ts +++ b/apps/desktop/src/settings/DesktopClientSettings.test.ts @@ -50,6 +50,7 @@ const clientSettings: ClientSettings = { fontSizeTerminal: 12, fontSmoothing: true, glassOpacity: 80, + historySwipeNavigation: false, onboardingCompletedAt: null, panelAnimationDurationMs: 0, planModeEnabled: false, diff --git a/apps/web/src/components/AppSidebarLayout.tsx b/apps/web/src/components/AppSidebarLayout.tsx index 91df5616f7f50..59b38f0a8d5e6 100644 --- a/apps/web/src/components/AppSidebarLayout.tsx +++ b/apps/web/src/components/AppSidebarLayout.tsx @@ -31,7 +31,7 @@ import { selectActiveRightPanel, useRightPanelStore } from "../rightPanelStore"; import { selectThreadTerminalUiState, useTerminalUiStateStore } from "../terminalUiStateStore"; import { cn, isMacPlatform } from "../lib/utils"; import { primaryServerKeybindingsAtom } from "../state/server"; -import { useEnvironmentIdentificationMode } from "../hooks/useSettings"; +import { useClientSettings, useEnvironmentIdentificationMode } from "../hooks/useSettings"; import { PanelAnimationSuppressionProvider, usePanelAnimationSettings, @@ -413,6 +413,7 @@ export function AppSidebarLayout({ children }: { children: ReactNode }) { const panelAnimationsSuppressed = usePanelNavigationSuppression(pathname); const routePanelAnimationsActive = panelAnimationsActive && !panelAnimationsSuppressed; const isMacosDesktop = isElectron && isMacPlatform(navigator.platform); + const historySwipeNavigation = useClientSettings((settings) => settings.historySwipeNavigation); const [sidebarWidth, setSidebarWidth] = useState(readInitialThreadSidebarWidth); // A clamped drag may not change width, so viewport changes need a separate subscription. const viewportWidth = useSyncExternalStore(subscribeToViewportWidth, readViewportWidth); @@ -475,7 +476,7 @@ export function AppSidebarLayout({ children }: { children: ReactNode }) { {children} - {isElectron ? : null} + {isElectron && historySwipeNavigation ? : null} ); diff --git a/apps/web/src/components/settings/SettingsPanels.tsx b/apps/web/src/components/settings/SettingsPanels.tsx index d408d6c8d5d94..759031bc35e52 100644 --- a/apps/web/src/components/settings/SettingsPanels.tsx +++ b/apps/web/src/components/settings/SettingsPanels.tsx @@ -468,6 +468,9 @@ export function useSettingsRestore(onRestored?: () => void) { ...(settings.timestampFormat !== DEFAULT_UNIFIED_SETTINGS.timestampFormat ? ["Time format"] : []), + ...(settings.historySwipeNavigation !== DEFAULT_UNIFIED_SETTINGS.historySwipeNavigation + ? ["Swipe to navigate"] + : []), ...(settings.notificationMode !== DEFAULT_UNIFIED_SETTINGS.notificationMode ? ["Thread notifications"] : []), @@ -633,6 +636,7 @@ export function useSettingsRestore(onRestored?: () => void) { effortDisplay: DEFAULT_UNIFIED_SETTINGS.effortDisplay, mathRenderingEnabled: DEFAULT_UNIFIED_SETTINGS.mathRenderingEnabled, timestampFormat: DEFAULT_UNIFIED_SETTINGS.timestampFormat, + historySwipeNavigation: DEFAULT_UNIFIED_SETTINGS.historySwipeNavigation, notificationMode: DEFAULT_UNIFIED_SETTINGS.notificationMode, inAppNotificationsEnabled: DEFAULT_UNIFIED_SETTINGS.inAppNotificationsEnabled, wordWrap: DEFAULT_UNIFIED_SETTINGS.wordWrap, @@ -1071,6 +1075,31 @@ export function GeneralSettingsPanel() { } /> + + updateSettings({ + historySwipeNavigation: DEFAULT_UNIFIED_SETTINGS.historySwipeNavigation, + }) + } + /> + ) : null + } + control={ + + updateSettings({ historySwipeNavigation: Boolean(checked) }) + } + aria-label="Swipe to navigate" + /> + } + /> ); diff --git a/apps/web/src/components/settings/settingsSearch.ts b/apps/web/src/components/settings/settingsSearch.ts index 23d32bb35e9c2..220277f7ab5c4 100644 --- a/apps/web/src/components/settings/settingsSearch.ts +++ b/apps/web/src/components/settings/settingsSearch.ts @@ -545,6 +545,12 @@ export const SETTINGS_SEARCH_ITEMS = [ to: "/settings/general", searchTerms: ["timestamp clock locale system browser os 12 hour 24 hour"], }, + { + id: "history-swipe-navigation", + title: "Swipe to navigate", + to: "/settings/general", + searchTerms: ["trackpad two finger horizontal back forward history gesture desktop"], + }, { id: "response-streaming", title: "Response streaming", diff --git a/docs/user/keybindings.md b/docs/user/keybindings.md index 3654c0b3b04cd..031fa86855160 100644 --- a/docs/user/keybindings.md +++ b/docs/user/keybindings.md @@ -163,6 +163,8 @@ field gets its own undo back. Terminals always keep their native shortcut. `navigation.back` (`mod+[` by default) and `navigation.forward` (`mod+]`) move through the pages you have visited, like a browser's back and forward buttons. +In the desktop app, a two-finger sideways swipe on the trackpad does the same. Turn it off in +Settings > General > Display > Swipe to navigate. `chat.new` may ask you to choose a project when there is more than one. `chat.newLocal` skips that chooser. Both use your diff --git a/packages/contracts/src/settings.test.ts b/packages/contracts/src/settings.test.ts index 4ff7d2c9618f2..fa22b2d0ba3c0 100644 --- a/packages/contracts/src/settings.test.ts +++ b/packages/contracts/src/settings.test.ts @@ -311,6 +311,21 @@ describe("ClientSettings notifications", () => { }); }); +describe("ClientSettings history swipe navigation", () => { + it("stays on for existing settings that omit it", () => { + expect(decodeClientSettings({}).historySwipeNavigation).toBe(true); + expect(decodeClientSettingsPatch({})).not.toHaveProperty("historySwipeNavigation"); + }); + + it("round-trips an explicit opt-out", () => { + expect( + decodeClientSettingsPatch({ historySwipeNavigation: false }).historySwipeNavigation, + ).toBe(false); + const settings = decodeClientSettings({ historySwipeNavigation: false }); + expect(encodeClientSettings(settings).historySwipeNavigation).toBe(false); + }); +}); + describe("ClientSettings quit confirmation", () => { it.each([ [true, "hold"], diff --git a/packages/contracts/src/settings.ts b/packages/contracts/src/settings.ts index a726135bcca8b..7c85e64428f4a 100644 --- a/packages/contracts/src/settings.ts +++ b/packages/contracts/src/settings.ts @@ -428,6 +428,7 @@ export const ClientSettingsSchema = Schema.Struct({ glassOpacity: GlassOpacity.pipe( Schema.withDecodingDefault(Effect.succeed(DEFAULT_GLASS_OPACITY)), ), + historySwipeNavigation: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(true))), fontSizeInterface: InterfaceFontSize.pipe( Schema.withDecodingDefault(Effect.succeed(DEFAULT_INTERFACE_FONT_SIZE)), ), @@ -1794,6 +1795,7 @@ export const ClientSettingsPatch = Schema.Struct({ diffLayout: Schema.optionalKey(DiffLayout), environmentIdentificationMode: Schema.optionalKey(EnvironmentIdentificationMode), glassOpacity: Schema.optionalKey(GlassOpacity), + historySwipeNavigation: Schema.optionalKey(Schema.Boolean), onboardingCompletedAt: Schema.optionalKey(Schema.NullOr(Schema.String)), fontSizeInterface: Schema.optionalKey(InterfaceFontSize), fontSizePrompt: Schema.optionalKey(PromptFontSize), From be13fec695a50e5e9b92aa1af16288272caabbfa Mon Sep 17 00:00:00 2001 From: maria-rcks Date: Tue, 10 Nov 2026 07:14:37 +0000 Subject: [PATCH 2/2] fix(web): show the swipe navigation setting only in the desktop app --- .../components/settings/SettingsPanels.tsx | 49 ++++++++++--------- .../src/components/settings/settingsSearch.ts | 1 + 2 files changed, 27 insertions(+), 23 deletions(-) diff --git a/apps/web/src/components/settings/SettingsPanels.tsx b/apps/web/src/components/settings/SettingsPanels.tsx index 2add391ecacdf..0fe60beae3fae 100644 --- a/apps/web/src/components/settings/SettingsPanels.tsx +++ b/apps/web/src/components/settings/SettingsPanels.tsx @@ -1047,31 +1047,34 @@ export function GeneralSettingsPanel() { } /> - - updateSettings({ - historySwipeNavigation: DEFAULT_UNIFIED_SETTINGS.historySwipeNavigation, - }) + {isElectron ? ( + + updateSettings({ + historySwipeNavigation: DEFAULT_UNIFIED_SETTINGS.historySwipeNavigation, + }) + } + /> + ) : null + } + control={ + + updateSettings({ historySwipeNavigation: Boolean(checked) }) } + aria-label="Swipe to navigate" /> - ) : null - } - control={ - - updateSettings({ historySwipeNavigation: Boolean(checked) }) - } - aria-label="Swipe to navigate" - /> - } - /> + } + /> + ) : null} ); diff --git a/apps/web/src/components/settings/settingsSearch.ts b/apps/web/src/components/settings/settingsSearch.ts index b1d4802dd656e..9c028a4ffa32e 100644 --- a/apps/web/src/components/settings/settingsSearch.ts +++ b/apps/web/src/components/settings/settingsSearch.ts @@ -681,6 +681,7 @@ export const SETTINGS_SEARCH_ITEMS = [ title: "Swipe to navigate", to: "/settings/general", searchTerms: ["trackpad two finger horizontal back forward history gesture desktop"], + desktopOnly: true, }, { id: "response-streaming",