feat: custom in-app titlebar with overlay window chrome

- macOS: titleBarStyle Overlay + hiddenTitle, traffic lights aligned with the header
- header itself is the titlebar: draggable regions, no native glass strip
- solid (not blurred) header surfaces once content scrolls
- keep traffic lights clear of controls on library/login/settings pages
This commit is contained in:
1xDed committed 2026-11-27 03:11:09 +03:00
1 parent 61ebc66127
commit 1c499f42ec
9 files changed
+51 -49

No files matched your search

+4 -1
View File
@@ -77,7 +77,10 @@
"label": "main", "label": "main",
"dragDropEnabled": false, "dragDropEnabled": false,
"backgroundColor": "#08001f", "backgroundColor": "#08001f",
"transparent": false "transparent": false,
"titleBarStyle": "Overlay",
"hiddenTitle": true,
"trafficLightPosition": { "x": 18, "y": 31 }
} }
], ],
"security": { "security": {
+15 -32
View File
@@ -1,50 +1,33 @@
.appBar { .appBar {
// Limit transitions to cheaper properties; avoid animating box-shadow directly // Custom titlebar: the app header itself sits at the very top of the window,
// under the native overlay titlebar (no native glass strip, no blur panels).
transition: background-color $transition-time-fast; transition: background-color $transition-time-fast;
padding: 0.8em ($page-margin - 1.7em); padding: 0.8em ($page-margin - 1.7em);
z-index: 999 !important; z-index: 999 !important;
top: 0 !important;
// Keep the left controls clear of the macOS traffic lights.
html.is-macos & {
padding-left: calc(#{$page-margin} - 1.7em + 72px);
}
.flex { .flex {
// Avoid animating padding; it causes layout reflow on each frame. // Avoid animating padding; it causes layout reflow on each frame.
transition: background-color $transition-time-fast; transition: background-color $transition-time-fast;
// Avoid using will-change: scroll-position; it can degrade performance when misused
// will-change: opacity, transform;
border-radius: 1000px; border-radius: 1000px;
position: relative; position: relative;
// Pseudo-element handles elevation shadow; we animate its opacity
&::after {
content: "";
position: absolute;
inset: -0.35em;
pointer-events: none;
border-radius: inherit;
@include glass-effect;
opacity: 0;
z-index: -1;
transition: all $transition-time-fast;
}
} }
// Inner content wrapper that we can scale without causing layout reflow // Solid, part-of-the-screen titlebar background once the page scrolls.
.flex-inner {
transform-origin: top center;
transition: transform $transition-time-fast;
}
&.elevated { &.elevated {
.flex { background-color: $clr-background-default !important;
&::after { border-bottom: 1px solid rgb(255 255 255 / 0.06);
opacity: 1; box-shadow: none !important;
} background-image: none !important;
backdrop-filter: none !important;
} }
// Apply a subtle scale to simulate shrink without layout changes
.flex-inner {
transform: scaleY(0.95);
}
}
&-avatar { &-avatar {
background: rgb(255 255 255 / 0.1) !important; background: rgb(255 255 255 / 0.1) !important;
&-icon { &-icon {
+4 -11
View File
@@ -2,7 +2,7 @@ import MuiAppBar from "@mui/material/AppBar";
import IconButton from "@mui/material/IconButton"; import IconButton from "@mui/material/IconButton";
import useScrollTrigger from "@mui/material/useScrollTrigger"; import useScrollTrigger from "@mui/material/useScrollTrigger";
import { useLocation, useNavigate } from "@tanstack/react-router"; import { useLocation, useNavigate } from "@tanstack/react-router";
import React, { useCallback, useMemo, useState } from "react"; import React, { useCallback, useState } from "react";
import "./appBar.scss"; import "./appBar.scss";
@@ -51,13 +51,6 @@ export const AppBar = () => {
const [showDrawer, setShowDrawer] = useState(false); const [showDrawer, setShowDrawer] = useState(false);
const appBarStyling = useMemo(() => {
return {
backgroundColor: "transparent",
paddingRight: "0 !important",
};
}, []);
const _handleNavigateToSearch = useCallback( const _handleNavigateToSearch = useCallback(
() => navigate({ to: "/search", search: { query: "" } }), () => navigate({ to: "/search", search: { query: "" } }),
[navigate], [navigate],
@@ -85,7 +78,7 @@ export const AppBar = () => {
return ( return (
<> <>
<MuiAppBar <MuiAppBar
style={appBarStyling} data-tauri-drag-region
className={ className={
trigger trigger
? "appBar flex flex-row flex-justify-spaced-between elevated" ? "appBar flex flex-row flex-justify-spaced-between elevated"
@@ -94,7 +87,7 @@ export const AppBar = () => {
elevation={0} elevation={0}
color="transparent" color="transparent"
> >
<div className="flex flex-row" style={{ gap: "0.6em" }}> <div className="flex flex-row" data-tauri-drag-region style={{ gap: "0.6em" }}>
<IconButton onClick={handleDrawerOpen}> <IconButton onClick={handleDrawerOpen}>
<span className="material-symbols-rounded">menu</span> <span className="material-symbols-rounded">menu</span>
</IconButton> </IconButton>
@@ -112,7 +105,7 @@ export const AppBar = () => {
</IconButton> </IconButton>
</div> </div>
<div className="flex flex-row" style={{ gap: "0.6em" }}> <div className="flex flex-row" data-tauri-drag-region style={{ gap: "0.6em" }}>
<IconButton onClick={toggleSearchDialog}> <IconButton onClick={toggleSearchDialog}>
<span className="material-symbols-rounded">search</span> <span className="material-symbols-rounded">search</span>
</IconButton> </IconButton>
+2 -1
View File
@@ -258,6 +258,7 @@ export const LibraryHeader = () => {
return ( return (
<> <>
<AppBar <AppBar
data-tauri-drag-region
className={ className={
scrollTrigger scrollTrigger
? "library-header scrolling flex flex-row" ? "library-header scrolling flex flex-row"
@@ -267,7 +268,7 @@ export const LibraryHeader = () => {
elevation={0} elevation={0}
color="transparent" color="transparent"
> >
<div className="flex flex-row" style={{ gap: "0.6em" }}> <div className="flex flex-row" data-tauri-drag-region style={{ gap: "0.6em" }}>
<IconButton onClick={handleDrawerOpen}> <IconButton onClick={handleDrawerOpen}>
<div className="material-symbols-rounded">menu</div> <div className="material-symbols-rounded">menu</div>
</IconButton> </IconButton>
@@ -12,16 +12,28 @@
padding: 0.25em !important; padding: 0.25em !important;
transition: all 0.2s ease-in-out; transition: all 0.2s ease-in-out;
html.is-macos & {
// The window has an overlay titlebar: keep controls clear of the traffic lights
// without pushing the right-hand actions out of the viewport.
padding-left: 72px !important;
width: calc(100vw - 4em - 72px) !important;
left: calc(2em + 72px) !important;
right: 2em !important;
}
&::after { &::after {
content: ""; content: "";
position: absolute; position: absolute;
inset: -0.35em; inset: -0.35em;
pointer-events: none; pointer-events: none;
border-radius: inherit; border-radius: inherit;
@include glass-effect; // Solid titlebar surface: no glass/blur.
background-color: $clr-background-default;
border: 1px solid rgb(255 255 255 / 0.08);
box-shadow: 0 4px 20px rgb(0 0 0 / 0.4);
opacity: 0; opacity: 0;
z-index: -1; z-index: -1;
transition: all 150ms; transition: opacity 150ms;
} }
&.scrolling { &.scrolling {
&::after { &::after {
+1 -1
View File
@@ -51,7 +51,7 @@ const LoginShell = ({
const serverHost = api?.basePath.replace(/^https?:\/\//, ""); const serverHost = api?.basePath.replace(/^https?:\/\//, "");
return ( return (
<div className="login-shell scrollY"> <div className="login-shell scrollY" data-tauri-drag-region>
<div className={`login-shell-content login-shell-${width}`}> <div className={`login-shell-content login-shell-${width}`}>
{serverHost && ( {serverHost && (
<div className="login-shell-server"> <div className="login-shell-server">
+5
View File
@@ -95,6 +95,11 @@ function ProviderWrapper() {
} }
const init = async () => { const init = async () => {
// The window is frameless-ish on macOS (overlay titlebar): the app header is the titlebar.
if (navigator.userAgent.includes("Macintosh")) {
document.documentElement.classList.add("is-macos");
}
const initialApi = await initializeApi(); const initialApi = await initializeApi();
ReactDOM.createRoot(document.getElementById("root")!).render( ReactDOM.createRoot(document.getElementById("root")!).render(
+5
View File
@@ -62,6 +62,11 @@
padding: 1.5em 1em; // Reduced padding padding: 1.5em 1em; // Reduced padding
gap: 1em; // Reduced gap gap: 1em; // Reduced gap
html.is-macos & {
// Overlay titlebar: leave room for the traffic lights.
padding-top: 2.9em;
}
&-controls { &-controls {
display: flex; display: flex;
align-items: center; align-items: center;
+1 -1
View File
@@ -26,7 +26,7 @@ function SettingsRoute() {
navigate({ to: "/home" }); navigate({ to: "/home" });
}, []); }, []);
return ( return (
<div className="settings-page-container"> <div className="settings-page-container" data-tauri-drag-region>
<div className="settings-sidebar"> <div className="settings-sidebar">
<div className="settings-sidebar-controls"> <div className="settings-sidebar-controls">
<BackButton /> <BackButton />