Hide from Dock on macOS when the tray icon is enabled and the window is closed
This commit is contained in:
parent
bc6d549f20
commit
ffb0b5a27b
3 changed files with 29 additions and 0 deletions
|
@ -2,6 +2,7 @@ const path = require('path');
|
|||
|
||||
const fs = require('fs');
|
||||
const { app, Menu, Tray } = require('electron');
|
||||
const dockIcon = require('./dock_icon');
|
||||
|
||||
let trayContextMenu = null;
|
||||
let tray = null;
|
||||
|
@ -34,8 +35,10 @@ function createTrayIcon(getMainWindow, messages) {
|
|||
if (mainWindow) {
|
||||
if (mainWindow.isVisible()) {
|
||||
mainWindow.hide();
|
||||
dockIcon.hide();
|
||||
} else {
|
||||
mainWindow.show();
|
||||
dockIcon.show();
|
||||
|
||||
tray.forceOnTop(mainWindow);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue