Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
fix(client): scope the title bar overlay height to Linux
Elian Doran1c53c60c8f19
diff --git a/apps/client/src/services/native_window.ts b/apps/client/src/services/native_window.tsindex 59eaee9b43..82a2615b54 100644--- a/apps/client/src/services/native_window.ts+++ b/apps/client/src/services/native_window.ts@@ -65,7 +65,9 @@ function applyTransparencyEffects(win: ElectronWindowApi, style: CSSStyleDeclara}function applyTitleBarButtons(win: ElectronWindowApi, style: CSSStyleDeclaration) {- // Window Controls Overlay is supported on Windows and Linux.+ // Window Controls Overlay is supported on Windows and Linux. The height is opt-in: themes only+ // set --native-titlebar-height where the buttons need repositioning (currently Linux), and+ // leaving it unset keeps Chromium's system caption height.if (window.glob.platform === "win32" || window.glob.platform === "linux") {const color = style.getPropertyValue("--native-titlebar-background");const symbolColor = style.getPropertyValue("--native-titlebar-foreground");diff --git a/apps/client/src/stylesheets/style.css b/apps/client/src/stylesheets/style.cssindex 029f49d932..3b7e9a4a71 100644--- a/apps/client/src/stylesheets/style.css+++ b/apps/client/src/stylesheets/style.css@@ -87,14 +87,6 @@ body {font-size: var(--main-font-size);--native-titlebar-foreground: var(--main-text-color);- /*- * Height of the Window Controls Overlay on Windows and Linux. Chromium centres the caption- * buttons within it, so this is the only way to shift them vertically -- there is no x/y- * equivalent to macOS' setWindowButtonPosition(). Set it to twice the centre line of the tab- * bar's own buttons so the two line up; themes that place those buttons differently (see- * theme-next) need their own value.- */- --native-titlebar-height: 40;--native-titlebar-darwin-x-offset: 10;--native-titlebar-darwin-y-offset: 12;--launcher-pane-height: 53px;@@ -102,6 +94,21 @@ body {--mobile-bottom-offset: env(safe-area-inset-bottom);}+/*+ * Height of the Window Controls Overlay. Chromium centres the caption buttons within it, so this+ * is the only way to shift them vertically -- there is no x/y equivalent to macOS'+ * setWindowButtonPosition(). Set it to twice the centre line of the tab bar's own buttons so the+ * two line up; themes that place those buttons differently (see theme-next) need their own value.+ *+ * Scoped to Linux on purpose. Windows also supports the overlay, but leaving the variable unset+ * there keeps Chromium's system caption height, whose taller hover fills would otherwise spill+ * past the tab bar. Dropping the scope is fine once the result has actually been looked at on+ * Windows.+ */+body.platform-linux {+ --native-titlebar-height: 40;+}+body.ios {--mobile-bottom-offset: calc(env(safe-area-inset-bottom) * 0.25);}diff --git a/apps/client/src/stylesheets/theme-next/shell.css b/apps/client/src/stylesheets/theme-next/shell.cssindex 87bdf933bb..1d3b47b9dd 100644--- a/apps/client/src/stylesheets/theme-next/shell.css+++ b/apps/client/src/stylesheets/theme-next/shell.css@@ -21,23 +21,29 @@ body.mobile #root-widget {}body {- /*- * The Windows / Linux caption buttons are centred within the overlay, so its height has to be- * twice the centre line of the tab bar's own buttons for the two to line up. Those buttons are- * top-aligned (`margin: 3px ... auto ...` below), so the centre line follows the tab bar- * height: 3 + 30/2 = 18 here, and 26 in the taller horizontal layout.- */- --native-titlebar-height: 36 !important;--native-titlebar-darwin-x-offset: 10;--native-titlebar-darwin-y-offset: 12 !important;}+/*+ * The caption buttons are centred within the overlay, so its height has to be twice the centre+ * line of the tab bar's own buttons for the two to line up. Those buttons are top-aligned+ * (`margin: 3px ... auto ...` below), so the centre line follows the tab bar height: 3 + 30/2 = 18+ * here, and 26 in the taller horizontal layout. Linux-only, as in the base stylesheet.+ */+body.platform-linux {+ --native-titlebar-height: 36 !important;+}++body.platform-linux.layout-horizontal {+ --native-titlebar-height: 52 !important;+}+body.layout-horizontal {--active-tab-background-color: var(--launcher-pane-horiz-background-color);--active-tab-hover-background-color: var(--active-tab-background-color);--new-tab-button-background: transparent;--tab-bar-height: 44px;- --native-titlebar-height: 52 !important;--native-titlebar-darwin-x-offset: 12;--native-titlebar-darwin-y-offset: 14 !important;}