feat(synced-lyrics): preferred provider (global/per-song) (#3741)

Co-authored-by: JellyBrick <shlee1503@naver.com>
This commit is contained in:
Angelos Bouklis
2025-09-07 07:35:29 +03:00
committed by GitHub
parent 336b7fe5e9
commit be3ae4d789
11 changed files with 358 additions and 215 deletions

View File

@ -1,5 +1,7 @@
import { t } from '@/i18n';
import { providerNames } from './providers';
import type { MenuItemConstructorOptions } from 'electron';
import type { MenuContext } from '@/types/contexts';
import type { SyncedLyricsPluginConfig } from './types';
@ -10,6 +12,35 @@ export const menu = async (
const config = await ctx.getConfig();
return [
{
label: t('plugins.synced-lyrics.menu.preferred-provider.label'),
toolTip: t('plugins.synced-lyrics.menu.preferred-provider.tooltip'),
type: 'submenu',
submenu: [
{
label: t('plugins.synced-lyrics.menu.preferred-provider.none.label'),
toolTip: t(
'plugins.synced-lyrics.menu.preferred-provider.none.tooltip',
),
type: 'radio',
checked: config.preferredProvider === undefined,
click() {
ctx.setConfig({ preferredProvider: undefined });
},
},
...providerNames.map(
(provider) =>
({
label: provider,
type: 'radio',
checked: config.preferredProvider === provider,
click() {
ctx.setConfig({ preferredProvider: provider });
},
}) as const,
),
],
},
{
label: t('plugins.synced-lyrics.menu.precise-timing.label'),
toolTip: t('plugins.synced-lyrics.menu.precise-timing.tooltip'),