Skip to content

Commit 33e90c8

Browse files
committed
Add custom title bar
It's about 4px narrower than the original one, so we gained some space and got more control over that content area.
1 parent 8117300 commit 33e90c8

6 files changed

Lines changed: 95 additions & 20 deletions

File tree

apps/desktop/src-tauri/capabilities/default.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
],
88
"permissions": [
99
"core:default",
10+
"core:window:allow-start-dragging",
1011
"opener:default",
1112
{
1213
"identifier": "opener:allow-open-path",

apps/desktop/src-tauri/tauri.conf.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@
1818
"height": 720,
1919
"minWidth": 950,
2020
"minHeight": 550,
21-
"visible": false
21+
"visible": false,
22+
"titleBarStyle": "Overlay",
23+
"trafficLightPosition": { "x": 9, "y": 17 },
24+
"hiddenTitle": true
2225
}
2326
],
2427
"security": {

apps/desktop/src/app.css

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -325,9 +325,9 @@ body {
325325
font-size: var(--font-size-base);
326326
}
327327

328-
#app {
329-
width: 100%;
330-
height: 100%;
328+
body {
329+
display: flex;
330+
flex-direction: column;
331331
}
332332

333333
/* Disable scroll bounce on all scrollable elements */

apps/desktop/src/lib/file-explorer/VolumeBreadcrumb.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@
336336
cursor: default;
337337
font-weight: 500;
338338
color: var(--color-text-primary);
339-
padding: 1px 4px;
339+
padding: 2px 4px;
340340
border-radius: 4px;
341341
display: inline-flex;
342342
align-items: center;

apps/desktop/src/routes/+layout.svelte

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,15 @@
1616
</script>
1717

1818
<UpdateNotification />
19-
<slot />
19+
<div class="page-wrapper">
20+
<slot />
21+
</div>
22+
23+
<style>
24+
.page-wrapper {
25+
display: flex;
26+
flex-direction: column;
27+
flex: 1;
28+
min-height: 0;
29+
}
30+
</style>

apps/desktop/src/routes/+page.svelte

Lines changed: 74 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
getInfo,
1818
toggleHiddenFiles,
1919
setViewMode,
20+
getWindowTitle,
2021
} from '$lib/tauri-commands'
2122
import { loadSettings, saveSettings } from '$lib/settings-store'
2223
import { hideExpirationModal, loadLicenseStatus, triggerValidationIfNeeded } from '$lib/licensing-store.svelte'
@@ -48,6 +49,7 @@
4849
let showAboutWindow = $state(false)
4950
let showCommandPalette = $state(false)
5051
let explorerRef: ExplorerAPI | undefined = $state()
52+
let windowTitle = $state('Cmdr')
5153
5254
// Event handlers stored for cleanup
5355
let handleKeyDown: ((e: KeyboardEvent) => void) | undefined
@@ -56,6 +58,19 @@
5658
let unlistenCommandPalette: UnlistenFn | undefined
5759
let unlistenSwitchPane: UnlistenFn | undefined
5860
61+
/** Start window drag when title bar is clicked */
62+
async function handleTitleBarMouseDown(e: MouseEvent) {
63+
if (e.buttons === 1) {
64+
// Left mouse button
65+
try {
66+
const { getCurrentWindow } = await import('@tauri-apps/api/window')
67+
await getCurrentWindow().startDragging()
68+
} catch {
69+
// Not in Tauri environment
70+
}
71+
}
72+
}
73+
5974
onMount(async () => {
6075
// Hide loading screen
6176
const loadingScreen = document.getElementById('loading-screen')
@@ -79,6 +94,9 @@
7994
expiredOrgName = licenseStatus.organizationName
8095
expiredAt = licenseStatus.expiredAt
8196
}
97+
98+
// Load window title based on license status
99+
windowTitle = await getWindowTitle()
82100
} catch {
83101
// License check failed (expected in E2E tests without Tauri backend)
84102
// App continues without license features
@@ -476,20 +494,62 @@
476494
}
477495
</script>
478496

479-
{#if showAboutWindow}
480-
<AboutWindow onClose={handleAboutClose} />
481-
{/if}
497+
<div class="page-container">
498+
<!-- svelte-ignore a11y_no_static_element_interactions -->
499+
<div class="title-bar" onmousedown={handleTitleBarMouseDown}>
500+
<span class="title-text">{windowTitle}</span>
501+
</div>
502+
503+
<div class="main-content">
504+
{#if showAboutWindow}
505+
<AboutWindow onClose={handleAboutClose} />
506+
{/if}
507+
508+
{#if showCommandPalette}
509+
<CommandPalette onExecute={handleCommandExecute} onClose={handleCommandPaletteClose} />
510+
{/if}
511+
512+
{#if showExpiredModal}
513+
<ExpirationModal organizationName={expiredOrgName} {expiredAt} onClose={handleExpirationModalClose} />
514+
{/if}
515+
516+
{#if showFdaPrompt}
517+
<FullDiskAccessPrompt onComplete={handleFdaComplete} wasRevoked={fdaWasRevoked} />
518+
{:else if showApp}
519+
<DualPaneExplorer bind:this={explorerRef} />
520+
{/if}
521+
</div>
522+
</div>
523+
524+
<style>
525+
.page-container {
526+
display: flex;
527+
flex-direction: column;
528+
flex: 1;
529+
min-height: 0;
530+
}
482531
483-
{#if showCommandPalette}
484-
<CommandPalette onExecute={handleCommandExecute} onClose={handleCommandPaletteClose} />
485-
{/if}
532+
.title-bar {
533+
height: 27px;
534+
display: flex;
535+
align-items: center;
536+
justify-content: center;
537+
padding-top: 2px;
538+
background-color: var(--color-bg-secondary);
539+
flex-shrink: 0;
540+
}
486541
487-
{#if showExpiredModal}
488-
<ExpirationModal organizationName={expiredOrgName} {expiredAt} onClose={handleExpirationModalClose} />
489-
{/if}
542+
.title-text {
543+
font-size: var(--font-size-xs);
544+
color: var(--color-text-secondary);
545+
font-weight: 500;
546+
}
490547
491-
{#if showFdaPrompt}
492-
<FullDiskAccessPrompt onComplete={handleFdaComplete} wasRevoked={fdaWasRevoked} />
493-
{:else if showApp}
494-
<DualPaneExplorer bind:this={explorerRef} />
495-
{/if}
548+
.main-content {
549+
flex: 1;
550+
display: flex;
551+
flex-direction: column;
552+
overflow: hidden;
553+
min-height: 0;
554+
}
555+
</style>

0 commit comments

Comments
 (0)