|
@@ -1,4 +1,5 @@
|
|
|
-import { app, ipcMain, BrowserWindow, Menu, Tray } from 'electron'
|
|
|
+import { app, ipcMain, nativeImage, BrowserWindow, Menu, Tray } from 'electron'
|
|
|
+import FileSystem from 'fs'
|
|
|
import Autolaunch from 'auto-launch'
|
|
|
import installExtension, { VUEJS_DEVTOOLS } from 'electron-devtools-installer'
|
|
|
import { enableLiveReload } from 'electron-compile'
|
|
@@ -115,7 +116,13 @@ const exitApp = async () => {
|
|
|
* Create system tray app
|
|
|
*/
|
|
|
const createTray = async () => {
|
|
|
- tray = new Tray('printer.png')
|
|
|
+ let icon = `${__dirname}/printer.png`
|
|
|
+
|
|
|
+ if (!FileSystem.existsSync(icon)) {
|
|
|
+ icon = nativeImage.createEmpty()
|
|
|
+ }
|
|
|
+
|
|
|
+ tray = new Tray(icon)
|
|
|
tray.setToolTip(settings.appName)
|
|
|
|
|
|
const contextMenu = Menu.buildFromTemplate([
|