titlebar fixes

This commit is contained in:
HorizonCode 2023-06-02 12:22:28 +02:00
parent fdfedab77f
commit cb1a05d58c
3 changed files with 244 additions and 240 deletions

3
app.js
View File

@ -1,5 +1,5 @@
const { app, BrowserWindow, ipcMain, dialog, Tray, Menu } = require('electron'); const { app, BrowserWindow, ipcMain, dialog, Tray, Menu } = require('electron');
const { setupTitlebar, attachTitlebarToWindow } = require('custom-electron-titlebar/main'); const { setupTitlebar } = require('custom-electron-titlebar/main');
const windowManager = require('./ui/windowManager'); const windowManager = require('./ui/windowManager');
const osuUtil = require('./osuUtil'); const osuUtil = require('./osuUtil');
const ezppUtil = require('./ezppUtil'); const ezppUtil = require('./ezppUtil');
@ -376,7 +376,6 @@ function createWindow() {
win.loadFile('./html/index.html'); win.loadFile('./html/index.html');
attachTitlebarToWindow(win);
win.webContents.setWindowOpenHandler(() => "deny"); win.webContents.setWindowOpenHandler(() => "deny");
win.webContents.on('did-finish-load', function () { win.webContents.on('did-finish-load', function () {
if (win.webContents.getZoomFactor() != 0.9) if (win.webContents.getZoomFactor() != 0.9)

View File

@ -1,16 +1,16 @@
const { ipcRenderer, shell } = require('electron'); const { ipcRenderer, shell } = require('electron');
const { Titlebar, Color } = require('custom-electron-titlebar'); const { Titlebar, TitlebarColor } = require('custom-electron-titlebar');
const appInfo = require('../appInfo'); const appInfo = require('../appInfo');
let titlebar;
let currentPage = "loading"; let currentPage = "loading";
let loggedIn = false; let loggedIn = false;
window.addEventListener('DOMContentLoaded', () => { window.addEventListener('DOMContentLoaded', () => {
titlebar = new Titlebar({ const titlebar = new Titlebar({
backgroundColor: Color.fromHex("#24283B"), backgroundColor: TitlebarColor.fromHex("#24283B"),
itemBackgroundColor: Color.fromHex("#121212"), itemBackgroundColor: TitlebarColor.fromHex("#121212"),
menu: null, menu: null,
maximizable: false enableMnemonics: false,
maximizable: false,
}); });
titlebar.updateTitle(`${appInfo.appName} ${appInfo.appVersion}`); titlebar.updateTitle(`${appInfo.appName} ${appInfo.appVersion}`);

View File

@ -1,6 +1,6 @@
const path = require("path"); const path = require("path");
const appInfo = require('../appInfo'); const appInfo = require('../appInfo');
const { BrowserWindow } = require('electron'); const { BrowserWindow, Menu } = require('electron');
const { attachTitlebarToWindow } = require('custom-electron-titlebar/main'); const { attachTitlebarToWindow } = require('custom-electron-titlebar/main');
module.exports = { module.exports = {
@ -26,6 +26,10 @@ module.exports = {
}, },
icon: './assets/logo.png' icon: './assets/logo.png'
}) })
const menu = Menu.buildFromTemplate([])
Menu.setApplicationMenu(menu);
window.hide(); window.hide();
window.webContents.once("did-finish-load", function (event, input) { window.webContents.once("did-finish-load", function (event, input) {
@ -33,6 +37,7 @@ module.exports = {
}); });
window.webContents.setUserAgent(`${appInfo.appName} ${appInfo.appVersion}`); window.webContents.setUserAgent(`${appInfo.appName} ${appInfo.appVersion}`);
attachTitlebarToWindow(window); attachTitlebarToWindow(window);
return window; return window;