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(mica): apply correct mica when switching layouts
Elian Doran57d2b0ebf59a
diff --git a/src/public/app/desktop.js b/src/public/app/desktop.jsindex bad74c6988..5cb52f1360 100644--- a/src/public/app/desktop.js+++ b/src/public/app/desktop.js@@ -48,14 +48,17 @@ function initOnElectron() {const electron = utils.dynamicRequire('electron');electron.ipcRenderer.on('globalShortcut', async (event, actionName) => appContext.triggerCommand(actionName));+ const electronRemote = utils.dynamicRequire("@electron/remote");+ const currentWindow = electronRemote.getCurrentWindow();++ initTransparencyEffects(currentWindow);+if (options.get("nativeTitleBarVisible") !== "true") {- initTitleBarButtons();- }+ initTitleBarButtons(currentWindow);+ }}-function initTitleBarButtons() {- const electronRemote = utils.dynamicRequire("@electron/remote");- const currentWindow = electronRemote.getCurrentWindow();+function initTitleBarButtons(currentWindow) {const style = window.getComputedStyle(document.body);if (window.glob.platform === "win32") {@@ -80,3 +83,11 @@ function initTitleBarButtons() {currentWindow.setWindowButtonPosition({ x: xOffset, y: yOffset });}}++function initTransparencyEffects(currentWindow) {+ if (window.glob.platform === "win32") {+ const isHorizontalLayout = (options.get("layoutOrientation") === "horizontal");+ const backgroundMaterial = isHorizontalLayout ? "tabbed" : "mica";+ currentWindow.setBackgroundMaterial(backgroundMaterial);+ }+}\ No newline at end of filediff --git a/src/services/window.ts b/src/services/window.tsindex 142ea3cd3b..1555d79ae1 100644--- a/src/services/window.ts+++ b/src/services/window.ts@@ -132,7 +132,7 @@ function getWindowExtraOpts() {}// Window effects (Mica)- // TODO: Apply only on Windows and allow the user to choose whether to activate it or not.+ // TODO: Deduplicate with src/public/app/desktop.js#initTransparencyEffectsconst isHorizontalLayout = (optionService.getOption("layoutOrientation") === "horizontal");extraOpts.backgroundMaterial = isHorizontalLayout ? "tabbed" : "mica";