mirror of
https://github.com/smartfrigde/armcord.git
synced 2024-08-14 23:56:58 +00:00
f57fe11769
* 2 new things (Read desc.) - Cleaned up ASAR packaging, ignoring unneeded files for building - Moved install location for Windows users ("AppData\Local\Programs" -> "AppData\Local" * 3 things (Read desc.) - Updated things related to Hummus (Hummus settings don't save nor load in it's respective settings window yet, idk why) - Added check for package version (ArmCord's internal version) - Made check for Kernel mod a bit cleaner, it still uses the same jank method * 3 things - Made macOS titlebar more accurate to Discord - Added "unFocused" class when window isn't focused - Added option to uninstall Husky hook for Windows users with reminder to run format script before committing * Resolved a dumb issue My dumbass not knowing the "echo" command existed smh * Made "precommit-fix" warning more noticable * Whoops * Fixed a CSS bug Discord updates are gonna hate us, huh? * 4 things (Formatted) - Updated coding for getting the current version - Updated some context menu and tray stuff - Added current version to the title of the settings window - Added the ability to restart the app within the settings * A few things - Updated tray menu to include the tray icon infront of the ArmCord version - Updated MacOS titlebar to not be broken in setup - Polished settings menu a bit - Polished the Discord tray icon - Added the Classic Discord icon as tray icon option
66 lines
2.3 KiB
TypeScript
66 lines
2.3 KiB
TypeScript
// Modules to control application life and create native browser window
|
|
import {app, BrowserWindow, session} from "electron";
|
|
import "v8-compile-cache";
|
|
import {getConfig, checkIfConfigExists, injectElectronFlags} from "./utils";
|
|
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";
|
|
|
|
if (process.platform == "linux") {
|
|
if (process.env.$XDG_SESSION_TYPE == "wayland") {
|
|
console.log("Wayland specific patches applied.");
|
|
app.commandLine.appendSwitch("ozone-platform=wayland");
|
|
if (process.env.$XDG_CURRENT_DESKTOP == "GNOME") {
|
|
app.commandLine.appendSwitch("enable-features=UseOzonePlatform,WaylandWindowDecorations");
|
|
} else {
|
|
app.commandLine.appendSwitch("enable-features=UseOzonePlatform");
|
|
}
|
|
}
|
|
}
|
|
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":
|
|
createCustomWindow();
|
|
customTitlebar = true;
|
|
break;
|
|
case "native":
|
|
createNativeWindow();
|
|
break;
|
|
case "basic":
|
|
createNativeWindow();
|
|
break;
|
|
default:
|
|
createCustomWindow();
|
|
customTitlebar = true;
|
|
break;
|
|
}
|
|
}
|
|
await init();
|
|
session.fromPartition("some-partition").setPermissionRequestHandler((webContents, permission, callback) => {
|
|
if (permission === "notifications") {
|
|
// Approves the permissions request
|
|
callback(true);
|
|
}
|
|
if (permission === "media") {
|
|
// Approves the permissions request
|
|
callback(true);
|
|
}
|
|
});
|
|
app.on("activate", async function () {
|
|
if (BrowserWindow.getAllWindows().length === 0) await init();
|
|
});
|
|
});
|