Merge pull request #680 from Araxeus/in-app-menu-hide-icon-option

[in-app-menu] add hide icon option
This commit is contained in:
th-ch
2022-05-01 21:32:10 +02:00
committed by GitHub
3 changed files with 25 additions and 1 deletions

View File

@ -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();

View File

@ -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);
},
}
];

View File

@ -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
}