mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-11 02:31:45 +00:00
fix(in-app-menu): fix #1436
This commit is contained in:
@ -36,7 +36,14 @@ export const forceLoadMenuPlugin = async (id: string, win: BrowserWindow) => {
|
||||
if (!plugin) return;
|
||||
|
||||
const menu = plugin.menu?.(createContext(id, win));
|
||||
if (menu) menuTemplateMap[id] = await menu;
|
||||
if (menu) {
|
||||
const result = await menu;
|
||||
if (result.length > 0) {
|
||||
menuTemplateMap[id] = result;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
else return;
|
||||
|
||||
console.log(LoggerPrefix, `Successfully loaded '${id}::menu'`);
|
||||
|
||||
@ -1,12 +1,10 @@
|
||||
import is from 'electron-is';
|
||||
|
||||
import { setMenuOptions } from '@/config/plugins';
|
||||
|
||||
import type { InAppMenuConfig } from './index';
|
||||
import type { MenuContext } from '@/types/contexts';
|
||||
import type { MenuTemplate } from '@/menu';
|
||||
|
||||
export const onMenu = async ({ getConfig }: MenuContext<InAppMenuConfig>): Promise<MenuTemplate> => {
|
||||
export const onMenu = async ({ getConfig, setConfig }: MenuContext<InAppMenuConfig>): Promise<MenuTemplate> => {
|
||||
const config = await getConfig();
|
||||
|
||||
if (is.linux()) {
|
||||
@ -17,7 +15,7 @@ export const onMenu = async ({ getConfig }: MenuContext<InAppMenuConfig>): Promi
|
||||
checked: config.hideDOMWindowControls,
|
||||
click(item) {
|
||||
config.hideDOMWindowControls = item.checked;
|
||||
setMenuOptions('in-app-menu', config);
|
||||
setConfig(config);
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user