An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: Improve Linux Wayland compatibility https://github.com/siyuan-note/siyuan/issues/17141
Daniel0080deca3273
diff --git a/app/electron/main.js b/app/electron/main.jsindex 30f58a4eb1..44b27420be 100644--- a/app/electron/main.js+++ b/app/electron/main.js@@ -63,8 +63,39 @@ if (!app.requestSingleInstanceLock()) {}if (process.platform === "linux") {- app.commandLine.appendSwitch("enable-wayland-ime");- app.commandLine.appendSwitch("wayland-text-input-version", "3");+ // Linux 平台回退到 x11/XWayland 以解决某些系统上无法输入中文的问题+ // 如果需要使用原生 Wayland 可以通过启动参数 --ozone-platform=wayland 进行覆盖+ app.commandLine.appendSwitch('ozone-platform', 'x11');+}++app.setAsDefaultProtocolClient("siyuan");++app.commandLine.appendSwitch("disable-web-security");+app.commandLine.appendSwitch("auto-detect", "false");+app.commandLine.appendSwitch("no-proxy-server");+app.commandLine.appendSwitch("enable-features", "PlatformHEVCDecoderSupport");+app.commandLine.appendSwitch("xdg-portal-required-version", "4");++// Support set Chromium command line arguments on the desktop https://github.com/siyuan-note/siyuan/issues/9696+writeLog("app is packaged [" + app.isPackaged + "], command line args [" + process.argv.join(", ") + "]");+let argStart = 1;+if (!app.isPackaged) {+ argStart = 2;+}++for (let i = argStart; i < process.argv.length; i++) {+ let arg = process.argv[i];+ if (arg.startsWith("--workspace=") || arg.startsWith("--openAsHidden") || arg.startsWith("--port=") || arg.startsWith("siyuan://")) {+ // 跳过内置参数+ if (arg.startsWith("--openAsHidden")) {+ openAsHidden = true;+ writeLog("open as hidden");+ }+ continue;+ }++ app.commandLine.appendSwitch(arg);+ writeLog("command line switch [" + arg + "]");}try {@@ -297,28 +328,6 @@ const showErrorWindow = (titleZh, titleEn, content, emoji = "⚠️") => {return errWindow.id;};-const writeLog = (out) => {- console.log(out);- const logFile = path.join(confDir, "app.log");- let log = "";- const maxLogLines = 1024;- try {- if (fs.existsSync(logFile)) {- log = fs.readFileSync(logFile).toString();- let lines = log.split("\n");- if (maxLogLines < lines.length) {- log = lines.slice(maxLogLines / 2, maxLogLines).join("\n") + "\n";- }- }- out = out.toString();- out = new Date().toISOString().replace(/T/, " ").replace(/\..+/, "") + " " + out;- log += out + "\n";- fs.writeFileSync(logFile, log);- } catch (e) {- console.error(e);- }-};-let openAsHidden = false;const isOpenAsHidden = function () {return 1 === workspaces.length && openAsHidden;@@ -730,36 +739,6 @@ const initKernel = (workspace, port, lang) => {});};-app.setAsDefaultProtocolClient("siyuan");--app.commandLine.appendSwitch("disable-web-security");-app.commandLine.appendSwitch("auto-detect", "false");-app.commandLine.appendSwitch("no-proxy-server");-app.commandLine.appendSwitch("enable-features", "PlatformHEVCDecoderSupport");-app.commandLine.appendSwitch("xdg-portal-required-version", "4");--// Support set Chromium command line arguments on the desktop https://github.com/siyuan-note/siyuan/issues/9696-writeLog("app is packaged [" + app.isPackaged + "], command line args [" + process.argv.join(", ") + "]");-let argStart = 1;-if (!app.isPackaged) {- argStart = 2;-}--for (let i = argStart; i < process.argv.length; i++) {- let arg = process.argv[i];- if (arg.startsWith("--workspace=") || arg.startsWith("--openAsHidden") || arg.startsWith("--port=") || arg.startsWith("siyuan://")) {- // 跳过内置参数- if (arg.startsWith("--openAsHidden")) {- openAsHidden = true;- writeLog("open as hidden");- }- continue;- }-- app.commandLine.appendSwitch(arg);- writeLog("command line switch [" + arg + "]");-}-app.whenReady().then(() => {const resetTrayMenu = (tray, lang, mainWindow) => {if (!mainWindow || mainWindow.isDestroyed()) {@@ -1542,3 +1521,26 @@ app.on("before-quit", (event) => {}});});+++function writeLog(out) {+ console.log(out);+ const logFile = path.join(confDir, "app.log");+ let log = "";+ const maxLogLines = 1024;+ try {+ if (fs.existsSync(logFile)) {+ log = fs.readFileSync(logFile).toString();+ let lines = log.split("\n");+ if (maxLogLines < lines.length) {+ log = lines.slice(maxLogLines / 2, maxLogLines).join("\n") + "\n";+ }+ }+ out = out.toString();+ out = new Date().toISOString().replace(/T/, " ").replace(/\..+/, "") + " " + out;+ log += out + "\n";+ fs.writeFileSync(logFile, log);+ } catch (e) {+ console.error(e);+ }+}\ No newline at end of file