mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-10 10:11:46 +00:00
Option to restart the app on config changes
This commit is contained in:
@ -11,6 +11,7 @@ const defaultConfig = {
|
||||
hideMenu: false,
|
||||
startAtLogin: false,
|
||||
disableHardwareAcceleration: false,
|
||||
restartOnConfigChanges: false,
|
||||
},
|
||||
plugins: {
|
||||
// Enabled plugins
|
||||
|
||||
@ -13,6 +13,9 @@ module.exports = {
|
||||
get,
|
||||
set,
|
||||
edit: () => store.openInEditor(),
|
||||
watch: (cb) => store.onDidAnyChange(cb),
|
||||
watch: (cb) => {
|
||||
store.onDidChange("options", cb);
|
||||
store.onDidChange("plugins", cb);
|
||||
},
|
||||
plugins,
|
||||
};
|
||||
|
||||
9
index.js
9
index.js
@ -189,9 +189,12 @@ app.on("activate", () => {
|
||||
app.on("ready", () => {
|
||||
mainWindow = createMainWindow();
|
||||
setApplicationMenu(mainWindow);
|
||||
config.watch(() => {
|
||||
setApplicationMenu(mainWindow);
|
||||
});
|
||||
if (config.get("options.restartOnConfigChanges")) {
|
||||
config.watch(() => {
|
||||
app.relaunch();
|
||||
app.exit();
|
||||
});
|
||||
}
|
||||
setUpTray(app, mainWindow);
|
||||
|
||||
// Autostart at login
|
||||
|
||||
8
menu.js
8
menu.js
@ -50,6 +50,14 @@ const mainMenuTemplate = (win) => [
|
||||
config.set("options.disableHardwareAcceleration", item.checked);
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "Restart on config changes",
|
||||
type: "checkbox",
|
||||
checked: config.get("options.restartOnConfigChanges"),
|
||||
click: (item) => {
|
||||
config.set("options.restartOnConfigChanges", item.checked);
|
||||
},
|
||||
},
|
||||
...(is.windows() || is.linux()
|
||||
? [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user