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 "./extensions/plugin";
import "./tray"; import "./tray";
import {createCustomWindow, createNativeWindow} from "./window"; import {createCustomWindow, createNativeWindow} from "./window";
import path from "path";
export var iconPath: string;
export var settings: any; export var settings: any;
export var customTitlebar: boolean; export var customTitlebar: boolean;
export var clientName: "ArmCord"; export var clientName: "ArmCord";
@ -25,6 +26,11 @@ if (process.platform == "linux") {
checkIfConfigExists(); checkIfConfigExists();
injectElectronFlags(); injectElectronFlags();
app.whenReady().then(async () => { 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() { async function init() {
switch (await getConfig("windowStyle")) { switch (await getConfig("windowStyle")) {
case "default": case "default":

View file

@ -20,6 +20,9 @@ contextBridge.exposeInMainWorld("settings", {
copyDebugInfo: () => ipcRenderer.send("copyDebugInfo") copyDebugInfo: () => ipcRenderer.send("copyDebugInfo")
}); });
if (ipcRenderer.sendSync("getLangName") == "en-US") { if (ipcRenderer.sendSync("getLangName") == "en-US") {
console.log("[Settings]: Lang " + ipcRenderer.sendSync("getLangName"));
const cssPath = path.join(__dirname, "../", "/content/css/settingsEng.css"); 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 contextMenu from "electron-context-menu";
import os from "os"; import os from "os";
import {tray} from "./tray"; import {tray} from "./tray";
export var icon: string; import {iconPath} from "./main";
export let mainWindow: BrowserWindow; export let mainWindow: BrowserWindow;
export let inviteWindow: BrowserWindow; export let inviteWindow: BrowserWindow;
var osType = os.type(); var osType = os.type();
@ -203,7 +203,7 @@ export function createCustomWindow() {
height: 350, height: 350,
title: "ArmCord", title: "ArmCord",
darkTheme: true, darkTheme: true,
icon: path.join(__dirname, "../", "/assets/ac_icon_transparent.png"), icon: iconPath,
frame: false, frame: false,
autoHideMenuBar: true, autoHideMenuBar: true,
webPreferences: { webPreferences: {
@ -220,7 +220,7 @@ export function createNativeWindow() {
height: 350, height: 350,
title: "ArmCord", title: "ArmCord",
darkTheme: true, darkTheme: true,
icon: path.join(__dirname, "../", "/assets/ac_icon_transparent.png"), icon: iconPath,
frame: true, frame: true,
autoHideMenuBar: true, autoHideMenuBar: true,
webPreferences: { webPreferences: {
@ -238,7 +238,7 @@ export function createInviteWindow() {
height: 600, height: 600,
title: "ArmCord Invite Manager", title: "ArmCord Invite Manager",
darkTheme: true, darkTheme: true,
icon: path.join(__dirname, "../", "/assets/ac_icon_transparent.png"), icon: iconPath,
frame: true, frame: true,
autoHideMenuBar: true, autoHideMenuBar: true,
webPreferences: { webPreferences: {