mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-13 03:11:46 +00:00
feat: migration to TypeScript FINAL
Co-authored-by: Su-Yong <simssy2205@gmail.com>
This commit is contained in:
29
plugins/visualizer/menu.ts
Normal file
29
plugins/visualizer/menu.ts
Normal file
@ -0,0 +1,29 @@
|
||||
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);
|
||||
},
|
||||
})),
|
||||
},
|
||||
];
|
||||
Reference in New Issue
Block a user