mirror of
https://github.com/Llewellynvdm/nativefier.git
synced 2024-11-11 07:41:04 +00:00
Merge branch 'feature/window-state-manager' of https://github.com/zweicoder/nativefier into zweicoder-feature/window-state-manager
# Conflicts: # app/src/components/mainWindow/mainWindow.js # app/src/main.js
This commit is contained in:
commit
9b3fd029c1
@ -4,6 +4,7 @@
|
||||
"description": "Placeholder for the nativefier cli to override with a target url",
|
||||
"main": "lib/main.js",
|
||||
"dependencies": {
|
||||
"electron-window-state": "^2.0.0",
|
||||
"wurl": "^2.1.0"
|
||||
},
|
||||
"devDependencies": {},
|
||||
|
@ -1,8 +1,8 @@
|
||||
var path = require('path');
|
||||
var electron = require('electron');
|
||||
var windowStateKeeper = require('electron-window-state');
|
||||
var helpers = require('./../../helpers/helpers');
|
||||
var createMenu = require('./../menu/menu');
|
||||
|
||||
var BrowserWindow = electron.BrowserWindow;
|
||||
var shell = electron.shell;
|
||||
var isOSX = helpers.isOSX;
|
||||
@ -18,10 +18,16 @@ const ZOOM_INTERVAL = 0.1;
|
||||
* @returns {electron.BrowserWindow}
|
||||
*/
|
||||
function createMainWindow(options, onAppQuit, setDockBadge) {
|
||||
var mainWindowState = windowStateKeeper({
|
||||
defaultWidth: options.width || 1280,
|
||||
defaultHeight: options.height || 800
|
||||
});
|
||||
var mainWindow = new BrowserWindow(
|
||||
{
|
||||
width: options.width || 1280,
|
||||
height: options.height || 800,
|
||||
width: mainWindowState.width,
|
||||
height: mainWindowState.height,
|
||||
x: mainWindowState.x,
|
||||
y: mainWindowState.y,
|
||||
title: options.name,
|
||||
'web-preferences': {
|
||||
javascript: true,
|
||||
@ -97,6 +103,7 @@ function createMainWindow(options, onAppQuit, setDockBadge) {
|
||||
maybeHideWindow(mainWindow, event)
|
||||
});
|
||||
|
||||
mainWindowState.manage(mainWindow);
|
||||
return mainWindow;
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,6 @@ var electron = require('electron');
|
||||
var createMainWindow = require('./components/mainWindow/mainWindow');
|
||||
var createLoginWindow = require('./components/login/loginWindow');
|
||||
var helpers = require('./helpers/helpers');
|
||||
|
||||
var app = electron.app;
|
||||
var ipcMain = electron.ipcMain;
|
||||
var isOSX = helpers.isOSX;
|
||||
@ -66,6 +65,5 @@ ipcMain.on('notification', function(event, title, opts) {
|
||||
if (!isOSX() || mainWindow.isFocused()) {
|
||||
return;
|
||||
}
|
||||
|
||||
setDockBadge('●');
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user