From 825662f289db9814998ff561fb703a8ab48d9f75 Mon Sep 17 00:00:00 2001 From: Harsh Vakharia Date: Fri, 6 Jan 2017 10:40:46 +0530 Subject: [PATCH] Fix window blur problem on windows --- package.json | 2 +- src/main.js | 36 ++++++++++++++++++------------------ src/package.json | 2 +- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/package.json b/package.json index 833e88e..8b6f9b5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "donut", - "version": "2.2.0", + "version": "2.2.1-alpha.1", "description": "Cross platform cryptocurrency tracker", "main": "main.js", "scripts": { diff --git a/src/main.js b/src/main.js index 472535e..4d598b0 100644 --- a/src/main.js +++ b/src/main.js @@ -4,21 +4,27 @@ const { app, ipcMain } = require('electron') const platform = os.platform() -const width = 360 -const height = 600 +// All platforms +const browserWindowConfig = { + icon: path.join(__dirname, 'icon.png'), + width: 360, + height: 600, + alwaysOnTop: platform === 'win32', + fullscreen: false, + fullscreenable: false, + resizable: false +} + +// Menubar (For macOS and Windows) +const menuBarConfig = { + preloadWindow: true, + showDockIcon: false +} if (platform === 'darwin' || platform === 'win32') { const menubar = require('menubar') - const mb = menubar({ - preloadWindow: true, - showDockIcon: false, - icon: path.join(__dirname, 'icon.png'), - width: width, - height: height - }) - - mb.on('after-create-window', () => mb.window.setResizable(false)) + const mb = menubar(Object.assign(browserWindowConfig, menuBarConfig)) app.on('ready', () => { mb.tray.setTitle('Donut') @@ -32,13 +38,7 @@ if (platform === 'darwin' || platform === 'win32') { const { BrowserWindow } = require('electron') app.on('ready', () => { - let win = new BrowserWindow({ - width: width, - height: height, - fullscreen: false, - fullscreenable: false, - resizable: false - }) + let win = new BrowserWindow(browserWindowConfig) win.on('closed', () => { win = null diff --git a/src/package.json b/src/package.json index f4b0b39..c14ef79 100644 --- a/src/package.json +++ b/src/package.json @@ -4,7 +4,7 @@ "description": "Cross platform cryptocurrency tracker", "homepage": "https://harshjv.github.io/donut/", "license": "MIT", - "version": "2.2.0", + "version": "2.2.1-alpha.1", "main": "main.js", "repository": "https://github.com/harshjv/donut", "keywords": [