From ef6410f25d62ef1fb6f143abaff93bd3a05004d1 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Fri, 6 Dec 2024 22:18:26 +0200 Subject: [PATCH] fix(native-buttons): runtime errors due to missing functions --- src/public/app/desktop.js | 13 +++++++------ src/public/app/layouts/desktop_layout.js | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/public/app/desktop.js b/src/public/app/desktop.js index cbd5b6f79..c07040a24 100644 --- a/src/public/app/desktop.js +++ b/src/public/app/desktop.js @@ -62,15 +62,16 @@ function initTitleBarButtons() { const color = style.getPropertyValue("--native-titlebar-background"); const symbolColor = style.getPropertyValue("--native-titlebar-foreground"); - if (color && symbolColor) { - // FIXME, do this only on windows - // currentWindow.setTitleBarOverlay({ color, symbolColor }); + if (window.glob.platform === "win32" && color && symbolColor) { + currentWindow.setTitleBarOverlay({ color, symbolColor }); } // FIXME: call only on darwin - const xOffset = parseInt(style.getPropertyValue("--native-titlebar-darwin-x-offset"), 10); - const yOffset = parseInt(style.getPropertyValue("--native-titlebar-darwin-y-offset"), 10); - currentWindow.setWindowButtonPosition({ x: xOffset, y: yOffset }); + if (window.glob.platform === "darwin") { + const xOffset = parseInt(style.getPropertyValue("--native-titlebar-darwin-x-offset"), 10); + const yOffset = parseInt(style.getPropertyValue("--native-titlebar-darwin-y-offset"), 10); + currentWindow.setWindowButtonPosition({ x: xOffset, y: yOffset }); + } } // Update the native title bar buttons. diff --git a/src/public/app/layouts/desktop_layout.js b/src/public/app/layouts/desktop_layout.js index fff7b0fbc..b9d20feae 100644 --- a/src/public/app/layouts/desktop_layout.js +++ b/src/public/app/layouts/desktop_layout.js @@ -96,7 +96,7 @@ export default class DesktopLayout { const launcherPaneIsHorizontal = (options.get("layoutOrientation") === "horizontal"); const launcherPane = this.#buildLauncherPane(launcherPaneIsHorizontal); const isMac = (window.glob.platform === "darwin"); - const isWindows = (window.glob.platform === "windows"); + const isWindows = (window.glob.platform === "win32"); const hasNativeTitleBar = (window.glob.hasNativeTitleBar); const fullWidthTabBar = (launcherPaneIsHorizontal && !isMac); const customTitleBarButtons = (hasNativeTitleBar && !isMac && !isWindows);