Add option to use native titlebar

This commit is contained in:
smartfridge 2021-07-17 17:33:21 +02:00
parent e7ae65bfbb
commit 0df9689bd1
3 changed files with 9 additions and 4 deletions

View file

@ -4,7 +4,11 @@ const path = require("path");
const contextMenu = require("electron-context-menu");
const os = require("os");
require("v8-compile-cache");
if (require("./utils/ArmCord.js").Titlebar === "native") {
var frame = true
} else {
var frame = false
}
if (os.type() == 'Linux'){
var iconformat = __dirname + "/discord.png"
@ -31,7 +35,7 @@ function createWindow() {
height: 600,
icon: iconformat,
title: "ArmCord",
frame: false,
frame: frame,
webPreferences: {
preload: path.join(__dirname, "preload.js"),
enableRemoteModule: true,

View file

@ -5,10 +5,11 @@ const electronLocalshortcut = require("electron-localshortcut");
const ArmCord = require("./utils/ArmCord.js");
require("./utils/theme.js");
window.addEventListener("DOMContentLoaded", () => {
if (require("./utils/ArmCord.js").Titlebar === "native") {console.log("Using native titlebar")} else {
new customTitlebar.Titlebar({
backgroundColor: customTitlebar.Color.fromHex("#202225"),
menu: false,
});
});}
electronLocalshortcut.register(currentWindow, "F5", () => {
location.reload();

View file

@ -10,7 +10,7 @@ if (!fs.existsSync(settingsFile)) {
console.log("Created settings.json file");
}
exports.Channel = require(settingsFile).channel;
exports.Titlebar = require(settingsFile).titlebar;
exports.addStyle = function(styleString) {
const style = document.createElement('style');
style.textContent = styleString;