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

View file

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

View file

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