diff --git a/src/config/defaults.ts b/src/config/defaults.ts index fb694c9e..000b9aa0 100644 --- a/src/config/defaults.ts +++ b/src/config/defaults.ts @@ -34,6 +34,7 @@ export interface DefaultConfig { overrideUserAgent: boolean; usePodcastParticipantAsArtist: boolean; themes: string[]; + customWindowTitle?: string; }; 'plugins': Record; } diff --git a/src/i18n/resources/en.json b/src/i18n/resources/en.json index 4843203f..532e7859 100644 --- a/src/i18n/resources/en.json +++ b/src/i18n/resources/en.json @@ -156,6 +156,13 @@ "hide": "Hide", "label": "Like buttons" }, + "custom-window-title": { + "label": "Custom window title", + "prompt": { + "label": "Enter custom window title: (leave empty to disable)", + "placeholder": "Example: YouTube Music" + } + }, "remove-upgrade-button": "Remove upgrade button", "theme": { "dialog": { @@ -348,12 +355,12 @@ "name": "Auth Proxy Adapter", "prompt": { "hostname": { - "label": "Enter hostname for local proxy server (requires restart):", - "title": "Proxy Hostname" + "title": "Proxy Hostname", + "label": "Enter hostname for local proxy server (requires restart):" }, "port": { - "label": "Enter port for local proxy server (requires restart):", - "title": "Proxy Port" + "title": "Proxy Port", + "label": "Enter port for local proxy server (requires restart):" } } }, diff --git a/src/index.ts b/src/index.ts index af5a1f55..62512c02 100644 --- a/src/index.ts +++ b/src/index.ts @@ -599,6 +599,15 @@ app.once('browser-window-created', (_event, win) => { win.webContents.on('will-prevent-unload', (event) => { event.preventDefault(); }); + + const customWindowTitle = config.get('options.customWindowTitle'); + + if (customWindowTitle) { + win.on('page-title-updated', (event) => { + event.preventDefault(); + win.setTitle(customWindowTitle); + }); + } }); app.on('window-all-closed', () => { diff --git a/src/menu.ts b/src/menu.ts index 5505fcb2..9c81bee7 100644 --- a/src/menu.ts +++ b/src/menu.ts @@ -216,6 +216,37 @@ export const mainMenuTemplate = async ( ); }, }, + { + label: t( + 'main.menu.options.submenu.visual-tweaks.submenu.custom-window-title.label', + ), + async click() { + const output = await prompt( + { + title: t( + 'main.menu.options.submenu.visual-tweaks.submenu.custom-window-title.label', + ), + label: t( + 'main.menu.options.submenu.visual-tweaks.submenu.custom-window-title.prompt.label', + ), + value: config.get('options.customWindowTitle') || '', + type: 'input', + inputAttrs: { + type: 'text', + placeholder: t( + 'main.menu.options.submenu.visual-tweaks.submenu.custom-window-title.prompt.placeholder', + ), + }, + width: 500, + ...promptOptions(), + }, + win, + ); + if (typeof output === 'string') { + config.setMenuOption('options.customWindowTitle', output); + } + }, + }, { label: t( 'main.menu.options.submenu.visual-tweaks.submenu.like-buttons.label',