diff --git a/electron.js b/electron.js index defc41c..6f9733a 100644 --- a/electron.js +++ b/electron.js @@ -74,86 +74,84 @@ function createWindow() { mountedData = {}; }); - if ((os.platform() === 'win32') || (os.platform() === 'linux')) { - const appPath = (os.platform() === 'win32') ? - path.resolve(path.join(app.getAppPath(), '..\\..\\repertory-ui.exe')) : - process.env.APPIMAGE; + const appPath = (os.platform() === 'win32') ? path.resolve(path.join(app.getAppPath(), '..\\..\\repertory-ui.exe')) : + (os.platform() === 'darwin') ? app.getAppPath() : + process.env.APPIMAGE; - const autoLauncher = new AutoLaunch({ - name: 'Repertory UI', - path: appPath, - }); + const autoLauncher = new AutoLaunch({ + name: 'Repertory UI', + path: appPath, + }); - const image = nativeImage.createFromPath(path.join(__dirname, '/build/logo.png')); - trayContextMenu = Menu.buildFromTemplate([ - { - label: 'Visible', type: 'checkbox', click(item) { - if (item.checked) { - mainWindow.show(); - if (mainWindow.isMinimized()) { - mainWindow.restore(); - } - mainWindow.focus() - } else { - mainWindow.hide(); + const image = nativeImage.createFromPath(path.join(__dirname, (os.platform() === 'darwin') ? '/build/icon.icns' : '/build/logo.png')); + trayContextMenu = Menu.buildFromTemplate([ + { + label: 'Visible', type: 'checkbox', click(item) { + if (item.checked) { + mainWindow.show(); + if (mainWindow.isMinimized()) { + mainWindow.restore(); } - }, - checked: !launchHidden, - }, - { - label: 'Auto-start', type: 'checkbox', click(item) { - if (item.checked) { - autoLauncher.enable(); - } else { - autoLauncher.disable(); - } - } - }, - { - type: 'separator' - }, - { - label: 'Launch Hidden', type: 'checkbox', click(item) { - launchHidden = !!item.checked; - saveUiSettings(); - }, - checked: launchHidden, - }, - { - type: 'separator' - }, - { - label: 'Exit and Unmount', click(item) { - closeApplication(); - } - } - ]); - - mainWindow.on('close', function (event) { - if (!isQuiting) { - event.preventDefault(); - if (mainWindow.isVisible()) { + mainWindow.focus() + } else { mainWindow.hide(); - trayContextMenu.items[0].checked = false; - mainWindowTray.setContextMenu(trayContextMenu); } - event.returnValue = false; + }, + checked: !launchHidden, + }, + { + label: 'Auto-start', type: 'checkbox', click(item) { + if (item.checked) { + autoLauncher.enable(); + } else { + autoLauncher.disable(); + } } - }); - - autoLauncher - .isEnabled() - .then((enabled) => { - trayContextMenu.items[1].checked = enabled; - - mainWindowTray = new Tray(image); - mainWindowTray.setToolTip('Repertory UI'); - mainWindowTray.setContextMenu(trayContextMenu) - }) - .catch(() => { + }, + { + type: 'separator' + }, + { + label: 'Launch Hidden', type: 'checkbox', click(item) { + launchHidden = !!item.checked; + saveUiSettings(); + }, + checked: launchHidden, + }, + { + type: 'separator' + }, + { + label: 'Exit and Unmount', click() { closeApplication(); - }); - } + } + } + ]); + + mainWindow.on('close', function (event) { + if (!isQuiting) { + event.preventDefault(); + if (mainWindow.isVisible()) { + mainWindow.hide(); + trayContextMenu.items[0].checked = false; + mainWindowTray.setContextMenu(trayContextMenu); + } + event.returnValue = false; + } + }); + + autoLauncher + .isEnabled() + .then((enabled) => { + trayContextMenu.items[1].checked = enabled; + + mainWindowTray = new Tray(image); + mainWindowTray.setToolTip('Repertory UI'); + mainWindowTray.setContextMenu(trayContextMenu) + }) + .catch(() => { + closeApplication(); + }); } const instanceLock = app.requestSingleInstanceLock(); diff --git a/package.json b/package.json index ee8436a..41afae9 100644 --- a/package.json +++ b/package.json @@ -129,10 +129,10 @@ "./helpers.js" ], "linux": { - "icon": "./build/icon.icns" + "icon": "./build/logo.png" }, "mac": { - "icon": "./build/icon.icns" + "icon": "./build/icon_color.icns" }, "win": { "icon": "./build/icon.ico" diff --git a/public/icon_color.icns b/public/icon_color.icns new file mode 100644 index 0000000..6f2482b Binary files /dev/null and b/public/icon_color.icns differ diff --git a/public/logo_hs.png b/public/logo_hs.png deleted file mode 100644 index a7ce38c..0000000 Binary files a/public/logo_hs.png and /dev/null differ diff --git a/public/logo_sia.png b/public/logo_sia.png deleted file mode 100644 index bf5c63d..0000000 Binary files a/public/logo_sia.png and /dev/null differ