mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-13 19:31:46 +00:00
19
src/index.ts
19
src/index.ts
@ -191,6 +191,12 @@ async function createMainWindow() {
|
|||||||
const windowPosition: Electron.Point = config.get('window-position');
|
const windowPosition: Electron.Point = config.get('window-position');
|
||||||
const useInlineMenu = config.plugins.isEnabled('in-app-menu');
|
const useInlineMenu = config.plugins.isEnabled('in-app-menu');
|
||||||
|
|
||||||
|
const defaultTitleBarOverlayOptions: Electron.TitleBarOverlayOptions = {
|
||||||
|
color: '#00000000',
|
||||||
|
symbolColor: '#ffffff',
|
||||||
|
height: 36,
|
||||||
|
};
|
||||||
|
|
||||||
const win = new BrowserWindow({
|
const win = new BrowserWindow({
|
||||||
icon,
|
icon,
|
||||||
width: windowSize.width,
|
width: windowSize.width,
|
||||||
@ -209,11 +215,7 @@ async function createMainWindow() {
|
|||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
frame: !is.macOS() && !useInlineMenu,
|
frame: !is.macOS() && !useInlineMenu,
|
||||||
titleBarOverlay: {
|
titleBarOverlay: defaultTitleBarOverlayOptions,
|
||||||
color: '#00000000',
|
|
||||||
symbolColor: '#ffffff',
|
|
||||||
height: 36,
|
|
||||||
},
|
|
||||||
titleBarStyle: useInlineMenu
|
titleBarStyle: useInlineMenu
|
||||||
? 'hidden'
|
? 'hidden'
|
||||||
: (is.macOS()
|
: (is.macOS()
|
||||||
@ -336,6 +338,13 @@ async function createMainWindow() {
|
|||||||
removeContentSecurityPolicy();
|
removeContentSecurityPolicy();
|
||||||
|
|
||||||
win.webContents.on('dom-ready', async () => {
|
win.webContents.on('dom-ready', async () => {
|
||||||
|
if (useInlineMenu) {
|
||||||
|
win.setTitleBarOverlay({
|
||||||
|
...defaultTitleBarOverlayOptions,
|
||||||
|
height: Math.floor(defaultTitleBarOverlayOptions.height! * win.webContents.getZoomFactor()),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Inject index.html file as string using insertAdjacentHTML
|
// Inject index.html file as string using insertAdjacentHTML
|
||||||
// In dev mode, get string from process.env.VITE_DEV_SERVER_URL, else use fs.readFileSync
|
// In dev mode, get string from process.env.VITE_DEV_SERVER_URL, else use fs.readFileSync
|
||||||
if (is.dev() && process.env.ELECTRON_RENDERER_URL) {
|
if (is.dev() && process.env.ELECTRON_RENDERER_URL) {
|
||||||
|
|||||||
Reference in New Issue
Block a user