Skip to content

Commit fa9674e

Browse files
committed
feat(app): add more titlebar visibility settings
1 parent f45e084 commit fa9674e

5 files changed

Lines changed: 75 additions & 29 deletions

File tree

packages/app/src/components/session/session-header.tsx

Lines changed: 31 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ export function SessionHeader() {
153153
})
154154
const hotkey = createMemo(() => command.keybind("file.open"))
155155
const os = createMemo(() => detectOS(platform))
156+
const search = createMemo(() => platform.platform !== "desktop" || settings.general.showSearch())
156157
const tree = createMemo(() => platform.platform !== "desktop" || settings.general.showFileTree())
157158
const term = createMemo(() => platform.platform !== "desktop" || settings.general.showTerminal())
158159
const status = createMemo(() => platform.platform !== "desktop" || settings.general.showStatus())
@@ -272,35 +273,37 @@ export function SessionHeader() {
272273

273274
return (
274275
<>
275-
<Show when={centerMount()}>
276-
{(mount) => (
277-
<Portal mount={mount()}>
278-
<Button
279-
type="button"
280-
variant="ghost"
281-
size="small"
282-
class="hidden md:flex w-[240px] max-w-full min-w-0 items-center gap-2 justify-between rounded-md border border-border-weak-base bg-surface-panel shadow-none cursor-default"
283-
onClick={() => command.trigger("file.open")}
284-
aria-label={language.t("session.header.searchFiles")}
285-
>
286-
<div class="flex min-w-0 flex-1 items-center overflow-visible">
287-
<span class="flex-1 min-w-0 text-12-regular text-text-weak truncate text-left">
288-
{language.t("session.header.search.placeholder", {
289-
project: name(),
290-
})}
291-
</span>
292-
</div>
276+
<Show when={search()}>
277+
<Show when={centerMount()}>
278+
{(mount) => (
279+
<Portal mount={mount()}>
280+
<Button
281+
type="button"
282+
variant="ghost"
283+
size="small"
284+
class="hidden md:flex w-[240px] max-w-full min-w-0 items-center gap-2 justify-between rounded-md border border-border-weak-base bg-surface-panel shadow-none cursor-default"
285+
onClick={() => command.trigger("file.open")}
286+
aria-label={language.t("session.header.searchFiles")}
287+
>
288+
<div class="flex min-w-0 flex-1 items-center overflow-visible">
289+
<span class="flex-1 min-w-0 text-12-regular text-text-weak truncate text-left">
290+
{language.t("session.header.search.placeholder", {
291+
project: name(),
292+
})}
293+
</span>
294+
</div>
293295

294-
<Show when={hotkey()}>
295-
{(keybind) => (
296-
<Keybind class="shrink-0 !border-0 !bg-transparent !shadow-none px-0 text-text-weaker">
297-
{keybind()}
298-
</Keybind>
299-
)}
300-
</Show>
301-
</Button>
302-
</Portal>
303-
)}
296+
<Show when={hotkey()}>
297+
{(keybind) => (
298+
<Keybind class="shrink-0 !border-0 !bg-transparent !shadow-none px-0 text-text-weaker">
299+
{keybind()}
300+
</Keybind>
301+
)}
302+
</Show>
303+
</Button>
304+
</Portal>
305+
)}
306+
</Show>
304307
</Show>
305308
<Show when={rightMount()}>
306309
{(mount) => (

packages/app/src/components/settings-general.tsx

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,30 @@ export const SettingsGeneral: Component = () => {
294294
</div>
295295
</SettingsRow>
296296

297+
<SettingsRow
298+
title={language.t("settings.general.row.showNavigation.title")}
299+
description={language.t("settings.general.row.showNavigation.description")}
300+
>
301+
<div data-action="settings-show-navigation">
302+
<Switch
303+
checked={settings.general.showNavigation()}
304+
onChange={(checked) => settings.general.setShowNavigation(checked)}
305+
/>
306+
</div>
307+
</SettingsRow>
308+
309+
<SettingsRow
310+
title={language.t("settings.general.row.showSearch.title")}
311+
description={language.t("settings.general.row.showSearch.description")}
312+
>
313+
<div data-action="settings-show-search">
314+
<Switch
315+
checked={settings.general.showSearch()}
316+
onChange={(checked) => settings.general.setShowSearch(checked)}
317+
/>
318+
</div>
319+
</SettingsRow>
320+
297321
<SettingsRow
298322
title={language.t("settings.general.row.showTerminal.title")}
299323
description={language.t("settings.general.row.showTerminal.description")}

packages/app/src/components/titlebar.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { useLayout } from "@/context/layout"
1111
import { usePlatform } from "@/context/platform"
1212
import { useCommand } from "@/context/command"
1313
import { useLanguage } from "@/context/language"
14+
import { useSettings } from "@/context/settings"
1415
import { applyPath, backPath, forwardPath } from "./titlebar-history"
1516

1617
type TauriDesktopWindow = {
@@ -40,6 +41,7 @@ export function Titlebar() {
4041
const platform = usePlatform()
4142
const command = useCommand()
4243
const language = useLanguage()
44+
const settings = useSettings()
4345
const theme = useTheme()
4446
const navigate = useNavigate()
4547
const location = useLocation()
@@ -78,6 +80,7 @@ export function Titlebar() {
7880
const canBack = createMemo(() => history.index > 0)
7981
const canForward = createMemo(() => history.index < history.stack.length - 1)
8082
const hasProjects = createMemo(() => layout.projects.list().length > 0)
83+
const nav = createMemo(() => platform.platform !== "desktop" || settings.general.showNavigation())
8184

8285
const back = () => {
8386
const next = backPath(history)
@@ -252,7 +255,7 @@ export function Titlebar() {
252255
</div>
253256
</div>
254257
</Show>
255-
<Show when={hasProjects()}>
258+
<Show when={hasProjects() && nav()}>
256259
<div
257260
class="flex items-center gap-0 transition-transform"
258261
classList={{

packages/app/src/context/settings.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ export interface Settings {
2424
releaseNotes: boolean
2525
followup: "queue" | "steer"
2626
showFileTree: boolean
27+
showNavigation: boolean
28+
showSearch: boolean
2729
showStatus: boolean
2830
showTerminal: boolean
2931
showReasoningSummaries: boolean
@@ -51,6 +53,8 @@ const defaultSettings: Settings = {
5153
releaseNotes: true,
5254
followup: "steer",
5355
showFileTree: false,
56+
showNavigation: false,
57+
showSearch: false,
5458
showStatus: false,
5559
showTerminal: false,
5660
showReasoningSummaries: false,
@@ -153,6 +157,14 @@ export const { use: useSettings, provider: SettingsProvider } = createSimpleCont
153157
setShowFileTree(value: boolean) {
154158
setStore("general", "showFileTree", value)
155159
},
160+
showNavigation: withFallback(() => store.general?.showNavigation, defaultSettings.general.showNavigation),
161+
setShowNavigation(value: boolean) {
162+
setStore("general", "showNavigation", value)
163+
},
164+
showSearch: withFallback(() => store.general?.showSearch, defaultSettings.general.showSearch),
165+
setShowSearch(value: boolean) {
166+
setStore("general", "showSearch", value)
167+
},
156168
showStatus: withFallback(() => store.general?.showStatus, defaultSettings.general.showStatus),
157169
setShowStatus(value: boolean) {
158170
setStore("general", "showStatus", value)

packages/app/src/i18n/en.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -738,6 +738,10 @@ export const dict = {
738738
"settings.general.row.followup.option.steer": "Steer",
739739
"settings.general.row.showFileTree.title": "File tree",
740740
"settings.general.row.showFileTree.description": "Show the file tree toggle and panel in desktop sessions",
741+
"settings.general.row.showNavigation.title": "Navigation controls",
742+
"settings.general.row.showNavigation.description": "Show the back and forward buttons in the desktop title bar",
743+
"settings.general.row.showSearch.title": "Command palette",
744+
"settings.general.row.showSearch.description": "Show the search and command palette button in the desktop title bar",
741745
"settings.general.row.showTerminal.title": "Terminal",
742746
"settings.general.row.showTerminal.description": "Show the terminal button in the desktop title bar",
743747
"settings.general.row.showStatus.title": "Server status",

0 commit comments

Comments
 (0)