Skip to content

Commit

Permalink
Merge pull request #188 from ohaiibuzzle/master
Browse files Browse the repository at this point in the history
fix: make main window hidable on Windows
  • Loading branch information
SadeghHayeri authored Oct 29, 2024
2 parents 4aec85b + de6fe20 commit afcd69d
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 afcd69d

Please sign in to comment.