mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-11 10:31:47 +00:00
30 lines
790 B
TypeScript
30 lines
790 B
TypeScript
import { readdirSync } from 'node:fs';
|
|
import path from 'node:path';
|
|
|
|
import { BrowserWindow } from 'electron';
|
|
|
|
import { setMenuOptions } from '../../config/plugins';
|
|
|
|
import { MenuTemplate } from '../../menu';
|
|
|
|
import type { ConfigType } from '../../config/dynamic';
|
|
|
|
const visualizerTypes = readdirSync(path.join(__dirname, 'visualizers')).map(
|
|
(filename) => path.parse(filename).name,
|
|
);
|
|
|
|
export default (win: BrowserWindow, options: ConfigType<'visualizer'>): MenuTemplate => [
|
|
{
|
|
label: 'Type',
|
|
submenu: visualizerTypes.map((visualizerType) => ({
|
|
label: visualizerType,
|
|
type: 'radio',
|
|
checked: options.type === visualizerType,
|
|
click() {
|
|
options.type = visualizerType;
|
|
setMenuOptions('visualizer', options);
|
|
},
|
|
})),
|
|
},
|
|
];
|