Skip to content

Build your personal knowledge base with Trilium Notes

fix(desktop): background effects causing issues on Win10

Elian Doran5d8f789791f6
diff --git a/apps/server/src/routes/index.ts b/apps/server/src/routes/index.ts
index b8deaf0568..528e9e83ee 100644
--- a/apps/server/src/routes/index.ts
+++ b/apps/server/src/routes/index.ts
@@ -5,7 +5,7 @@ import attributeService from "../services/attributes.js";
import config from "../services/config.js";
import optionService from "../services/options.js";
import log from "../services/log.js";
-import { isDev, isElectron, isWindows } from "../services/utils.js";
+import { isDev, isElectron, isWindows11 } from "../services/utils.js";
import protectedSessionService from "../services/protected_session.js";
import packageJson from "../../package.json" with { type: "json" };
import assetPath from "../services/asset_path.js";
@@ -42,7 +42,7 @@ function index(req: Request, res: Response) {
platform: process.platform,
isElectron,
hasNativeTitleBar: isElectron && options.nativeTitleBarVisible === "true",
- hasBackgroundEffects: isWindows && isElectron && options.backgroundEffects === "true",
+ hasBackgroundEffects: isElectron && isWindows11 && options.backgroundEffects === "true",
mainFontSize: parseInt(options.mainFontSize),
treeFontSize: parseInt(options.treeFontSize),
detailFontSize: parseInt(options.detailFontSize),
diff --git a/apps/server/src/services/utils.ts b/apps/server/src/services/utils.ts
index 8f9893dff4..78a8891c6f 100644
--- a/apps/server/src/services/utils.ts
+++ b/apps/server/src/services/utils.ts
@@ -12,6 +12,9 @@ import path from "path";
import type NoteMeta from "./meta/note_meta.js";
import log from "./log.js";
import { t } from "i18next";
+import { release as osRelease } from "os";
+
+const osVersion = osRelease().split('.').map(Number);
const randtoken = generator({ source: "crypto" });
@@ -19,6 +22,8 @@ export const isMac = process.platform === "darwin";
export const isWindows = process.platform === "win32";
+export const isWindows11 = isWindows && osVersion[0] === 10 && osVersion[2] >= 22000;
+
export const isElectron = !!process.versions["electron"];
export const isDev = !!(process.env.TRILIUM_ENV && process.env.TRILIUM_ENV === "dev");