mirror of
https://github.com/GiriNeko/YesPlayMusic.git
synced 2025-12-16 21:28:06 +00:00
fix(electron): set appearance during init of electron window (#525)
resolve #512
This commit is contained in:
parent
1e7274e97f
commit
43a293da6a
2 changed files with 10 additions and 0 deletions
|
|
@ -6,6 +6,7 @@ import {
|
||||||
shell,
|
shell,
|
||||||
dialog,
|
dialog,
|
||||||
globalShortcut,
|
globalShortcut,
|
||||||
|
nativeTheme,
|
||||||
} from "electron";
|
} from "electron";
|
||||||
import { createProtocol } from "vue-cli-plugin-electron-builder/lib";
|
import { createProtocol } from "vue-cli-plugin-electron-builder/lib";
|
||||||
import { startNeteaseMusicApi } from "./electron/services";
|
import { startNeteaseMusicApi } from "./electron/services";
|
||||||
|
|
@ -93,6 +94,8 @@ class Background {
|
||||||
createWindow() {
|
createWindow() {
|
||||||
console.log("creating app window");
|
console.log("creating app window");
|
||||||
|
|
||||||
|
const appearance = this.store.get("settings.appearance");
|
||||||
|
|
||||||
this.window = new BrowserWindow({
|
this.window = new BrowserWindow({
|
||||||
width: this.store.get("window.width") || 1440,
|
width: this.store.get("window.width") || 1440,
|
||||||
height: this.store.get("window.height") || 840,
|
height: this.store.get("window.height") || 840,
|
||||||
|
|
@ -107,6 +110,12 @@ class Background {
|
||||||
enableRemoteModule: true,
|
enableRemoteModule: true,
|
||||||
contextIsolation: false,
|
contextIsolation: false,
|
||||||
},
|
},
|
||||||
|
backgroundColor:
|
||||||
|
((appearance === undefined || appearance === "auto") &&
|
||||||
|
nativeTheme.shouldUseDarkColors) ||
|
||||||
|
appearance === "dark"
|
||||||
|
? "#222"
|
||||||
|
: "#fff",
|
||||||
});
|
});
|
||||||
|
|
||||||
// hide menu bar on Microsoft Windows and Linux
|
// hide menu bar on Microsoft Windows and Linux
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ export function getSendSettingsPlugin() {
|
||||||
ipcRenderer.send("settings", {
|
ipcRenderer.send("settings", {
|
||||||
minimizeToTray: state.settings.minimizeToTray,
|
minimizeToTray: state.settings.minimizeToTray,
|
||||||
enableGlobalShortcut: state.settings.enableGlobalShortcut,
|
enableGlobalShortcut: state.settings.enableGlobalShortcut,
|
||||||
|
appearance: state.settings.appearance,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue