From 9aaae7b2d93feaefeebebc30b06f92fc232e784e Mon Sep 17 00:00:00 2001 From: Nico Nowakowski Date: Thu, 4 Mar 2021 14:14:49 +0100 Subject: [PATCH] :rocket: Added function to toggle resuming of last song when app starts --- config/defaults.js | 1 + index.js | 3 ++- menu.js | 8 ++++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/config/defaults.js b/config/defaults.js index 31d11f3b..cf417b58 100644 --- a/config/defaults.js +++ b/config/defaults.js @@ -14,6 +14,7 @@ const defaultConfig = { restartOnConfigChanges: false, trayClickPlayPause: false, autoResetAppCache: false, + resumeSongOnStart: true }, plugins: { // Enabled plugins diff --git a/index.js b/index.js index 915c5069..44631d0e 100644 --- a/index.js +++ b/index.js @@ -111,7 +111,8 @@ function createMainWindow() { win.maximize(); } - win.webContents.loadURL(config.get("url")); + const urlToLoad = config.get("resumeOnStart") ? config.get("url") : "https://music.youtube.com"; + win.webContents.loadURL(urlToLoad); win.on("closed", onClosed); win.on("move", () => { diff --git a/menu.js b/menu.js index 508b6b0a..14f8e04a 100644 --- a/menu.js +++ b/menu.js @@ -66,6 +66,14 @@ const mainMenuTemplate = (win) => [ config.set("options.autoResetAppCache", item.checked); }, }, + { + label: "Resume last song when app starts", + type: "checkbox", + checked: config.get("options.resumeSongOnStart"), + click: (item) => { + config.set("options.resumeSongOnStart", item.checked); + } + }, ...(is.windows() || is.linux() ? [ {