mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-08-10 10:22:29 +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');
|
||||
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);
|
||||
}
|
||||
}
|
@ -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#initTransparencyEffects
|
||||
const isHorizontalLayout = (optionService.getOption("layoutOrientation") === "horizontal");
|
||||
extraOpts.backgroundMaterial = isHorizontalLayout ? "tabbed" : "mica";
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user