增加多规格图标
After Width: | Height: | Size: 5.5 KiB |
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 23 KiB |
BIN
icons/app.png
Before Width: | Height: | Size: 17 KiB |
|
@ -23,6 +23,7 @@
|
||||||
"productName": "Sonist",
|
"productName": "Sonist",
|
||||||
"copyright": "Copyright © 2019 ${author}",
|
"copyright": "Copyright © 2019 ${author}",
|
||||||
"directories": {
|
"directories": {
|
||||||
|
"buildResources": "icons",
|
||||||
"output": "build"
|
"output": "build"
|
||||||
},
|
},
|
||||||
"files": ["src/**/*", "node_modules/iofs/*", "node_modules/crypto.js/*"],
|
"files": ["src/**/*", "node_modules/iofs/*", "node_modules/crypto.js/*"],
|
||||||
|
@ -44,7 +45,7 @@
|
||||||
"arch": "x64"
|
"arch": "x64"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"icon": "icons/app.png"
|
"icon": "./icons/"
|
||||||
},
|
},
|
||||||
"deb": {
|
"deb": {
|
||||||
"depends": [
|
"depends": [
|
||||||
|
|
After Width: | Height: | Size: 797 B |
After Width: | Height: | Size: 915 B |
After Width: | Height: | Size: 1.7 KiB |
|
@ -0,0 +1,35 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="zh-CN">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
|
||||||
|
<link href="lib/css/reset-basic.css" rel="stylesheet">
|
||||||
|
<link href="/css/desktop-lrc.css" rel="stylesheet">
|
||||||
|
<script>window.LIBS_BASE_URL = location.origin + '/lib';window.__ENV_LANG__ = 'zh'</script>
|
||||||
|
<script type="module" src="js/desktop-lrc.js"></script>
|
||||||
|
</head>
|
||||||
|
<body class="do-fn-noselect" anot="lrc">
|
||||||
|
<div class="lrc-box">
|
||||||
|
<section class="left">
|
||||||
|
<span class="shadow" :text="lrc.l.txt"></span>
|
||||||
|
</section>
|
||||||
|
<section class="right">
|
||||||
|
<span class="shadow" :text="lrc.r.txt"></span>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
<div class="lrc-box">
|
||||||
|
<section class="left">
|
||||||
|
<span :text="lrc.l.txt" :css="{background: lrc.l.bg}"></span>
|
||||||
|
</section>
|
||||||
|
<section class="right">
|
||||||
|
<span :text="lrc.r.txt" :css="{background: lrc.r.bg}"></span>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="touch-bar do-fn-drag">
|
||||||
|
<a class="do-icon-lock lock do-fn-nodrag" :class="{actived: isLock}" :click="lock"></a>
|
||||||
|
<a class="do-icon-close quit do-fn-nodrag" :click="quit"></a>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
45
src/main.js
|
@ -4,6 +4,7 @@ const {
|
||||||
protocol,
|
protocol,
|
||||||
Tray,
|
Tray,
|
||||||
Menu,
|
Menu,
|
||||||
|
MenuItem,
|
||||||
session
|
session
|
||||||
} = require('electron')
|
} = require('electron')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
|
@ -25,7 +26,26 @@ const MIME_TYPES = {
|
||||||
let win = null
|
let win = null
|
||||||
let tray = null
|
let tray = null
|
||||||
|
|
||||||
const template = [
|
/* ----------------------------------------------------- */
|
||||||
|
|
||||||
|
const TRAYMENU_TMPL = [
|
||||||
|
{
|
||||||
|
label: '显示Sonist',
|
||||||
|
type: 'normal',
|
||||||
|
click: () => {
|
||||||
|
win.show()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'separator'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '退出应用',
|
||||||
|
type: 'normal',
|
||||||
|
role: 'quit'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
const MENUBAR_TMPL = [
|
||||||
{
|
{
|
||||||
label: 'View',
|
label: 'View',
|
||||||
submenu: [{ role: 'zoomin' }, { role: 'zoomout' }]
|
submenu: [{ role: 'zoomin' }, { role: 'zoomout' }]
|
||||||
|
@ -37,17 +57,19 @@ const template = [
|
||||||
]
|
]
|
||||||
|
|
||||||
if (process.platform === 'darwin') {
|
if (process.platform === 'darwin') {
|
||||||
template.unshift({
|
MENU_TMPL.unshift({
|
||||||
label: 'Sonist',
|
label: 'Sonist',
|
||||||
submenu: [{ role: 'about' }, { type: 'separator' }, { role: 'quit' }]
|
submenu: [{ role: 'about' }, { type: 'separator' }, { role: 'quit' }]
|
||||||
})
|
})
|
||||||
|
|
||||||
// Window menu
|
// Window menu
|
||||||
template[2].submenu = [{ role: 'minimize' }]
|
MENUBAR_TMPL[2].submenu = [{ role: 'minimize' }]
|
||||||
}
|
}
|
||||||
|
|
||||||
const menu = Menu.buildFromTemplate(template)
|
let traymenuList = Menu.buildFromTemplate(TRAYMENU_TMPL)
|
||||||
Menu.setApplicationMenu(menu)
|
let menubarList = Menu.buildFromTemplate(MENUBAR_TMPL)
|
||||||
|
|
||||||
|
/* ----------------------------------------------------- */
|
||||||
|
|
||||||
function createWindow() {
|
function createWindow() {
|
||||||
// 创建浏览器窗口
|
// 创建浏览器窗口
|
||||||
|
@ -90,14 +112,19 @@ app.on('ready', () => {
|
||||||
|
|
||||||
tray = new Tray(path.resolve(ROOT, './images/trays/trayTemplate.png'))
|
tray = new Tray(path.resolve(ROOT, './images/trays/trayTemplate.png'))
|
||||||
|
|
||||||
tray.on('click', _ => {
|
if (process.platform === 'darwin') {
|
||||||
win.show()
|
tray.on('click', _ => {
|
||||||
})
|
win.show()
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
tray.setContextMenu(traymenuList)
|
||||||
|
}
|
||||||
|
Menu.setApplicationMenu(menubarList)
|
||||||
|
|
||||||
// const ses = session.defaultSession
|
// const ses = session.defaultSession
|
||||||
// ses.setUserAgent('Hello wolrd')
|
// ses.setUserAgent('Hello wolrd')
|
||||||
|
|
||||||
createWindow()
|
createWindow()
|
||||||
win.tray = tray
|
// win.tray = tray
|
||||||
win.webContents.openDevTools()
|
win.webContents.openDevTools()
|
||||||
})
|
})
|
||||||
|
|