mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-08-11 19:22:31 +08:00
fix(mica): apply correct mica when switching layouts
This commit is contained in:
parent
407448476b
commit
57d2b0ebf5
@ -48,14 +48,17 @@ function initOnElectron() {
|
|||||||
const electron = utils.dynamicRequire('electron');
|
const electron = utils.dynamicRequire('electron');
|
||||||
electron.ipcRenderer.on('globalShortcut', async (event, actionName) => appContext.triggerCommand(actionName));
|
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") {
|
if (options.get("nativeTitleBarVisible") !== "true") {
|
||||||
initTitleBarButtons();
|
initTitleBarButtons(currentWindow);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function initTitleBarButtons() {
|
function initTitleBarButtons(currentWindow) {
|
||||||
const electronRemote = utils.dynamicRequire("@electron/remote");
|
|
||||||
const currentWindow = electronRemote.getCurrentWindow();
|
|
||||||
const style = window.getComputedStyle(document.body);
|
const style = window.getComputedStyle(document.body);
|
||||||
|
|
||||||
if (window.glob.platform === "win32") {
|
if (window.glob.platform === "win32") {
|
||||||
@ -80,3 +83,11 @@ function initTitleBarButtons() {
|
|||||||
currentWindow.setWindowButtonPosition({ x: xOffset, y: yOffset });
|
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);
|
||||||
|
}
|
||||||
|
}
|
@ -132,7 +132,7 @@ function getWindowExtraOpts() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Window effects (Mica)
|
// 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#initTransparencyEffects
|
||||||
const isHorizontalLayout = (optionService.getOption("layoutOrientation") === "horizontal");
|
const isHorizontalLayout = (optionService.getOption("layoutOrientation") === "horizontal");
|
||||||
extraOpts.backgroundMaterial = isHorizontalLayout ? "tabbed" : "mica";
|
extraOpts.backgroundMaterial = isHorizontalLayout ? "tabbed" : "mica";
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user