mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-10 10:11:46 +00:00
feat: in-app-menu hideIcon option
This commit is contained in:
@ -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();
|
||||
|
||||
14
plugins/in-app-menu/menu.js
Normal file
14
plugins/in-app-menu/menu.js
Normal 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);
|
||||
},
|
||||
}
|
||||
];
|
||||
Reference in New Issue
Block a user