Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: Improve macOS initialization UI and dark mode support (#16839)

Jeffrey Chena5e40b2e8c35
diff --git a/app/electron/init.html b/app/electron/init.html
index b491b9bb51..b73f1fd004 100644
--- a/app/electron/init.html
+++ b/app/electron/init.html
@@ -3,6 +3,7 @@
<head>
<title>SiYuan</title>
<meta charset="UTF-8">
+ <meta name="color-scheme" content="light dark">
<style>
body {
margin: 0;
@@ -181,12 +182,87 @@
.drag {
-webkit-app-region: drag;
- height: 22px;
+ height: 32px;
cursor: pointer;
position: fixed;
top: 0;
left: 0;
- right: 44px;
+ right: 64px;
+ }
+
+ .darwin #min,
+ .darwin #close {
+ display: none;
+ }
+
+ .darwin .drag {
+ left: 74px;
+ }
+
+ @media (prefers-color-scheme: dark) {
+ body {
+ background-color: #1e1e1e;
+ color: #dadada;
+ }
+
+ .fn__flex-column {
+ border: 1px solid rgba(255, 255, 255, .06);
+ }
+
+ .b3-select {
+ border: 1px solid rgba(255, 255, 255, .06);
+ color: #dadada;
+ background-color: #2d2d2d;
+ }
+
+ .b3-select:focus {
+ border: 1px solid #3573f0;
+ }
+
+ .b3-label {
+ border-bottom: 1px solid rgba(255, 255, 255, .06);
+ }
+
+ .b3-label__text {
+ color: #9aa0a6;
+ }
+
+ .svg {
+ fill: #9aa0a6;
+ }
+
+ .svg:hover {
+ background: rgba(255, 255, 255, .075);
+ fill: #dadada;
+ }
+
+ #close:hover {
+ background-color: #d23f31;
+ fill: #fff;
+ }
+
+ a {
+ color: #3573f0;
+ }
+
+ a:hover {
+ color: #4a8aff;
+ }
+
+ .slogan {
+ color: #9aa0a6;
+ }
+
+ .notice {
+ color: #9aa0a6;
+ }
+
+ kbd {
+ color: #9aa0a6;
+ background-color: #2d2d2d;
+ border: solid 1px rgba(255, 255, 255, .06);
+ box-shadow: inset 0 -1px 0 rgba(255, 255, 255, .06);
+ }
}
</style>
</head>
@@ -215,6 +291,7 @@
<option value="ja_JP">日本語</option>
<option value="ko_KR">한국어</option>
<option value="pl_PL">Polski</option>
+ <option value="pt_BR">Português (Brasil)</option>
<option value="ru_RU">Русский</option>
<option value="tr_TR">Türkçe</option>
<option value="zh_CHT">繁體中文</option>
@@ -265,7 +342,9 @@
<option value="he_IL">עברית</option>
<option value="it_IT">Italiano</option>
<option value="ja_JP">日本語</option>
+ <option value="ko_KR">한국어</option>
<option value="pl_PL">Polski</option>
+ <option value="pt_BR">Português (Brasil)</option>
<option value="ru_RU">Русский</option>
<option value="tr_TR">Türkçe</option>
<option value="zh_CHT">繁體中文</option>
@@ -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 1fee5957a2..bfeec330e2 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,
},