From a5e40b2e8c35e0c8c10b01e848775859138abc18 Mon Sep 17 00:00:00 2001 From: Jeffrey Chen <78434827+TCOTC@users.noreply.github.com> Date: Sat, 17 Jan 2026 22:26:22 +0800 Subject: [PATCH] :art: Improve macOS initialization UI and dark mode support (#16839) - Add dark mode styles (prefers-color-scheme) - Optimize macOS window styling (native frame, transparent background) - Adjust drag region height and position for macOS - Add Portuguese (Brazil) and Korean language options - Improve workspace path warning message - Filter .DS_Store file --- app/electron/init.html | 92 ++++++++++++++++++++++++++++++++++++++++-- app/electron/main.js | 5 ++- 2 files changed, 92 insertions(+), 5 deletions(-) diff --git a/app/electron/init.html b/app/electron/init.html index b491b9bb5..b73f1fd00 100644 --- a/app/electron/init.html +++ b/app/electron/init.html @@ -3,6 +3,7 @@ SiYuan + @@ -215,6 +291,7 @@ + @@ -265,7 +342,9 @@ + + @@ -355,6 +434,10 @@ }) }) + if (process.platform === 'darwin') { + document.body.classList.add('darwin'); + } + document.getElementById('close').addEventListener('click', () => { const {ipcRenderer} = require('electron') ipcRenderer.send('siyuan-first-quit') @@ -421,9 +504,9 @@ alert(msg) return } - let msg = '⚠️ Do not set the workspace under the path of a third-party sync disk, otherwise the data will be damaged (iCloud/OneDrive/Dropbox/Google Drive/Nutstore/Baidu Netdisk/Tencent Weiyun, etc.), continue?' + let msg = '⚠️ Please confirm that the workspace is not set under the path of a third-party sync disk, otherwise it will cause data damage (iCloud/OneDrive/Dropbox/Google Drive/Nutstore/Baidu Netdisk/Tencent Weiyun, etc.), continue?' if (isChinese(currentLang)) { - msg = '⚠️ 请勿将工作空间设置在第三方同步盘路径下,否则数据会被损坏(iCloud/OneDrive/Dropbox/Google Drive/坚果云/百度网盘/腾讯微云等),是否继续?' + msg = '⚠️ 请确认没有将工作空间设置在第三方同步盘路径下,否则会造成数据损坏(iCloud/OneDrive/Dropbox/Google Drive/坚果云/百度网盘/腾讯微云等),是否继续?' } if (!confirm(msg)) { return @@ -449,6 +532,7 @@ let files; try { files = fs.readdirSync(absPath) + files = files.filter(file => file !== '.DS_Store') } catch (err) { return false } diff --git a/app/electron/main.js b/app/electron/main.js index 1fee5957a..bfeec330e 100644 --- a/app/electron/main.js +++ b/app/electron/main.js @@ -1272,8 +1272,11 @@ app.whenReady().then(() => { const firstOpenWindow = new BrowserWindow({ width: Math.floor(screen.getPrimaryDisplay().size.width * 0.6), height: Math.floor(screen.getPrimaryDisplay().workAreaSize.height * 0.8), - frame: false, + frame: "darwin" === process.platform, + titleBarStyle: "hidden", + fullscreenable: false, icon: path.join(appDir, "stage", "icon-large.png"), + transparent: "darwin" === process.platform, webPreferences: { nodeIntegration: true, webviewTag: true, webSecurity: false, contextIsolation: false, },