diff --git a/.gitignore b/.gitignore index 4fe8958b..52b7fdd9 100644 --- a/.gitignore +++ b/.gitignore @@ -8,5 +8,7 @@ coverage node_modules/ npm-debug.log npm-debug.log.* +yarn-error.log +yarn-error.log.* thumbs.db !.gitkeep diff --git a/README.md b/README.md index 44bd957d..43da4116 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ | 平台 | Windows | Mac OS | Linux | | :--- | :---: | :---: | :---: | -|下载链接| [![Windows 版本下载链接 v1.9.3](https://img.shields.io/badge/v1.9.3-Windows-limegreen.svg)](https://github.com/CS-Tao/whu-library-seat/releases/download/v1.9.3/whu-library-seat-1.9.3.exe) | [![Mac OS 版本下载链接 v1.9.3](https://img.shields.io/badge/v1.9.3-Mac%20OS-limegreen.svg)](https://github.com/CS-Tao/whu-library-seat/releases/download/v1.9.3/whu-library-seat-1.9.3.dmg) | [![Linux 版本下载链接 v1.9.3](https://img.shields.io/badge/v1.9.3-Linux-limegreen.svg)](https://github.com/CS-Tao/whu-library-seat/releases/download/v1.9.3/whu-library-seat-1.9.3-x86_64.AppImage) | +|下载链接| [![Windows 版本下载链接 v1.9.4](https://img.shields.io/badge/v1.9.4-Windows-limegreen.svg)](https://github.com/CS-Tao/whu-library-seat/releases/download/v1.9.4/whu-library-seat-1.9.4.exe) | [![Mac OS 版本下载链接 v1.9.4](https://img.shields.io/badge/v1.9.4-Mac%20OS-limegreen.svg)](https://github.com/CS-Tao/whu-library-seat/releases/download/v1.9.4/whu-library-seat-1.9.4.dmg) | [![Linux 版本下载链接 v1.9.4](https://img.shields.io/badge/v1.9.4-Linux-limegreen.svg)](https://github.com/CS-Tao/whu-library-seat/releases/download/v1.9.4/whu-library-seat-1.9.4-x86_64.AppImage) | ### 申请软件使用权 diff --git a/package.json b/package.json index c5de7d20..8551cb08 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "whu-library-seat", - "version": "1.9.3", + "version": "1.9.4", "author": "CS-Tao ", "description": "武汉大学图书馆抢座软件", "license": null, diff --git a/src/main/index.js b/src/main/index.js index aafbd043..5201f221 100644 --- a/src/main/index.js +++ b/src/main/index.js @@ -41,6 +41,13 @@ app.on('ready', () => { }) const contextMenu = Menu.buildFromTemplate([ + { + label: '打开软件', + click () { + mainWindow.show() + } + }, + { type: 'separator' }, { label: '查看文档', click () { require('electron').shell.openExternal('https://home.cs-tao.cc/whu-library-seat/') } @@ -71,7 +78,7 @@ app.on('ready', () => { click: (menuItem, browserWindow, event) => { store.set('mainWindowPosition', mainWindow.getPosition()) mainWindow = null - if (tray) { + if (tray && process.platform !== 'darwin') { tray.destroy() } app.exit() @@ -80,113 +87,112 @@ app.on('ready', () => { ]) tray.setToolTip('武汉大学图书馆抢座软件') tray.setContextMenu(contextMenu) -}) -const template = [ - { - label: '文件', - submenu: [ - { - label: '退出程序', - click () { - store.set('mainWindowPosition', mainWindow.getPosition()) - mainWindow = null - if (tray) { - tray.destroy() + const template = [ + { + label: '文件', + submenu: [ + { + label: '退出程序', + click () { + store.set('mainWindowPosition', mainWindow.getPosition()) + mainWindow = null + if (tray) { + tray.destroy() + } + app.exit() } - app.exit() } - } - ] - }, { - label: '设置', - submenu: [ - { - label: '恢复所有设置', - click () { - store.clear() - if (mainWindow) { - mainWindow.reload() + ] + }, { + label: '设置', + submenu: [ + { + label: '恢复所有设置', + click () { + store.clear() + if (mainWindow) { + mainWindow.reload() + } } } - } - ] - }, { - label: '视图', - submenu: [ - { role: 'reload', label: '重新加载' }, - { role: 'forcereload', label: '强制重新加载' } - ] - }, { - label: '窗口', - role: 'window', - submenu: [ - { - label: '置顶', - type: 'checkbox', - checked: store.get('mainWindowOnTop', false), - click: (menuItem, browserWindow, event) => { - mainWindow.setAlwaysOnTop(menuItem.checked) - store.set('mainWindowOnTop', menuItem.checked) - if (!mainWindow.isVisible()) { - mainWindow.show() - mainWindow.setSkipTaskbar(false) + ] + }, { + label: '视图', + submenu: [ + { role: 'reload', label: '重新加载' }, + { role: 'forcereload', label: '强制重新加载' } + ] + }, { + label: '窗口', + submenu: [ + { + label: '置顶', + type: 'checkbox', + checked: store.get('mainWindowOnTop', false), + click: (menuItem, browserWindow, event) => { + mainWindow.setAlwaysOnTop(menuItem.checked) + store.set('mainWindowOnTop', menuItem.checked) + if (!mainWindow.isVisible()) { + mainWindow.show() + mainWindow.setSkipTaskbar(false) + } + } + }, + { role: 'minimize', label: '最小化' }, + { + label: '退出到托盘', + click: (menuItem, browserWindow, event) => { + mainWindow.hide() + mainWindow.setSkipTaskbar(true) } } - }, - { role: 'minimize', label: '最小化' }, - { - label: '退出到托盘', - click: (menuItem, browserWindow, event) => { - mainWindow.hide() - mainWindow.setSkipTaskbar(true) + ] + }, { + label: '群聊', + submenu: [ + { + label: 'Chat on gitter', + click () { require('electron').shell.openExternal('https://gitter.im/whu-library-seat/Lobby') } } - } - ] - }, { - label: '群聊', - submenu: [ - { - label: 'Chat on gitter', - click () { require('electron').shell.openExternal('https://gitter.im/whu-library-seat/Lobby') } - } - ] - }, { - label: '关于', - role: 'about', - submenu: [ - { - label: '版本 v' + appVersion, - enabled: false - }, - { - label: '更新日志', - click () { require('electron').shell.openExternal('https://github.com/CS-Tao/whu-library-seat/releases/tag/v' + appVersion) } - }, - { - label: '检查更新', - click () { mainWindow.webContents.send('check-update-menu-clicked') } - }, - { type: 'separator' }, - { - label: '文档', - click () { require('electron').shell.openExternal('https://home.cs-tao.cc/whu-library-seat/') } - }, - { - label: '项目', - click () { require('electron').shell.openExternal('https://github.com/CS-Tao/whu-library-seat') } - }, - { type: 'separator' }, - { - label: '问题反馈', - click () { require('electron').shell.openExternal('https://github.com/CS-Tao/whu-library-seat/issues/new') } - } - ] - } -] + ] + }, { + label: '关于', + role: 'about', + submenu: [ + { + label: '版本 v' + appVersion, + enabled: false + }, + { + label: '更新日志', + click () { require('electron').shell.openExternal('https://github.com/CS-Tao/whu-library-seat/releases/tag/v' + appVersion) } + }, + { + label: '检查更新', + click () { mainWindow.webContents.send('check-update-menu-clicked') } + }, + { type: 'separator' }, + { + label: '文档', + click () { require('electron').shell.openExternal('https://home.cs-tao.cc/whu-library-seat/') } + }, + { + label: '项目', + click () { require('electron').shell.openExternal('https://github.com/CS-Tao/whu-library-seat') } + }, + { type: 'separator' }, + { + label: '问题反馈', + click () { require('electron').shell.openExternal('https://github.com/CS-Tao/whu-library-seat/issues/new') } + } + ] + } + ] -const menu = Menu.buildFromTemplate(template) -Menu.setApplicationMenu(menu) + const menu = Menu.buildFromTemplate(template) + Menu.setApplicationMenu(menu) +}) function createWindow () { /** @@ -259,7 +265,7 @@ function createWindow () { }) mainWindow.on('show', () => { - tray.setHighlightMode('always') + tray.setHighlightMode('never') }) mainWindow.on('hide', () => {