From eeecdc9f6b088830ee1c89e64edba41708bb7ad2 Mon Sep 17 00:00:00 2001
From: RoderickQiu
- Homepage | - GitHub | - Issues | - Help + Homepage | + GitHub | + Issues | + Help
diff --git a/main.js b/main.js
index a982926..3bf7761 100644
--- a/main.js
+++ b/main.js
@@ -8,7 +8,18 @@ app.commandLine.appendSwitch('autoplay-policy', 'no-user-gesture-required');//
function createWindow() {
// 创建浏览器窗口。
- win = new BrowserWindow({ width: 324, height: 233, frame: false, resizable: true, show: false, hasShadow: true, webPreferences: { nodeIntegration: true } })
+ win = new BrowserWindow({
+ width: 324,
+ height: 233,
+ frame: false,
+ resizable: true,
+ show: false,
+ hasShadow: true,
+ webPreferences: { nodeIntegration: true },
+ title: "wnr",
+ icon: "./res/icons/wnrIcon.png",
+ backgroundColor: "#fefefe"
+ })// 为跨平台优化
// 然后加载应用的 index.html。
win.loadFile('index.html')
@@ -55,6 +66,50 @@ app.on('ready', () => {
tray.on('click', () => {
win.isVisible() ? win.hide() : win.show()
})//托盘菜单
+
+ if (process.platform === 'darwin') {
+ var template = [{
+ label: 'wnr',
+ submenu: [{
+ label: 'Quit',
+ accelerator: 'CmdOrCtrl+Q',
+ click: function () {
+ app.quit();
+ }
+ }]
+ }, {
+ label: 'Edit',
+ submenu: [{
+ label: 'Undo',
+ accelerator: 'CmdOrCtrl+Z',
+ selector: 'undo:'
+ }, {
+ label: 'Redo',
+ accelerator: 'Shift+CmdOrCtrl+Z',
+ selector: 'redo:'
+ }, {
+ type: 'separator'
+ }, {
+ label: 'Cut',
+ accelerator: 'CmdOrCtrl+X',
+ selector: 'cut:'
+ }, {
+ label: 'Copy',
+ accelerator: 'CmdOrCtrl+C',
+ selector: 'copy:'
+ }, {
+ label: 'Paste',
+ accelerator: 'CmdOrCtrl+V',
+ selector: 'paste:'
+ }, {
+ label: 'Select All',
+ accelerator: 'CmdOrCtrl+A',
+ selector: 'selectAll:'
+ }]
+ }];
+ var osxMenu = menu.buildFromTemplate(template);
+ menu.setApplicationMenu(osxMenu);
+ }// 应付macOS的顶栏空缺
})
app.on('activate', () => {
@@ -73,4 +128,9 @@ ipcMain.on('warninggiver', function () {
win.once('focus', () => win.flashFrame(false));
win.flashFrame(true);// 在Windows平台上闪烁任务栏按钮
}
-})
\ No newline at end of file
+})
+
+/* 参考:
+- https://blog.avocode.com/4-must-know-tips-for-building-cross-platform-electron-apps-f3ae9c2bffff [need proxy]
+- https://electronjs.org/docs
+*/
\ No newline at end of file
diff --git a/package.json b/package.json
index b7ea2e0..b36394b 100644
--- a/package.json
+++ b/package.json
@@ -1,11 +1,13 @@
{
"name": "wnr",
- "version": "0.1.0",
+ "version": "1.0.0",
"description": "The name is a abbr of \"Work & Rest\". It's a timer app with strong expansibility for computers.",
"main": "main.js",
"scripts": {
"start": "electron .",
- "winx64": "electron-builder --win --x64"
+ "win": "electron-builder --win --x64",
+ "mac": "electron-builder --mac --x64",
+ "linux": "electron-builder --linux --x64"
},
"repository": {
"type": "git",
@@ -31,6 +33,18 @@
"zip"
],
"icon": "res/icons/iconWin.ico"
+ },
+ "mac": {
+ "target": [
+ "zip"
+ ],
+ "icon": "res/icons/iconMac.icns"
+ },
+ "linux": {
+ "target": [
+ "zip"
+ ],
+ "icon": "res/icons/wnrIcon.png"
}
}
}
diff --git a/res/icons/iconMac.icns b/res/icons/iconMac.icns
new file mode 100644
index 0000000000000000000000000000000000000000..ed84751f41b721bc4c01bf6fe9a205e27a402019
GIT binary patch
literal 72556
zcmb4p1AHXU*7n4 !M05sdIM~^m;r>kwk+zRsIBQ9mvD$
zyb_Vq`WkGXK!ekf44hCDX+6J FC>DXai*>`Glkt;X}H;vm&`CYaBH)G
zmKW8$^VSS}G4F#S_Y_=mC)WeZcC-C#3^U~ACE49Ewo54*x07y8MPwFD#geF5o0lCw
zR$AE|Y-a7Pu0nLa8$$Od2mO7`{;n(hnx-=mnM)p%nesKM*cT`^?}9EuOE)>bqT8{a
z$8|gUWTw^f;E!GFoeaM0+|P 3-%M7J
zHQP#FI2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