some fixes to minimize to tray
This commit is contained in:
parent
277e359aa9
commit
9c83baa0a8
3 changed files with 18 additions and 21 deletions
|
@ -119,10 +119,19 @@ export default class MinimizeToTray {
|
|||
}
|
||||
}
|
||||
})
|
||||
electron.ipcMain.on("minimizeTray", (event, value) => {
|
||||
// listen for close event
|
||||
electron.ipcMain.handle("update-store-mtt", (event, value) => {
|
||||
this._store.general["close_behavior"] = value;
|
||||
})
|
||||
electron.ipcMain.on("win-close", (event, value) => {
|
||||
console.log("tray", this._store.general["close_behavior"] )
|
||||
if (this._forceQuit || this._store.general["close_behavior"] == '0' ) {
|
||||
this._app.quit();
|
||||
} else if (this._store.general["close_behavior"] == '1') {
|
||||
this._win.minimize();
|
||||
} else {
|
||||
this._win.hide();
|
||||
this.SetContextMenu(false);
|
||||
}
|
||||
});
|
||||
this._win.on("close", (e :any) => {
|
||||
if (this._forceQuit || this._store.general["close_behavior"] == '0' ) {
|
||||
|
|
|
@ -3533,22 +3533,8 @@ const app = new Vue({
|
|||
}
|
||||
},
|
||||
closeWindow(){
|
||||
switch (app.cfg.general.close_behavior) {
|
||||
case 0:
|
||||
case '0':
|
||||
// the minimizeToTray plugin will handle this
|
||||
window.close();
|
||||
break;
|
||||
case 1:
|
||||
case '1':
|
||||
ipcRenderer.send('minimize');
|
||||
break;
|
||||
case 2:
|
||||
case '2':
|
||||
ipcRenderer.send('minimizeTray');
|
||||
break;
|
||||
|
||||
}
|
||||
// window.close doesnt call the win "close" event for some reason
|
||||
ipcRenderer.send('win-close');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -763,6 +763,8 @@
|
|||
},
|
||||
sendDataToMTT: function () {
|
||||
ipcRenderer.invoke('setStoreValue', 'general.close_behavior', app.cfg.general.close_behavior);
|
||||
// setStoreValue does not change plugin store values somehow
|
||||
ipcRenderer.invoke('update-store-mtt', app.cfg.general.close_behavior);
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue