Add custom icon

This commit is contained in:
smartfridge 2022-08-25 16:42:54 +02:00
parent 75276dee90
commit 5c109f530b
3 changed files with 15 additions and 6 deletions

View File

@ -6,7 +6,8 @@ import "./extensions/mods";
import "./extensions/plugin";
import "./tray";
import {createCustomWindow, createNativeWindow} from "./window";
import path from "path";
export var iconPath: string;
export var settings: any;
export var customTitlebar: boolean;
export var clientName: "ArmCord";
@ -25,6 +26,11 @@ if (process.platform == "linux") {
checkIfConfigExists();
injectElectronFlags();
app.whenReady().then(async () => {
if (await getConfig("customIcon") !== undefined ?? null) {
iconPath = await getConfig("customIcon")
} else {
iconPath = path.join(__dirname, "../", "/assets/ac_icon_transparent.png")
}
async function init() {
switch (await getConfig("windowStyle")) {
case "default":

View File

@ -20,6 +20,9 @@ contextBridge.exposeInMainWorld("settings", {
copyDebugInfo: () => ipcRenderer.send("copyDebugInfo")
});
if (ipcRenderer.sendSync("getLangName") == "en-US") {
console.log("[Settings]: Lang " + ipcRenderer.sendSync("getLangName"));
const cssPath = path.join(__dirname, "../", "/content/css/settingsEng.css");
addStyle(fs.readFileSync(cssPath, "utf8"));
document.addEventListener("DOMContentLoaded", function (event) {
addStyle(fs.readFileSync(cssPath, "utf8"));
});
}

View File

@ -20,7 +20,7 @@ import startServer from "./socket";
import contextMenu from "electron-context-menu";
import os from "os";
import {tray} from "./tray";
export var icon: string;
import {iconPath} from "./main";
export let mainWindow: BrowserWindow;
export let inviteWindow: BrowserWindow;
var osType = os.type();
@ -203,7 +203,7 @@ export function createCustomWindow() {
height: 350,
title: "ArmCord",
darkTheme: true,
icon: path.join(__dirname, "../", "/assets/ac_icon_transparent.png"),
icon: iconPath,
frame: false,
autoHideMenuBar: true,
webPreferences: {
@ -220,7 +220,7 @@ export function createNativeWindow() {
height: 350,
title: "ArmCord",
darkTheme: true,
icon: path.join(__dirname, "../", "/assets/ac_icon_transparent.png"),
icon: iconPath,
frame: true,
autoHideMenuBar: true,
webPreferences: {
@ -238,7 +238,7 @@ export function createInviteWindow() {
height: 600,
title: "ArmCord Invite Manager",
darkTheme: true,
icon: path.join(__dirname, "../", "/assets/ac_icon_transparent.png"),
icon: iconPath,
frame: true,
autoHideMenuBar: true,
webPreferences: {