feat: add custom window title option (#3656)

This commit is contained in:
Franz DC
2025-07-28 22:16:47 +08:00
committed by GitHub
parent b3b3d45b96
commit 20d25ca953
4 changed files with 52 additions and 4 deletions

View File

@ -34,6 +34,7 @@ export interface DefaultConfig {
overrideUserAgent: boolean;
usePodcastParticipantAsArtist: boolean;
themes: string[];
customWindowTitle?: string;
};
'plugins': Record<string, unknown>;
}

View File

@ -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):"
}
}
},

View File

@ -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', () => {

View File

@ -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',