mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-11 02:31:45 +00:00
update in-app-menu
This commit is contained in:
@ -1,20 +1,28 @@
|
||||
const { ipcRenderer } = require("electron");
|
||||
const { Menu } = require("@electron/remote");
|
||||
|
||||
|
||||
const customTitlebar = require("custom-electron-titlebar");
|
||||
const config = require("../../config");
|
||||
const { Titlebar, Color } = require("custom-electron-titlebar");
|
||||
function $(selector) { return document.querySelector(selector); }
|
||||
|
||||
module.exports = () => {
|
||||
const bar = new customTitlebar.Titlebar({
|
||||
backgroundColor: customTitlebar.Color.fromHex("#050505"),
|
||||
itemBackgroundColor: customTitlebar.Color.fromHex("#121212"),
|
||||
let visible = !config.get("options.hideMenu");
|
||||
const bar = new Titlebar({
|
||||
backgroundColor: Color.fromHex("#050505"),
|
||||
itemBackgroundColor: Color.fromHex("#121212"),
|
||||
svgColor: Color.WHITE,
|
||||
menu: visible ? undefined : null
|
||||
});
|
||||
bar.updateTitle(" ");
|
||||
document.title = "Youtube Music";
|
||||
|
||||
ipcRenderer.on("updateMenu", function (_event, showMenu) {
|
||||
bar.updateMenu(showMenu ? Menu.getApplicationMenu() : null);
|
||||
ipcRenderer.on("refreshMenu", (_, showMenu) => {
|
||||
if (showMenu === undefined && !visible) return;
|
||||
if (showMenu === false) {
|
||||
bar.updateMenu(null);
|
||||
visible = false;
|
||||
} else {
|
||||
bar.refreshMenu();
|
||||
visible = true;
|
||||
}
|
||||
});
|
||||
|
||||
// Increases the right margin of Navbar background when the scrollbar is visible to avoid blocking it (z-index doesn't affect it)
|
||||
|
||||
Reference in New Issue
Block a user