diff --git a/index.js b/index.js index dfb15bec..b7d5e99f 100644 --- a/index.js +++ b/index.js @@ -162,6 +162,10 @@ function createMainWindow() { win.maximize(); } + if(config.get("options.alwaysOnTop")){ + win.setAlwaysOnTop(true); + } + const urlToLoad = config.get("options.resumeOnStart") ? config.get("url") : config.defaultConfig.url; diff --git a/menu.js b/menu.js index 0f3448d3..5f6a112c 100644 --- a/menu.js +++ b/menu.js @@ -81,12 +81,25 @@ const mainMenuTemplate = (win) => { }, }, { - label: "Remove upgrade button", - type: "checkbox", - checked: config.get("options.removeUpgradeButton"), - click: (item) => { - config.setMenuOption("options.removeUpgradeButton", item.checked); - }, + label: "Visual Tweaks", + submenu: [ + { + label: "Remove upgrade button", + type: "checkbox", + checked: config.get("options.removeUpgradeButton"), + click: (item) => { + config.setMenuOption("options.removeUpgradeButton", item.checked); + }, + }, + { + label: "Force show like buttons", + type: "checkbox", + checked: config.get("options.ForceShowLikeButtons"), + click: (item) => { + config.set("options.ForceShowLikeButtons", item.checked); + }, + }, + ], }, { label: "Single instance lock", @@ -101,6 +114,15 @@ const mainMenuTemplate = (win) => { } }, }, + { + label: "Always on top", + type: "checkbox", + checked: config.get("options.alwaysOnTop"), + click: (item) => { + config.setMenuOption("options.alwaysOnTop", item.checked); + win.setAlwaysOnTop(item.checked); + }, + }, ...(is.windows() || is.linux() ? [ { diff --git a/plugins/lyrics-genius/front.js b/plugins/lyrics-genius/front.js index 4fcb3153..d000a13c 100644 --- a/plugins/lyrics-genius/front.js +++ b/plugins/lyrics-genius/front.js @@ -36,15 +36,10 @@ module.exports = () => { const wrapper = document.createElement("div"); wrapper.innerHTML = html; - const lyricsSelector1 = wrapper.querySelector(".lyrics"); - const lyricsSelector2 = wrapper.querySelector( - '[class^="Lyrics__Container"]' - ); - const lyrics = lyricsSelector1 - ? lyricsSelector1.innerHTML - : lyricsSelector2 - ? lyricsSelector2.innerHTML - : null; + + const lyrics = [...wrapper.querySelectorAll('[class^="Lyrics__Container"]')].map(d => d.innerHTML).join('
') + || wrapper.querySelector(".lyrics")?.innerHTML; + if (!lyrics) { return; } diff --git a/plugins/precise-volume/back.js b/plugins/precise-volume/back.js index 9636e18d..c33f23bb 100644 --- a/plugins/precise-volume/back.js +++ b/plugins/precise-volume/back.js @@ -1,3 +1,6 @@ +const { injectCSS } = require("../utils"); +const path = require("path"); + /* This is used to determine if plugin is actually active (not if its only enabled in options) @@ -8,6 +11,7 @@ const { globalShortcut } = require('electron'); module.exports = (win, options) => { enabled = true; + injectCSS(win.webContents, path.join(__dirname, "volume-hud.css")); if (options.globalShortcuts?.volumeUp) { globalShortcut.register((options.globalShortcuts.volumeUp), () => win.webContents.send('changeVolume', true)); diff --git a/plugins/precise-volume/front.js b/plugins/precise-volume/front.js index dcb6ea02..0bf3e36d 100644 --- a/plugins/precise-volume/front.js +++ b/plugins/precise-volume/front.js @@ -45,23 +45,21 @@ function firstRun() { // Change options from renderer to keep sync ipcRenderer.on("setOptions", (_event, newOptions = {}) => { - for (option in newOptions) { - options[option] = newOptions[option]; - } + Object.assign(options, newOptions) setMenuOptions("precise-volume", options); }); } function injectVolumeHud(noVid) { if (noVid) { - const position = "top: 18px; right: 60px; z-index: 999; position: absolute;"; - const mainStyle = "font-size: xx-large; padding: 10px; transition: opacity 1s; pointer-events: none;"; + const position = "top: 18px; right: 60px;"; + const mainStyle = "font-size: xx-large;"; $(".center-content.ytmusic-nav-bar").insertAdjacentHTML("beforeend", ``) } else { - const position = `top: 10px; left: 10px; z-index: 999; position: absolute;`; - const mainStyle = "font-size: xxx-large; padding: 10px; transition: opacity 0.6s; webkit-text-stroke: 1px black; font-weight: 600; pointer-events: none;"; + const position = `top: 10px; left: 10px;`; + const mainStyle = "font-size: xxx-large; webkit-text-stroke: 1px black; font-weight: 600;"; $("#song-video").insertAdjacentHTML('afterend', ``) @@ -189,8 +187,12 @@ function changeVolume(toIncrease) { function updateVolumeSlider() { // Slider value automatically rounds to multiples of 5 - $("#volume-slider").value = options.savedVolume > 0 && options.savedVolume < 5 ? - 5 : options.savedVolume; + for (const slider of ["#volume-slider", "#expand-volume-slider"]) { + $(slider).value = + options.savedVolume > 0 && options.savedVolume < 5 + ? 5 + : options.savedVolume; + } } let volumeHoverTimeoutID; diff --git a/plugins/precise-volume/volume-hud.css b/plugins/precise-volume/volume-hud.css new file mode 100644 index 00000000..618b94fc --- /dev/null +++ b/plugins/precise-volume/volume-hud.css @@ -0,0 +1,11 @@ +#volumeHud { + z-index: 999; + position: absolute; + transition: opacity 0.6s; + pointer-events: none; + padding: 10px; +} + +ytmusic-player[player-ui-state_="MINIPLAYER"] #volumeHud { + top: 0 !important; +} diff --git a/preload.js b/preload.js index 0e387f61..f508a6ae 100644 --- a/preload.js +++ b/preload.js @@ -77,9 +77,17 @@ function onApiLoaded() { // Remove upgrade button if (config.get("options.removeUpgradeButton")) { - const upgradeButtton = document.querySelector('ytmusic-pivot-bar-item-renderer[tab-id="SPunlimited"]') - if (upgradeButtton) { - upgradeButtton.style.display = "none"; + const upgradeButton = document.querySelector('ytmusic-pivot-bar-item-renderer[tab-id="SPunlimited"]') + if (upgradeButton) { + upgradeButton.style.display = "none"; + } + } + + // Force show like buttons + if (config.get("options.ForceShowLikeButtons")) { + const likeButtons = document.querySelector('ytmusic-like-button-renderer') + if (likeButtons) { + likeButtons.style.display = 'inherit'; } } } diff --git a/providers/prompt-options.js b/providers/prompt-options.js index 101b4f99..a34d3b1c 100644 --- a/providers/prompt-options.js +++ b/providers/prompt-options.js @@ -1,17 +1,18 @@ const path = require("path"); const is = require("electron-is"); +const { isEnabled } = require("../config/plugins"); const iconPath = path.join(__dirname, "..", "assets", "youtube-music-tray.png"); const customTitlebarPath = path.join(__dirname, "prompt-custom-titlebar.js"); -const promptOptions = is.macOS() ? { - customStylesheet: "dark", - icon: iconPath -} : { +const promptOptions = !is.macOS() && isEnabled("in-app-menu") ? { customStylesheet: "dark", // The following are used for custom titlebar frame: false, customScript: customTitlebarPath, +} : { + customStylesheet: "dark", + icon: iconPath }; module.exports = () => promptOptions;