This repository has been archived on 2023-08-30. You can view files and clone it, but cannot push or open issues/pull-requests.
appcat
/
sonist
Archived
1
0
Fork 0

增加多规格图标

2.x
宇天 2019-01-19 22:19:55 +08:00
parent 63c584e161
commit c3bdde6495
10 changed files with 73 additions and 10 deletions

BIN
icons/128x128.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

BIN
icons/256x256.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
icons/512x512.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

View File

@ -23,6 +23,7 @@
"productName": "Sonist",
"copyright": "Copyright © 2019 ${author}",
"directories": {
"buildResources": "icons",
"output": "build"
},
"files": ["src/**/*", "node_modules/iofs/*", "node_modules/crypto.js/*"],
@ -44,7 +45,7 @@
"arch": "x64"
}
],
"icon": "icons/app.png"
"icon": "./icons/"
},
"deb": {
"depends": [

Binary file not shown.

After

Width:  |  Height:  |  Size: 797 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 915 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

35
src/linux-stat.html Normal file
View File

@ -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>

View File

@ -4,6 +4,7 @@ const {
protocol,
Tray,
Menu,
MenuItem,
session
} = require('electron')
const path = require('path')
@ -25,7 +26,26 @@ const MIME_TYPES = {
let win = 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',
submenu: [{ role: 'zoomin' }, { role: 'zoomout' }]
@ -37,17 +57,19 @@ const template = [
]
if (process.platform === 'darwin') {
template.unshift({
MENU_TMPL.unshift({
label: 'Sonist',
submenu: [{ role: 'about' }, { type: 'separator' }, { role: 'quit' }]
})
// Window menu
template[2].submenu = [{ role: 'minimize' }]
MENUBAR_TMPL[2].submenu = [{ role: 'minimize' }]
}
const menu = Menu.buildFromTemplate(template)
Menu.setApplicationMenu(menu)
let traymenuList = Menu.buildFromTemplate(TRAYMENU_TMPL)
let menubarList = Menu.buildFromTemplate(MENUBAR_TMPL)
/* ----------------------------------------------------- */
function createWindow() {
// 创建浏览器窗口
@ -90,14 +112,19 @@ app.on('ready', () => {
tray = new Tray(path.resolve(ROOT, './images/trays/trayTemplate.png'))
tray.on('click', _ => {
win.show()
})
if (process.platform === 'darwin') {
tray.on('click', _ => {
win.show()
})
} else {
tray.setContextMenu(traymenuList)
}
Menu.setApplicationMenu(menubarList)
// const ses = session.defaultSession
// ses.setUserAgent('Hello wolrd')
createWindow()
win.tray = tray
// win.tray = tray
win.webContents.openDevTools()
})