mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-11 02:31:45 +00:00
feat: add custom window title option (#3656)
This commit is contained in:
@ -34,6 +34,7 @@ export interface DefaultConfig {
|
|||||||
overrideUserAgent: boolean;
|
overrideUserAgent: boolean;
|
||||||
usePodcastParticipantAsArtist: boolean;
|
usePodcastParticipantAsArtist: boolean;
|
||||||
themes: string[];
|
themes: string[];
|
||||||
|
customWindowTitle?: string;
|
||||||
};
|
};
|
||||||
'plugins': Record<string, unknown>;
|
'plugins': Record<string, unknown>;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -156,6 +156,13 @@
|
|||||||
"hide": "Hide",
|
"hide": "Hide",
|
||||||
"label": "Like buttons"
|
"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",
|
"remove-upgrade-button": "Remove upgrade button",
|
||||||
"theme": {
|
"theme": {
|
||||||
"dialog": {
|
"dialog": {
|
||||||
@ -348,12 +355,12 @@
|
|||||||
"name": "Auth Proxy Adapter",
|
"name": "Auth Proxy Adapter",
|
||||||
"prompt": {
|
"prompt": {
|
||||||
"hostname": {
|
"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": {
|
"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):"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -599,6 +599,15 @@ app.once('browser-window-created', (_event, win) => {
|
|||||||
win.webContents.on('will-prevent-unload', (event) => {
|
win.webContents.on('will-prevent-unload', (event) => {
|
||||||
event.preventDefault();
|
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', () => {
|
app.on('window-all-closed', () => {
|
||||||
|
|||||||
31
src/menu.ts
31
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(
|
label: t(
|
||||||
'main.menu.options.submenu.visual-tweaks.submenu.like-buttons.label',
|
'main.menu.options.submenu.visual-tweaks.submenu.like-buttons.label',
|
||||||
|
|||||||
Reference in New Issue
Block a user