Skip to content

Commit ba40071

Browse files
authored
feat: Hide app's dock icon (gitify-app#447)
* feat: Hide app's dock icon * chore: Delay calling app.dock.hide
1 parent a4a795f commit ba40071

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

first-run.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,4 @@ function isFirstRun() {
5050
return true;
5151
}
5252

53-
module.exports = { onFirstRunMaybe }
54-
53+
module.exports = { onFirstRunMaybe };

main.js

+17-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@ const { autoUpdater } = require('electron-updater');
44
const { onFirstRunMaybe } = require('./first-run');
55
const path = require('path');
66

7-
const iconIdle = path.join(__dirname, 'assets', 'images', 'tray-idleTemplate.png');
7+
const iconIdle = path.join(
8+
__dirname,
9+
'assets',
10+
'images',
11+
'tray-idleTemplate.png'
12+
);
813
const iconActive = path.join(__dirname, 'assets', 'images', 'tray-active.png');
914

1015
const browserWindowOpts = {
@@ -17,12 +22,20 @@ const browserWindowOpts = {
1722
enableRemoteModule: true,
1823
overlayScrollbars: true,
1924
nodeIntegration: true,
25+
contextIsolation: false,
2026
},
2127
};
2228

29+
const delayedHideAppIcon = () =>
30+
// Setting a timeout because the showDockIcon is not currently working
31+
// See more at https://github.com/maxogden/menubar/issues/306
32+
setTimeout(() => {
33+
app.dock.hide();
34+
}, 1500);
35+
2336
app.on('ready', async () => {
2437
await onFirstRunMaybe();
25-
})
38+
});
2639

2740
const menubarApp = menubar({
2841
icon: iconIdle,
@@ -32,6 +45,8 @@ const menubarApp = menubar({
3245
});
3346

3447
menubarApp.on('ready', () => {
48+
delayedHideAppIcon();
49+
3550
menubarApp.tray.setIgnoreDoubleClickEvents(true);
3651

3752
autoUpdater.checkForUpdatesAndNotify();

0 commit comments

Comments
 (0)