Skip to content

Commit

Permalink
fix: make main window hidable on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
ohaiibuzzle committed May 9, 2024
1 parent 4aec85b commit de6fe20
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions gui/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,10 @@ function createWindow() {
height: 300,
x: stateManager.x,
y: stateManager.y,
maximizable: debug,
minimizable: debug,
fullscreenable: debug,
resizable: debug,
maximizable: false,
minimizable: true,
fullscreenable: false,
resizable: false,
icon: appIcon,
show: false,

Expand Down Expand Up @@ -154,9 +154,16 @@ app.on('ready', () => {
const iconPath = path.join(__dirname, 'images/iconTemplate.png');
const trayIcon = nativeImage.createFromPath(iconPath);
tray = new Tray(trayIcon);
tray.setIgnoreDoubleClickEvents(true);
tray.setToolTip('Green Tunnel');
tray.setContextMenu(Menu.buildFromTemplate(menuItems));

// Restore the window on a double click
tray.on('double-click', () => {
if(win.isVisible())
win.hide();
else
win.show();
});
});

app.on('before-quit', async (e) => {
Expand All @@ -171,7 +178,7 @@ ipcMain.on('close-button', (event, arg) => {
if(os.platform() === 'darwin')
app.hide();
else
app.quit();
win.hide();
});

ipcMain.on('on-off-button', (event, arg) => {
Expand Down

0 comments on commit de6fe20

Please sign in to comment.