From b7b55b5c8321b89a32a49774b6f555d5c95aed20 Mon Sep 17 00:00:00 2001 From: Araxeus <78568641+Araxeus@users.noreply.github.com> Date: Mon, 25 Oct 2021 00:43:42 +0300 Subject: [PATCH 1/3] Add blur to (library)header + make in-app-menu compatible --- plugins/blur-nav-bar/style.css | 2 +- plugins/in-app-menu/style.css | 20 ++++++++------------ 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/plugins/blur-nav-bar/style.css b/plugins/blur-nav-bar/style.css index e64b7526..d1722b79 100644 --- a/plugins/blur-nav-bar/style.css +++ b/plugins/blur-nav-bar/style.css @@ -1,4 +1,4 @@ -#nav-bar-background { +#nav-bar-background, #header.ytmusic-item-section-renderer { background: rgba(0, 0, 0, 0.3) !important; backdrop-filter: blur(18px) !important; } diff --git a/plugins/in-app-menu/style.css b/plugins/in-app-menu/style.css index d1efb3d0..b26b1a9f 100644 --- a/plugins/in-app-menu/style.css +++ b/plugins/in-app-menu/style.css @@ -4,9 +4,10 @@ font-size: 14px !important; } -/* fixes scrollbar positioning relative to nav bar */ -#nav-bar-background.ytmusic-app-layout { +/* fixes scrollbar positioning relative to nav bar + its opacity */ +#nav-bar-background { right: 15px !important; + opacity: 1 !important; } /* remove window dragging for nav bar (conflict with titlebar drag) */ @@ -16,14 +17,9 @@ ytmusic-pivot-bar-item-renderer { -webkit-app-region: unset !important; } -/* navbar background black */ -.center-content.ytmusic-nav-bar { - background: #030303; -} - -/* move up item selectrion renderer by 15 px */ -ytmusic-item-section-renderer[has-item-section-tabbed-header-renderer_] #header.ytmusic-item-section-renderer { - top: 75 !important; +/* move up item selectrion renderer by 13 px */ +ytmusic-item-section-renderer.stuck #header.ytmusic-item-section-renderer { + top: calc(var(--ytmusic-nav-bar-height) - 13px) !important; } /* fix weird positioning in search screen*/ @@ -32,8 +28,8 @@ ytmusic-header-renderer.ytmusic-search-page { } /* Move navBar downwards */ -ytmusic-app-layout > [slot="nav-bar"], -#nav-bar-background.ytmusic-app-layout { +ytmusic-nav-bar[slot="nav-bar"], +#nav-bar-background { top: 17px !important; } From e0841060dffb84361653521a73f2bd4c5c096b82 Mon Sep 17 00:00:00 2001 From: Araxeus <78568641+Araxeus@users.noreply.github.com> Date: Mon, 25 Oct 2021 20:20:52 +0300 Subject: [PATCH 2/3] fix comment typo --- plugins/in-app-menu/style.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/in-app-menu/style.css b/plugins/in-app-menu/style.css index b26b1a9f..a90c2098 100644 --- a/plugins/in-app-menu/style.css +++ b/plugins/in-app-menu/style.css @@ -17,7 +17,7 @@ ytmusic-pivot-bar-item-renderer { -webkit-app-region: unset !important; } -/* move up item selectrion renderer by 13 px */ +/* move up item selection renderer by 13 px */ ytmusic-item-section-renderer.stuck #header.ytmusic-item-section-renderer { top: calc(var(--ytmusic-nav-bar-height) - 13px) !important; } From 12c31725fe6ac466ad8350a2d4c109ca81e6f3da Mon Sep 17 00:00:00 2001 From: Araxeus <78568641+Araxeus@users.noreply.github.com> Date: Mon, 25 Oct 2021 22:45:11 +0300 Subject: [PATCH 3/3] fixes scrollbar position relative to navbar depending on player-page-open --- plugins/in-app-menu/front.js | 16 ++++++++++++++++ plugins/in-app-menu/style.css | 4 ++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/plugins/in-app-menu/front.js b/plugins/in-app-menu/front.js index 49e56b2b..c731b1a0 100644 --- a/plugins/in-app-menu/front.js +++ b/plugins/in-app-menu/front.js @@ -1,6 +1,7 @@ const { remote, ipcRenderer } = require("electron"); const customTitlebar = require("custom-electron-titlebar"); +function $(selector) { return document.querySelector(selector); } module.exports = () => { const bar = new customTitlebar.Titlebar({ @@ -13,4 +14,19 @@ module.exports = () => { ipcRenderer.on("updateMenu", function (_event, showMenu) { bar.updateMenu(showMenu ? remote.Menu.getApplicationMenu() : null); }); + + // Increases the right margin of Navbar background when the scrollbar is visible to avoid blocking it (z-index doesn't affect it) + document.addEventListener('apiLoaded', () => { + setNavbarMargin() + const playPageObserver = new MutationObserver(() => { + setNavbarMargin(); + }); + playPageObserver.observe($('ytmusic-app-layout'), { attributeFilter: ['player-page-open_', 'playerPageOpen_'] }) + }) }; + +function setNavbarMargin() { + $('ytmusic-app-layout').playerPageOpen_ ? + $('#nav-bar-background').style.right = '0px' : + $('#nav-bar-background').style.right = '12px'; +} diff --git a/plugins/in-app-menu/style.css b/plugins/in-app-menu/style.css index a90c2098..090a94ef 100644 --- a/plugins/in-app-menu/style.css +++ b/plugins/in-app-menu/style.css @@ -4,10 +4,10 @@ font-size: 14px !important; } -/* fixes scrollbar positioning relative to nav bar + its opacity */ +/* fixes nav-bar-background opacity bug and allows clicking scrollbar through it */ #nav-bar-background { - right: 15px !important; opacity: 1 !important; + pointer-events: none; } /* remove window dragging for nav bar (conflict with titlebar drag) */