mirror of
https://github.com/GiriNeko/YesPlayMusic.git
synced 2025-12-16 21:28:06 +00:00
feat(electron): add minimize to tray option to settings page
This commit is contained in:
parent
09c54486cc
commit
de7d008c0b
8 changed files with 67 additions and 13 deletions
|
|
@ -43,7 +43,7 @@ class Background {
|
|||
this.createExpressApp();
|
||||
|
||||
// init ipcMain
|
||||
initIpcMain(this.window);
|
||||
initIpcMain(this.window, this.store);
|
||||
|
||||
// Scheme must be registered before the app is ready
|
||||
protocol.registerSchemesAsPrivileged([
|
||||
|
|
@ -103,11 +103,6 @@ class Background {
|
|||
// hide menu bar on Microsoft Windows and Linux
|
||||
this.window.setMenuBarVisibility(false);
|
||||
|
||||
// create tray only for Microsoft windows
|
||||
if (process.platform === "win32") {
|
||||
this.tray = createTray(this.window);
|
||||
}
|
||||
|
||||
if (process.env.WEBPACK_DEV_SERVER_URL) {
|
||||
// Load the url of the dev server if in development mode
|
||||
this.window.loadURL(process.env.WEBPACK_DEV_SERVER_URL);
|
||||
|
|
@ -172,7 +167,11 @@ class Background {
|
|||
});
|
||||
|
||||
this.window.on("minimize", () => {
|
||||
if (process.platform === "win32") {
|
||||
if (
|
||||
["win32", "linux"].includes(process.platform) &&
|
||||
this.store.get("settings.minimizeToTray")
|
||||
) {
|
||||
this.tray = createTray(this.window);
|
||||
this.window.hide();
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue