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) => {
|
electron.ipcMain.handle("update-store-mtt", (event, value) => {
|
||||||
// listen for close event
|
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._win.hide();
|
||||||
this.SetContextMenu(false);
|
this.SetContextMenu(false);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
this._win.on("close", (e :any) => {
|
this._win.on("close", (e :any) => {
|
||||||
if (this._forceQuit || this._store.general["close_behavior"] == '0' ) {
|
if (this._forceQuit || this._store.general["close_behavior"] == '0' ) {
|
||||||
|
|
|
@ -3533,22 +3533,8 @@ const app = new Vue({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
closeWindow(){
|
closeWindow(){
|
||||||
switch (app.cfg.general.close_behavior) {
|
// window.close doesnt call the win "close" event for some reason
|
||||||
case 0:
|
ipcRenderer.send('win-close');
|
||||||
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;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -763,6 +763,8 @@
|
||||||
},
|
},
|
||||||
sendDataToMTT: function () {
|
sendDataToMTT: function () {
|
||||||
ipcRenderer.invoke('setStoreValue', 'general.close_behavior', app.cfg.general.close_behavior);
|
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