Add macOS native titlebar support

This commit is contained in:
Yuri Karamian
2026-02-13 01:30:10 +01:00
parent 6dfea864f3
commit ea323e508b
3 changed files with 33 additions and 2 deletions
+9 -1
View File
@@ -7,6 +7,7 @@
} = $props();
const appWindow = getCurrentWindow();
const isMac = navigator.platform.startsWith('Mac');
let maximized = $state(false);
async function checkMaximized() {
@@ -59,7 +60,7 @@
</script>
<!-- svelte-ignore a11y_no_static_element_interactions -->
<div class="titlebar" onmousedown={handleMouseDown}>
<div class="titlebar" class:macos={isMac} onmousedown={handleMouseDown}>
<div class="titlebar-brand">
<svg width="18" height="18" viewBox="0 0 48 48" fill="none">
<rect width="48" height="48" rx="12" fill="var(--accent)" />
@@ -96,6 +97,7 @@
New Note
</button>
</div>
{#if !isMac}
<div class="titlebar-controls">
<button class="titlebar-btn" onclick={minimize} title="Minimize">
<svg width="10" height="10" viewBox="0 0 10 10">
@@ -121,6 +123,7 @@
</svg>
</button>
</div>
{/if}
</div>
<style>
@@ -252,4 +255,9 @@
background: #e81123;
color: white;
}
/* macOS: add left padding for native traffic light buttons */
.titlebar.macos .titlebar-brand {
padding-left: 78px;
}
</style>