mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-19 08:00:13 +01:00
This commit is contained in:
parent
d21dd185c4
commit
a8201b8474
7 changed files with 113 additions and 42 deletions
|
|
@ -846,6 +846,16 @@
|
||||||
"xy": "%d years %s",
|
"xy": "%d years %s",
|
||||||
"max": "a long while %s"
|
"max": "a long while %s"
|
||||||
},
|
},
|
||||||
|
"_trayMenu": {
|
||||||
|
"showWindow": "Show Window",
|
||||||
|
"hideWindow": "Hide Window",
|
||||||
|
"setWindowTop": "Set Window top",
|
||||||
|
"cancelWindowTop": "Cancel Window top",
|
||||||
|
"officialWebsite": "Visit official website",
|
||||||
|
"openSource": "Visit Project on Github",
|
||||||
|
"resetWindow": "Reset Window on restart",
|
||||||
|
"quit": "Quit application"
|
||||||
|
},
|
||||||
"_kernel": {
|
"_kernel": {
|
||||||
"0": "Query notebook failed",
|
"0": "Query notebook failed",
|
||||||
"1": "Duplicated filename",
|
"1": "Duplicated filename",
|
||||||
|
|
|
||||||
|
|
@ -680,7 +680,6 @@
|
||||||
"export3": "Sólo texto de anclaje",
|
"export3": "Sólo texto de anclaje",
|
||||||
"export4": "Notas a pie de página",
|
"export4": "Notas a pie de página",
|
||||||
"export5": "Ref. de anotación en PDF",
|
"export5": "Ref. de anotación en PDF",
|
||||||
"export6": "Fusionar subdocumentos",
|
|
||||||
"export6": "Sobre el manejo del texto ancla en las anotaciones PDF al exportar",
|
"export6": "Sobre el manejo del texto ancla en las anotaciones PDF al exportar",
|
||||||
"export7": "Nombre de archivo - Número de página - Texto ancla",
|
"export7": "Nombre de archivo - Número de página - Texto ancla",
|
||||||
"export8": "Sólo texto ancla",
|
"export8": "Sólo texto ancla",
|
||||||
|
|
@ -847,6 +846,16 @@
|
||||||
"xy": "%d años %s",
|
"xy": "%d años %s",
|
||||||
"max": "mucho tiempo %s"
|
"max": "mucho tiempo %s"
|
||||||
},
|
},
|
||||||
|
"_trayMenu": {
|
||||||
|
"showWindow": "Mostrar ventana",
|
||||||
|
"hideWindow": "Ocultar ventana",
|
||||||
|
"setWindowTop": "Establecer parte superior de la ventana",
|
||||||
|
"cancelWindowTop": "Cancelar ventana superior",
|
||||||
|
"officialWebsite": "Visita el sitio web oficial",
|
||||||
|
"openSource": "Visita el proyecto en Github",
|
||||||
|
"resetWindow": "Restablecer ventana al reiniciar",
|
||||||
|
"quit": "Salir de la aplicación"
|
||||||
|
},
|
||||||
"_kernel": {
|
"_kernel": {
|
||||||
"0": "Consulta al cuaderno de notas fallido",
|
"0": "Consulta al cuaderno de notas fallido",
|
||||||
"1": "Nombre de archivo duplicado",
|
"1": "Nombre de archivo duplicado",
|
||||||
|
|
|
||||||
|
|
@ -846,6 +846,16 @@
|
||||||
"xy": "%d ans %s",
|
"xy": "%d ans %s",
|
||||||
"max": "un bon moment %s"
|
"max": "un bon moment %s"
|
||||||
},
|
},
|
||||||
|
"_trayMenu": {
|
||||||
|
"showWindow": "Afficher la fenêtre principale",
|
||||||
|
"hideWindow": "Masquer la fenêtre principale",
|
||||||
|
"setWindowTop": "Fenêtre en haut",
|
||||||
|
"cancelWindowTop": "Annuler le haut de la fenêtre",
|
||||||
|
"officialWebsite": "Visiter le site officiel",
|
||||||
|
"openSource": "Accéder aux projets open source GitHub",
|
||||||
|
"resetWindow": "Réinitialiser l'état de la fenêtre au redémarrage",
|
||||||
|
"quit": "Quitter le programme"
|
||||||
|
},
|
||||||
"_kernel": {
|
"_kernel": {
|
||||||
"0": "Échec du cahier de requêtes",
|
"0": "Échec du cahier de requêtes",
|
||||||
"1": "Nom de fichier dupliqué",
|
"1": "Nom de fichier dupliqué",
|
||||||
|
|
|
||||||
|
|
@ -846,6 +846,16 @@
|
||||||
"xy": "%d 年%s",
|
"xy": "%d 年%s",
|
||||||
"max": "很久%s"
|
"max": "很久%s"
|
||||||
},
|
},
|
||||||
|
"_trayMenu": {
|
||||||
|
"showWindow": "顯示主窗口",
|
||||||
|
"hideWindow": "隱藏主窗口",
|
||||||
|
"setWindowTop": "窗口置頂",
|
||||||
|
"cancelWindowTop": "取消窗口置頂",
|
||||||
|
"officialWebsite": "訪問官方網站",
|
||||||
|
"openSource": "訪問 GitHub 開源項目",
|
||||||
|
"resetWindow": "重啟時重置窗口",
|
||||||
|
"quit": "退出程序"
|
||||||
|
},
|
||||||
"_kernel": {
|
"_kernel": {
|
||||||
"0": "查詢筆記本失敗",
|
"0": "查詢筆記本失敗",
|
||||||
"1": "檔案名重複",
|
"1": "檔案名重複",
|
||||||
|
|
|
||||||
|
|
@ -846,6 +846,16 @@
|
||||||
"xy": "%d 年%s",
|
"xy": "%d 年%s",
|
||||||
"max": "很久%s"
|
"max": "很久%s"
|
||||||
},
|
},
|
||||||
|
"_trayMenu": {
|
||||||
|
"showWindow": "显示主窗口",
|
||||||
|
"hideWindow": "隐藏主窗口",
|
||||||
|
"setWindowTop": "窗口置顶",
|
||||||
|
"cancelWindowTop": "取消窗口置顶",
|
||||||
|
"officialWebsite": "访问官方网站",
|
||||||
|
"openSource": "访问 GitHub 开源项目",
|
||||||
|
"resetWindow": "重启时重置窗口",
|
||||||
|
"quit": "退出程序"
|
||||||
|
},
|
||||||
"_kernel": {
|
"_kernel": {
|
||||||
"0": "查询笔记本失败",
|
"0": "查询笔记本失败",
|
||||||
"1": "文件名重复",
|
"1": "文件名重复",
|
||||||
|
|
|
||||||
|
|
@ -393,48 +393,66 @@ const boot = () => {
|
||||||
globalShortcut.unregisterAll()
|
globalShortcut.unregisterAll()
|
||||||
writeLog('exited ui')
|
writeLog('exited ui')
|
||||||
})
|
})
|
||||||
ipcMain.on('siyuan-init', async () => {
|
|
||||||
|
let trayMenu = {
|
||||||
|
"showWindow": "Show Window",
|
||||||
|
"hideWindow": "Hide Window",
|
||||||
|
"setWindowTop": "Set Window top",
|
||||||
|
"cancelWindowTop": "Cancel Window top",
|
||||||
|
"officialWebsite": "Visit official website",
|
||||||
|
"openSource": "Visit Project on Github",
|
||||||
|
"resetWindow": "Reset Window on restart",
|
||||||
|
"quit": "Quit application"
|
||||||
|
}
|
||||||
|
ipcMain.on('siyuan-init', async (event, languages) => {
|
||||||
|
trayMenu = languages['_trayMenu'];
|
||||||
|
resetTrayMenu()
|
||||||
await fetch(getServer() + '/api/system/uiproc?pid=' + process.pid,
|
await fetch(getServer() + '/api/system/uiproc?pid=' + process.pid,
|
||||||
{method: 'POST'})
|
{method: 'POST'})
|
||||||
})
|
})
|
||||||
|
|
||||||
// 系统托盘菜单
|
const resetTrayMenu = () => {
|
||||||
const trayMenuTemplate = [
|
if ('win32' !== process.platform && 'linux' !== process.platform) {
|
||||||
{
|
return
|
||||||
label: 'Official Website',
|
|
||||||
click: () => {
|
|
||||||
shell.openExternal('https://b3log.org/siyuan/')
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Open Source',
|
|
||||||
click: () => {
|
|
||||||
shell.openExternal('https://github.com/siyuan-note/siyuan')
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '中文反馈',
|
|
||||||
click: () => {
|
|
||||||
shell.openExternal('https://ld246.com/article/1649901726096')
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Reset Window on restart',
|
|
||||||
type: 'checkbox',
|
|
||||||
click: v => {
|
|
||||||
resetWindowStateOnRestart = v.checked
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Quit',
|
|
||||||
click: () => {
|
|
||||||
mainWindow.webContents.send('siyuan-save-close', true)
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
]
|
|
||||||
|
const trayMenuTemplate = buildTrayMenuTemplate()
|
||||||
|
const contextMenu = Menu.buildFromTemplate(trayMenuTemplate)
|
||||||
|
tray.setContextMenu(contextMenu)
|
||||||
|
}
|
||||||
|
|
||||||
|
const buildTrayMenuTemplate = () => {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
label: trayMenu.officialWebsite,
|
||||||
|
click: () => {
|
||||||
|
shell.openExternal('https://b3log.org/siyuan/')
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: trayMenu.openSource,
|
||||||
|
click: () => {
|
||||||
|
shell.openExternal('https://github.com/siyuan-note/siyuan')
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: trayMenu.resetWindow,
|
||||||
|
type: 'checkbox',
|
||||||
|
click: v => {
|
||||||
|
resetWindowStateOnRestart = v.checked
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: trayMenu.quit,
|
||||||
|
click: () => {
|
||||||
|
mainWindow.webContents.send('siyuan-save-close', true)
|
||||||
|
},
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
const showWndMenu = {
|
const showWndMenu = {
|
||||||
label: 'Hide Window',
|
label: trayMenu.hideWindow,
|
||||||
click: () => {
|
click: () => {
|
||||||
showHideWnd()
|
showHideWnd()
|
||||||
},
|
},
|
||||||
|
|
@ -447,7 +465,8 @@ const boot = () => {
|
||||||
mainWindow.show()
|
mainWindow.show()
|
||||||
|
|
||||||
if ('win32' === process.platform || 'linux' === process.platform) {
|
if ('win32' === process.platform || 'linux' === process.platform) {
|
||||||
showWndMenu.label = "Hide Window"
|
showWndMenu.label = trayMenu.hideWindow
|
||||||
|
const trayMenuTemplate = buildTrayMenuTemplate()
|
||||||
trayMenuTemplate.splice(0, 1, showWndMenu)
|
trayMenuTemplate.splice(0, 1, showWndMenu)
|
||||||
const contextMenu = Menu.buildFromTemplate(trayMenuTemplate)
|
const contextMenu = Menu.buildFromTemplate(trayMenuTemplate)
|
||||||
tray.setContextMenu(contextMenu)
|
tray.setContextMenu(contextMenu)
|
||||||
|
|
@ -456,7 +475,8 @@ const boot = () => {
|
||||||
mainWindow.hide()
|
mainWindow.hide()
|
||||||
|
|
||||||
if ('win32' === process.platform || 'linux' === process.platform) {
|
if ('win32' === process.platform || 'linux' === process.platform) {
|
||||||
showWndMenu.label = "Show Window"
|
showWndMenu.label = trayMenu.showWindow
|
||||||
|
const trayMenuTemplate = buildTrayMenuTemplate()
|
||||||
trayMenuTemplate.splice(0, 1, showWndMenu)
|
trayMenuTemplate.splice(0, 1, showWndMenu)
|
||||||
const contextMenu = Menu.buildFromTemplate(trayMenuTemplate)
|
const contextMenu = Menu.buildFromTemplate(trayMenuTemplate)
|
||||||
tray.setContextMenu(contextMenu)
|
tray.setContextMenu(contextMenu)
|
||||||
|
|
@ -480,6 +500,7 @@ const boot = () => {
|
||||||
tray = new Tray(path.join(appDir, 'stage', 'icon-large.png'))
|
tray = new Tray(path.join(appDir, 'stage', 'icon-large.png'))
|
||||||
tray.setToolTip('SiYuan v' + appVer)
|
tray.setToolTip('SiYuan v' + appVer)
|
||||||
|
|
||||||
|
const trayMenuTemplate = buildTrayMenuTemplate()
|
||||||
// 插入显示/隐藏窗口菜单
|
// 插入显示/隐藏窗口菜单
|
||||||
trayMenuTemplate.splice(0, 0, showWndMenu)
|
trayMenuTemplate.splice(0, 0, showWndMenu)
|
||||||
|
|
||||||
|
|
@ -487,17 +508,17 @@ const boot = () => {
|
||||||
if ('win32' === process.platform) {
|
if ('win32' === process.platform) {
|
||||||
// Windows 端支持窗口置顶 https://github.com/siyuan-note/siyuan/issues/6860
|
// Windows 端支持窗口置顶 https://github.com/siyuan-note/siyuan/issues/6860
|
||||||
changeWndTop = {
|
changeWndTop = {
|
||||||
label: 'Set Window top',
|
label: trayMenu.setWindowTop,
|
||||||
click: () => {
|
click: () => {
|
||||||
if (!mainWindow.isAlwaysOnTop()) {
|
if (!mainWindow.isAlwaysOnTop()) {
|
||||||
mainWindow.setAlwaysOnTop(true)
|
mainWindow.setAlwaysOnTop(true)
|
||||||
changeWndTop.label = 'Cancel Window top'
|
changeWndTop.label = trayMenu.cancelWindowTop
|
||||||
trayMenuTemplate.splice(1, 1, changeWndTop)
|
trayMenuTemplate.splice(1, 1, changeWndTop)
|
||||||
const contextMenu = Menu.buildFromTemplate(trayMenuTemplate)
|
const contextMenu = Menu.buildFromTemplate(trayMenuTemplate)
|
||||||
tray.setContextMenu(contextMenu)
|
tray.setContextMenu(contextMenu)
|
||||||
} else {
|
} else {
|
||||||
mainWindow.setAlwaysOnTop(false)
|
mainWindow.setAlwaysOnTop(false)
|
||||||
changeWndTop.label = 'Set Window top'
|
changeWndTop.label = trayMenu.setWindowTop
|
||||||
trayMenuTemplate.splice(1, 1, changeWndTop)
|
trayMenuTemplate.splice(1, 1, changeWndTop)
|
||||||
const contextMenu = Menu.buildFromTemplate(trayMenuTemplate)
|
const contextMenu = Menu.buildFromTemplate(trayMenuTemplate)
|
||||||
tray.setContextMenu(contextMenu)
|
tray.setContextMenu(contextMenu)
|
||||||
|
|
@ -823,6 +844,7 @@ app.on('before-quit', (event) => {
|
||||||
})
|
})
|
||||||
|
|
||||||
const {powerMonitor} = require('electron')
|
const {powerMonitor} = require('electron')
|
||||||
|
const {build} = require("electron-builder");
|
||||||
|
|
||||||
powerMonitor.on('suspend', () => {
|
powerMonitor.on('suspend', () => {
|
||||||
writeLog('system suspend')
|
writeLog('system suspend')
|
||||||
|
|
|
||||||
|
|
@ -131,7 +131,7 @@ export const onGetConfig = (isStart: boolean) => {
|
||||||
}
|
}
|
||||||
/// #if !BROWSER
|
/// #if !BROWSER
|
||||||
ipcRenderer.send(Constants.SIYUAN_CONFIG_CLOSE, window.siyuan.config.appearance.closeButtonBehavior);
|
ipcRenderer.send(Constants.SIYUAN_CONFIG_CLOSE, window.siyuan.config.appearance.closeButtonBehavior);
|
||||||
ipcRenderer.send(Constants.SIYUAN_INIT);
|
ipcRenderer.send(Constants.SIYUAN_INIT, window.siyuan.languages);
|
||||||
ipcRenderer.send(Constants.SIYUAN_HOTKEY, hotKey2Electron(window.siyuan.config.keymap.general.toggleWin.custom));
|
ipcRenderer.send(Constants.SIYUAN_HOTKEY, hotKey2Electron(window.siyuan.config.keymap.general.toggleWin.custom));
|
||||||
/// #endif
|
/// #endif
|
||||||
if (!window.siyuan.config.uiLayout || (window.siyuan.config.uiLayout && !window.siyuan.config.uiLayout.left)) {
|
if (!window.siyuan.config.uiLayout || (window.siyuan.config.uiLayout && !window.siyuan.config.uiLayout.left)) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue