From b4b785d77313a0ec5529f150171b316b675bfeab Mon Sep 17 00:00:00 2001 From: Araxeus <78568641+Araxeus@users.noreply.github.com> Date: Sat, 9 Apr 2022 22:56:01 +0300 Subject: [PATCH 1/2] feat: in-app-menu `hideIcon` option --- plugins/in-app-menu/front.js | 8 +++++++- plugins/in-app-menu/menu.js | 14 ++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 plugins/in-app-menu/menu.js diff --git a/plugins/in-app-menu/front.js b/plugins/in-app-menu/front.js index aa025f3d..bef60632 100644 --- a/plugins/in-app-menu/front.js +++ b/plugins/in-app-menu/front.js @@ -3,7 +3,7 @@ const config = require("../../config"); const { Titlebar, Color } = require("custom-electron-titlebar"); function $(selector) { return document.querySelector(selector); } -module.exports = () => { +module.exports = (options) => { let visible = !config.get("options.hideMenu"); const bar = new Titlebar({ backgroundColor: Color.fromHex("#050505"), @@ -14,6 +14,10 @@ module.exports = () => { bar.updateTitle(" "); document.title = "Youtube Music"; + const hideIcon = hide => $('.cet-window-icon').style.display = hide ? 'none' : 'flex'; + + if (options.hideIcon) hideIcon(true); + ipcRenderer.on("refreshMenu", (_, showMenu) => { if (showMenu === undefined && !visible) return; if (showMenu === false) { @@ -25,6 +29,8 @@ module.exports = () => { } }); + ipcRenderer.on("hideIcon", (_, hide) => hideIcon(hide)); + // 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(); diff --git a/plugins/in-app-menu/menu.js b/plugins/in-app-menu/menu.js new file mode 100644 index 00000000..dbfd88a3 --- /dev/null +++ b/plugins/in-app-menu/menu.js @@ -0,0 +1,14 @@ +const { setOptions } = require("../../config/plugins"); + +module.exports = (win, options) => [ + { + label: "Hide Icon", + type: "checkbox", + checked: options.hideIcon, + click: (item) => { + win.webContents.send("hideIcon", item.checked); + options.hideIcon = item.checked; + setOptions("in-app-menu", options); + }, + } +]; From 8000a8326fb77f81880818b4ce9c854a6ccbd2e3 Mon Sep 17 00:00:00 2001 From: Araxeus <78568641+Araxeus@users.noreply.github.com> Date: Sat, 9 Apr 2022 23:00:12 +0300 Subject: [PATCH 2/2] fix: in-app-menu bg color edge case when item weren't initially rendered because the window was too small, but were then accessed via the arrow keys - backgrounds was missing --- plugins/in-app-menu/style.css | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugins/in-app-menu/style.css b/plugins/in-app-menu/style.css index 8c13c62b..782b47f9 100644 --- a/plugins/in-app-menu/style.css +++ b/plugins/in-app-menu/style.css @@ -71,3 +71,7 @@ yt-page-navigation-progress, -moz-border-radius: 100px; -webkit-border-radius: 100px; } + +.cet-menubar-menu-container .cet-action-item { + background-color: inherit +}