Skip to content

Commit

Permalink
Prevent main window from being shown when launched at login (wulkano#242
Browse files Browse the repository at this point in the history
)
  • Loading branch information
albinekb authored and sindresorhus committed Oct 27, 2017
1 parent bf0e3dc commit 7e84fe6
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions app/src/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import analytics from './analytics';
import {applicationMenu, cogMenu} from './menus';
import plugins from './plugins';

const {wasOpenedAtLogin} = app.getLoginItemSettings();

const menubar = require('menubar')({
index: `file://${__dirname}/../renderer/views/main.html`,
icon: path.join(__dirname, '..', '..', 'static', 'menubarDefaultTemplate.png'),
Expand Down Expand Up @@ -344,6 +346,11 @@ menubar.on('after-create-window', () => {
});

mainWindow.once('ready-to-show', () => {
// If Kap was launched at login, don't show the window
if (wasOpenedAtLogin) {
return;
}

positioner.move('trayCenter', tray.getBounds()); // Not sure why the fuck this is needed (ノಠдಠ)ノ︵┻━┻
mainWindow.show();
});
Expand Down

0 comments on commit 7e84fe6

Please sign in to comment.