Hide on autostart

Closes #228
This commit is contained in:
Kolja Lampe 2016-08-02 21:29:24 +02:00
parent a0453b5865
commit bc154f56a7
3 changed files with 22 additions and 8 deletions

View file

@ -22,7 +22,8 @@ const ListGroupItem = ReactBootstrap.ListGroupItem;
const Glyphicon = ReactBootstrap.Glyphicon; const Glyphicon = ReactBootstrap.Glyphicon;
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.4.4" "electron-connect": "^0.4.4"
}, },
"dependencies": { "dependencies": {
"auto-launch": "^2.1.0", "auto-launch": "^4.0.1",
"bootstrap": "^3.3.7", "bootstrap": "^3.3.7",
"electron-squirrel-startup": "^1.0.0", "electron-squirrel-startup": "^1.0.0",
"os-locale": "^1.4.0", "os-locale": "^1.4.0",