From 88021a78fa1b5d887b689562d3c7042746ba5bb7 Mon Sep 17 00:00:00 2001 From: Levminer <33373714+Levminer@users.noreply.github.com> Date: Sat, 11 Dec 2021 14:39:44 +0100 Subject: [PATCH] Enable title bar #159 --- preload.js | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/preload.js b/preload.js index 3b2f78c8..694dc739 100644 --- a/preload.js +++ b/preload.js @@ -1,5 +1,5 @@ -const { app } = require("@electron/remote") -const electron = require("electron") +const { app, Menu, getCurrentWindow } = require("@electron/remote") +const Titlebar = require("@6c65726f79/custom-titlebar") const path = require("path") const fs = require("fs") const ipc = electron.ipcRenderer @@ -83,3 +83,18 @@ document.addEventListener("keydown", (event) => { */ document.addEventListener("dragover", (event) => event.preventDefault()) document.addEventListener("drop", (event) => event.preventDefault()) + +/** + * Title bar + */ +const currentWindow = getCurrentWindow() +let titlebar + +if (process.platform === "win32") { + currentWindow.webContents.once("dom-ready", () => { + titlebar = new Titlebar({ + menu: Menu.getApplicationMenu(), + browserWindow: currentWindow, + backgroundColor: "#000000", + icon: "../../img/icon.png", + unfocusEffect: false,