diff --git a/desktop/application.js b/desktop/application.js index 09b2921..de71c19 100644 --- a/desktop/application.js +++ b/desktop/application.js @@ -46,8 +46,9 @@ const createMainWindow = () => { minHeight: 450, maximizable: false, fullscreenable: false, - frame: false, - titleBarStyle: 'hidden-inset', + // Only go frameless on macOS + frame: process.platform !== 'darwin', + titleBarStyle: 'hidden-inset', // darwin only autoHideMenuBar: true, backgroundColor: '#000000', }); @@ -93,6 +94,10 @@ app.on('ready', () => { const page = mainWindow.webContents; ipcMain.on('settingsUpdated', (_event, settings) => { + // app.dock is macOS only + if ((process.platform !== 'darwin') || (app.dock === undefined)) { + return; + } if (settings.dockItemVisible) { if (!app.dock.isVisible()) { app.dock.show(); diff --git a/desktop/menu.js b/desktop/menu.js index f601f29..47e4eb9 100644 --- a/desktop/menu.js +++ b/desktop/menu.js @@ -141,6 +141,23 @@ const createMenu = (app, mainWindow) => { role: 'front', }, ]; + } else { + // linux/windows + template.unshift({ + label: 'File', + submenu: [ + { + label: 'Preferences…', + accelerator: 'CmdOrCtrl+,', + click() { + mainWindow.webContents.send('showSettings'); + }, + }, + { type: 'separator' }, + { role: 'close' }, + { role: 'quit' }, + ], + }); } const menu = Menu.buildFromTemplate(template); diff --git a/desktop/tray.js b/desktop/tray.js index 05453c6..7ac342f 100644 --- a/desktop/tray.js +++ b/desktop/tray.js @@ -1,7 +1,7 @@ import path from 'path'; import electron from 'electron'; import { ipcMain } from 'electron'; - +import { ipcRenderer } from 'electron'; import config from './config'; const app = electron.app; @@ -12,8 +12,15 @@ const newTray = win => { const contextMenu = electron.Menu.buildFromTemplate([ { - role: 'quit', + label: 'Preferences…', + accelerator: 'CmdOrCtrl+,', + click() { + win.webContents.send('showSettings'); + win.show(); + }, }, + { type: 'separator' }, + { role: 'quit' }, ]); tray = new electron.Tray( @@ -23,6 +30,7 @@ const newTray = win => { // https://github.com/electron/electron/issues/1825 tray.setHighlightMode(false); tray.setToolTip(`${app.getName()}`); + tray.setContextMenu(contextMenu); tray.on('click', e => { // Not sure why right click event doesn't work for me so doing manually if (e.ctrlKey) { @@ -31,6 +39,7 @@ const newTray = win => { toggleWin(); } }); + // macOS Windows tray.on('right-click', () => tray.popUpContextMenu(contextMenu)); tray.on('double-click', () => toggleWin()); return tray; @@ -43,8 +52,10 @@ const create = (app, mainWindow) => { if (tray) { if (config.get('priceSetting')) { tray.setTitle(change); + tray.setToolTip(`${app.getName()} ` + change); } else { tray.setTitle(''); + tray.setToolTip(`${app.getName()}`); } } }); diff --git a/package.json b/package.json index a472dc8..e92c8f9 100644 --- a/package.json +++ b/package.json @@ -25,10 +25,21 @@ }, "build": { "appId": "com.jorilallo.lionshare", - "icon": "src/assets/icons/appicon.icns", + "icon": "src/assets/icons/icon.icns", "files": "!dist/*", "mac": { "target": "zip" + }, + "linux": { + "target": "snap" + }, + "snap": { + "plugs": [ + "default" + ], + "after": [ + "desktop-gtk2" + ] } }, "author": "Jori Lallo , Ben Jennings , Maksim Stepanenko ", @@ -45,7 +56,9 @@ "babel-preset-stage-0": "^6.5.0", "chart.js": "^2.4", "classnames": "^2.2.5", - "electron": "^1.4.15", + "electron-config": "^0.2.1", + "electron-is-dev": "^0.1.2", + "electron-machine-id": "^1.0.9", "lodash": "^4.17.2", "mobx": "^2.2.2", "mobx-react": "^4.0.3", @@ -63,7 +76,8 @@ "cross-env": "^1.0.7", "css-loader": "^0.23.1", "dotenv": "^2.0.0", - "electron-builder": "^12.3.1", + "electron": "^1.4.15", + "electron-builder": "^19.50.0", "electron-config": "^0.2.1", "electron-is-dev": "^0.1.2", "electron-machine-id": "^1.0.9", @@ -83,7 +97,7 @@ "node-sass": "^3.4.2", "node-static": "^0.7.7", "pre-commit": "^1.2.2", - "prettier": "git+ssh://git@github.com/prettier/prettier.git", + "prettier": "https://github.com/prettier/prettier.git", "rebass": "^0.2.6", "resolve-url": "^0.2.1", "resolve-url-loader": "^1.4.3", diff --git a/src/assets/icons/icon.icns b/src/assets/icons/icon.icns new file mode 100644 index 0000000..9712143 Binary files /dev/null and b/src/assets/icons/icon.icns differ