Merge pull request #230 from Razzeee/hide-autostart

Hide on autostart
This commit is contained in:
Yuya Ochiai
2016-09-14 01:04:01 +09:00
committed by GitHub
3 changed files with 22 additions and 8 deletions

View File

@@ -14,7 +14,8 @@ var AutoLaunch = require('auto-launch');
var appLauncher = new AutoLaunch({ var appLauncher = new AutoLaunch({
name: 'Mattermost' name: 'Mattermost',
isHidden: true
}); });
function backToIndex() { function backToIndex() {

View File

@@ -20,7 +20,8 @@ if (process.platform === 'win32') {
if (cmd === '--squirrel-uninstall') { if (cmd === '--squirrel-uninstall') {
var AutoLaunch = require('auto-launch'); var AutoLaunch = require('auto-launch');
var appLauncher = new AutoLaunch({ var appLauncher = new AutoLaunch({
name: 'Mattermost' name: 'Mattermost',
isHidden: true
}); });
appLauncher.isEnabled().then(function(enabled) { appLauncher.isEnabled().then(function(enabled) {
if (enabled) if (enabled)
@@ -40,7 +41,8 @@ var certificateStore = require('./main/certificateStore').load(path.resolve(app.
var appMenu = require('./main/menus/app'); var appMenu = require('./main/menus/app');
const allowProtocolDialog = require('./main/allowProtocolDialog'); const allowProtocolDialog = require('./main/allowProtocolDialog');
var argv = require('yargs').argv; var argv = require('yargs')
.parse(process.argv.slice(1));
var client = null; var client = null;
if (argv.livereload) { if (argv.livereload) {
@@ -50,6 +52,12 @@ if (argv.livereload) {
}); });
} }
var hideOnStartup;
if (argv.hidden) {
hideOnStartup = true;
}
// TODO: We should document this if that hasn't been done already
if (argv['config-file']) { if (argv['config-file']) {
global['config-file'] = argv['config-file']; global['config-file'] = argv['config-file'];
} }
@@ -364,11 +372,16 @@ app.on('ready', function() {
}); });
mainWindow.setFullScreenable(true); // fullscreenable option has no effect. mainWindow.setFullScreenable(true); // fullscreenable option has no effect.
if (window_options.maximized) { if (hideOnStartup) {
mainWindow.maximize(); mainWindow.minimize();
} }
if (window_options.fullscreen) { else {
mainWindow.setFullScreen(true); if (window_options.maximized) {
mainWindow.maximize();
}
if (window_options.fullscreen) {
mainWindow.setFullScreen(true);
}
} }
// and load the index.html of the app. // and load the index.html of the app.

View File

@@ -14,7 +14,7 @@
"electron-connect": "~0.3.9" "electron-connect": "~0.3.9"
}, },
"dependencies": { "dependencies": {
"auto-launch": "^2.1.0", "auto-launch": "^4.0.1",
"bootstrap": "^3.3.7", "bootstrap": "^3.3.7",
"electron-context-menu": "^0.5.0", "electron-context-menu": "^0.5.0",
"electron-squirrel-startup": "^1.0.0", "electron-squirrel-startup": "^1.0.0",