mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-11 18:41:47 +00:00
fix: hide native-controls on linux when in-app-menu is used (#2366)
This commit is contained in:
27
src/index.ts
27
src/index.ts
@ -56,6 +56,7 @@ import { loadI18n, setLanguage, t } from '@/i18n';
|
|||||||
import ErrorHtmlAsset from '@assets/error.html?asset';
|
import ErrorHtmlAsset from '@assets/error.html?asset';
|
||||||
|
|
||||||
import type { PluginConfig } from '@/types/plugins';
|
import type { PluginConfig } from '@/types/plugins';
|
||||||
|
import BrowserWindowConstructorOptions = Electron.BrowserWindowConstructorOptions;
|
||||||
|
|
||||||
if (!is.macOS()) {
|
if (!is.macOS()) {
|
||||||
delete allPlugins['touchbar'];
|
delete allPlugins['touchbar'];
|
||||||
@ -286,6 +287,23 @@ async function createMainWindow() {
|
|||||||
height: 32,
|
height: 32,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const decorations: Partial<BrowserWindowConstructorOptions> = {
|
||||||
|
frame: !is.macOS() && !useInlineMenu,
|
||||||
|
titleBarOverlay: defaultTitleBarOverlayOptions,
|
||||||
|
titleBarStyle: useInlineMenu
|
||||||
|
? 'hidden'
|
||||||
|
: is.macOS()
|
||||||
|
? 'hiddenInset'
|
||||||
|
: 'default',
|
||||||
|
autoHideMenuBar: config.get('options.hideMenu'),
|
||||||
|
};
|
||||||
|
|
||||||
|
// Note: on linux, for some weird reason, having these extra properties with 'frame: false' does not work
|
||||||
|
if (is.linux() && useInlineMenu) {
|
||||||
|
delete decorations.titleBarOverlay;
|
||||||
|
delete decorations.titleBarStyle;
|
||||||
|
}
|
||||||
|
|
||||||
const win = new BrowserWindow({
|
const win = new BrowserWindow({
|
||||||
icon,
|
icon,
|
||||||
width: windowSize.width,
|
width: windowSize.width,
|
||||||
@ -303,14 +321,7 @@ async function createMainWindow() {
|
|||||||
sandbox: false,
|
sandbox: false,
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
frame: !is.macOS() && !useInlineMenu,
|
...decorations,
|
||||||
titleBarOverlay: defaultTitleBarOverlayOptions,
|
|
||||||
titleBarStyle: useInlineMenu
|
|
||||||
? 'hidden'
|
|
||||||
: is.macOS()
|
|
||||||
? 'hiddenInset'
|
|
||||||
: 'default',
|
|
||||||
autoHideMenuBar: config.get('options.hideMenu'),
|
|
||||||
});
|
});
|
||||||
initHook(win);
|
initHook(win);
|
||||||
initTheme(win);
|
initTheme(win);
|
||||||
|
|||||||
Reference in New Issue
Block a user