[MM-27332] show window at autolaunch (#1379)

This commit is contained in:
Guillermo Vayá
2020-10-05 09:10:34 +02:00
committed by GitHub
parent 1979721ac9
commit 3182a9d0b1
5 changed files with 5 additions and 17 deletions

View File

@@ -699,8 +699,6 @@ export default class SettingsPage extends React.Component {
{'Start app on login'} {'Start app on login'}
<HelpBlock> <HelpBlock>
{'If enabled, the app starts automatically when you log in to your machine.'} {'If enabled, the app starts automatically when you log in to your machine.'}
{' '}
{'The app will initially start minimized and appear on the taskbar.'}
</HelpBlock> </HelpBlock>
</Checkbox>); </Checkbox>);
} }

View File

@@ -29,7 +29,6 @@ import downloadURL from './main/downloadURL';
import allowProtocolDialog from './main/allowProtocolDialog'; import allowProtocolDialog from './main/allowProtocolDialog';
import AppStateManager from './main/AppStateManager'; import AppStateManager from './main/AppStateManager';
import initCookieManager from './main/cookieManager'; import initCookieManager from './main/cookieManager';
import {shouldBeHiddenOnStartup} from './main/utils';
import SpellChecker from './main/SpellChecker'; import SpellChecker from './main/SpellChecker';
import UserActivityMonitor from './main/UserActivityMonitor'; import UserActivityMonitor from './main/UserActivityMonitor';
import Utils from './utils/util'; import Utils from './utils/util';
@@ -60,7 +59,6 @@ const certificateErrorCallbacks = new Map();
// be closed automatically when the JavaScript object is garbage collected. // be closed automatically when the JavaScript object is garbage collected.
let mainWindow = null; let mainWindow = null;
let popupWindow = null; let popupWindow = null;
let hideOnStartup = null;
let certificateStore = null; let certificateStore = null;
let trustedOriginsStore = null; let trustedOriginsStore = null;
let spellChecker = null; let spellChecker = null;
@@ -152,8 +150,6 @@ function initializeArgs() {
process.exit(0); // eslint-disable-line no-process-exit process.exit(0); // eslint-disable-line no-process-exit
} }
hideOnStartup = shouldBeHiddenOnStartup(global.args);
global.isDev = isDev && !global.args.disableDevMode; // this doesn't seem to be right and isn't used as the single source of truth global.isDev = isDev && !global.args.disableDevMode; // this doesn't seem to be right and isn't used as the single source of truth
if (global.args.dataDir) { if (global.args.dataDir) {
@@ -703,7 +699,6 @@ function initializeAfterAppReady() {
initCookieManager(session.defaultSession); initCookieManager(session.defaultSession);
mainWindow = createMainWindow(config.data, { mainWindow = createMainWindow(config.data, {
hideOnStartup,
trayIconShown: process.platform === 'win32' || config.showTrayIcon, trayIconShown: process.platform === 'win32' || config.showTrayIcon,
linuxAppIcon: path.join(assetsDir, 'appicon.png'), linuxAppIcon: path.join(assetsDir, 'appicon.png'),
deeplinkingUrl, deeplinkingUrl,

View File

@@ -25,7 +25,6 @@ function triageArgs(args) {
function parseArgs(args) { function parseArgs(args) {
return yargs. return yargs.
alias('hidden', 'h').boolean('hidden').describe('hidden', 'Launch the app in hidden mode.').
alias('dataDir', 'd').string('dataDir').describe('dataDir', 'Set the path to where user data is stored.'). alias('dataDir', 'd').string('dataDir').describe('dataDir', 'Set the path to where user data is stored.').
alias('disableDevMode', 'p').boolean('disableDevMode').describe('disableDevMode', 'Disable development mode. Allows for testing as if it was Production.'). alias('disableDevMode', 'p').boolean('disableDevMode').describe('disableDevMode', 'Disable development mode. Allows for testing as if it was Production.').
alias('version', 'v').boolean('version').describe('version', 'Prints the application version.'). alias('version', 'v').boolean('version').describe('version', 'Prints the application version.').

View File

@@ -9,7 +9,6 @@ async function upgradeAutoLaunch() {
} }
const appLauncher = new AutoLaunch({ const appLauncher = new AutoLaunch({
name: 'Mattermost', name: 'Mattermost',
isHidden: true,
}); });
const enabled = await appLauncher.isEnabled(); const enabled = await appLauncher.isEnabled();
if (enabled) { if (enabled) {

View File

@@ -44,7 +44,6 @@ function createMainWindow(config, options) {
windowOptions = {width: defaultWindowWidth, height: defaultWindowHeight}; windowOptions = {width: defaultWindowWidth, height: defaultWindowHeight};
} }
const {hideOnStartup} = options;
const {maximized: windowIsMaximized} = windowOptions; const {maximized: windowIsMaximized} = windowOptions;
if (process.platform === 'linux') { if (process.platform === 'linux') {
@@ -81,18 +80,16 @@ function createMainWindow(config, options) {
// handle showing the window when not launched by auto-start // handle showing the window when not launched by auto-start
// - when not configured to auto-start, immediately show contents and optionally maximize as needed // - when not configured to auto-start, immediately show contents and optionally maximize as needed
if (!hideOnStartup) { mainWindow.show();
mainWindow.show(); if (windowIsMaximized) {
if (windowIsMaximized) { mainWindow.maximize();
mainWindow.maximize();
}
} }
}); });
mainWindow.once('show', () => { mainWindow.once('show', () => {
// handle showing the app when hidden to the tray icon by auto-start // handle showing the app when hidden to the tray icon by auto-start
// - optionally maximize the window as needed // - optionally maximize the window as needed
if (hideOnStartup && windowIsMaximized) { if (windowIsMaximized) {
mainWindow.maximize(); mainWindow.maximize();
} }
}); });
@@ -100,7 +97,7 @@ function createMainWindow(config, options) {
mainWindow.once('restore', () => { mainWindow.once('restore', () => {
// handle restoring the window when minimized to the app icon by auto-start // handle restoring the window when minimized to the app icon by auto-start
// - optionally maximize the window as needed // - optionally maximize the window as needed
if (hideOnStartup && windowIsMaximized) { if (windowIsMaximized) {
mainWindow.maximize(); mainWindow.maximize();
} }
}); });