fix close button inconsistency
This commit is contained in:
parent
6fc3de9e9f
commit
8c7ae2b7e9
3 changed files with 28 additions and 8 deletions
|
@ -10,6 +10,7 @@ export default class MinimizeToTray {
|
||||||
private _app: any;
|
private _app: any;
|
||||||
private _store: any;
|
private _store: any;
|
||||||
private _tray: any;
|
private _tray: any;
|
||||||
|
private _forceQuit = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base Plugin Details (Eventually implemented into a GUI in settings)
|
* Base Plugin Details (Eventually implemented into a GUI in settings)
|
||||||
|
@ -46,7 +47,7 @@ export default class MinimizeToTray {
|
||||||
{
|
{
|
||||||
label: 'Quit',
|
label: 'Quit',
|
||||||
click: function () {
|
click: function () {
|
||||||
self._app.quit();
|
self._forceQuit = true; self._app.quit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]));
|
]));
|
||||||
|
@ -70,7 +71,7 @@ export default class MinimizeToTray {
|
||||||
{
|
{
|
||||||
label: 'Quit',
|
label: 'Quit',
|
||||||
click: function () {
|
click: function () {
|
||||||
self._app.quit();
|
self._forceQuit = true; self._app.quit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]));
|
]));
|
||||||
|
@ -122,7 +123,22 @@ export default class MinimizeToTray {
|
||||||
// listen for close event
|
// listen for close event
|
||||||
this._win.hide();
|
this._win.hide();
|
||||||
this.SetContextMenu(false);
|
this.SetContextMenu(false);
|
||||||
});
|
});
|
||||||
|
electron.ipcMain.handle("update-store-mtt", (event, value) => {
|
||||||
|
this._store.general["close_behavior"] = value;
|
||||||
|
})
|
||||||
|
this._win.on("close", (e :any) => {
|
||||||
|
if (this._forceQuit || this._store.general["close_behavior"] == '0' ) {
|
||||||
|
this._app.exit();
|
||||||
|
} else if (this._store.general["close_behavior"] == '1') {
|
||||||
|
e.preventDefault();
|
||||||
|
this._win.minimize();
|
||||||
|
} else {
|
||||||
|
e.preventDefault();
|
||||||
|
this._win.hide();
|
||||||
|
this.SetContextMenu(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -3434,7 +3434,8 @@ const app = new Vue({
|
||||||
switch (app.cfg.general.close_behavior) {
|
switch (app.cfg.general.close_behavior) {
|
||||||
case 0:
|
case 0:
|
||||||
case '0':
|
case '0':
|
||||||
ipcRenderer.send('close');
|
// the minimizeToTray plugin will handle this
|
||||||
|
window.close();
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
case '1':
|
case '1':
|
||||||
|
|
|
@ -546,10 +546,10 @@
|
||||||
{{$root.getLz("settings.option.experimental.closeButtonBehaviour")}}
|
{{$root.getLz("settings.option.experimental.closeButtonBehaviour")}}
|
||||||
</div>
|
</div>
|
||||||
<div class="md-option-segment md-option-segment_auto">
|
<div class="md-option-segment md-option-segment_auto">
|
||||||
<select class="md-select" v-model="app.cfg.general.close_behavior">
|
<select class="md-select" v-model="app.cfg.general.close_behavior" @change="sendDataToMTT()">
|
||||||
<option value='0'>{{$root.getLz("settings.option.experimental.closeButtonBehaviour.quit")}}</option>
|
<option value="0">{{$root.getLz("settings.option.experimental.closeButtonBehaviour.quit")}}</option>
|
||||||
<option value='1'>{{$root.getLz("settings.option.experimental.closeButtonBehaviour.minimizeTaskbar")}}</option>
|
<option value="1">{{$root.getLz("settings.option.experimental.closeButtonBehaviour.minimizeTaskbar")}}</option>
|
||||||
<option value='2'>{{$root.getLz("settings.option.experimental.closeButtonBehaviour.minimizeTray")}}</option>
|
<option value="2">{{$root.getLz("settings.option.experimental.closeButtonBehaviour.minimizeTray")}}</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -695,6 +695,9 @@
|
||||||
},
|
},
|
||||||
toggleUserInfo: function () {
|
toggleUserInfo: function () {
|
||||||
app.chrome.hideUserInfo = !app.cfg.visual.showuserinfo
|
app.chrome.hideUserInfo = !app.cfg.visual.showuserinfo
|
||||||
|
},
|
||||||
|
sendDataToMTT: function() {
|
||||||
|
window.ipcRenderer.invoke('update-store-mtt', app.cfg.general.close_behavior);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue