From 52bca257f86b9e698f4d2e0e5b78e5258f40a2d9 Mon Sep 17 00:00:00 2001
From: smartfridge <37928912+smartfrigde@users.noreply.github.com>
Date: Fri, 15 Jul 2022 23:04:00 +0200
Subject: [PATCH] Add floating settings button and few new options
---
src/content/css/settings.css | 18 +++-
src/settings/hummus.html | 196 +++++++++++++++++++++++++++++++++++
src/settings/main.ts | 38 ++++++-
src/settings/preload.ts | 7 +-
src/settings/settings.html | 19 +++-
5 files changed, 267 insertions(+), 11 deletions(-)
create mode 100644 src/settings/hummus.html
diff --git a/src/content/css/settings.css b/src/content/css/settings.css
index f91f2e1..997fb06 100644
--- a/src/content/css/settings.css
+++ b/src/content/css/settings.css
@@ -60,7 +60,6 @@ body::-webkit-scrollbar-thumb {
* {
font-family: "Whitney", sans-serif;
-
box-sizing: border-box;
cursor: default;
}
@@ -79,6 +78,13 @@ p {
border-color: var(--background-floating);
border-style: solid;
}
+.saveBar {
+ position: fixed;
+ bottom: 20px;
+ font-weight: bold;
+ z-index: 999;
+ font-size: 10px;
+}
.header {
color: var(--header-primary);
font-size: 1.5em;
@@ -118,6 +124,11 @@ p {
transform: translateX(50%);
float: right;
}
+.advancedText {
+ color: var(--header-primary);
+ font-size: 1.5em;
+ font-weight: bold;
+}
/*buttons*/
button {
background: var(--brand-experiment);
@@ -244,9 +255,6 @@ select {
.acCSP {
height: 10em !important;
}
-.acTray {
- height: 8em !important;
-}
.acPatches {
height: 10em !important;
}
@@ -269,5 +277,5 @@ select {
height: 10em !important;
}
.acTray {
- height: 8em !important;
+ height: 7em !important;
}
diff --git a/src/settings/hummus.html b/src/settings/hummus.html
new file mode 100644
index 0000000..786dc22
--- /dev/null
+++ b/src/settings/hummus.html
@@ -0,0 +1,196 @@
+
+
+
+
+ ArmCord Settings
+
+
+
+
+
+ Save Settings
+
+
+
+
+
+
+ ArmCord CSP is our system that manages loading custom content loading into the Discord app. Stuff like
+ client mods and themes depend on it. Disable if you want to get rid of mods and custom styles.
+
+
+
+
+
+
+
+
+ When disabled, ArmCord will close like any other window when closed, otherwise it'll sit back and relax
+ in your system tray for later.
+
+
+
+
+
+
+
+
+ Fetches automatic patches that are distributed if release turns out to have bugs after release. Usually
+ you don't have to keep this enabled, unless notified in support Discord.
+
+
+
+
+
+
+
+
+ If you're on Gnome on Linux or just simply can't paste images copied from other messages, then this is
+ for you. This enables alternative module for pasting images. Only enable this when you're experiencing
+ issues.
+
+
+
+
+
+ Stable
+ Canary
+ PTB
+ Hummus (unofficial)
+
+
+
+
+ You can use this setting to change current instance of Discord:
+
+ Stable - you're probably most familiar with this one. It's the one you see in default Discord
+ client!
+
+ Canary - this is alpha test release of Discord. By using it you gain access to newest
+ features and fixes.
+
+ PTB - public test build. Gets features earlier than stable but is a bit older than Canary.
+
+ Hummus - unofficial instance of Discord that takes you back to 2016! None of the client mods
+ bundled with ArmCord work with it. It's run by community, so you take all the risk by using it.
+
+
+
+
+
+
+
+
+
+ Client mod for Hummus that focuses on making the plugin development experience easier. Minimal, light,
+ and easy to use
+
+
+
+
+
+ Performance
+ Battery
+ None
+
+
+
+ Performance mode is an experimental function that may either increase responsiveness and performance of
+ ArmCord or... decrease it. Please try every option and see which fits you the best.
+
+
+
+
+
+ Default
+ Discord Icon
+ White Icon
+ Black Icon
+ White Hollowed Icon
+ Black Hollowed Icon
+
+
+
Set the icon which will appear in tray menu.
+
+
+
+ ⚠️Advanced user zone⚠️
+ Open plugins folder
+
+ Open themes folder
+
+ Open storage folder
+
+ Copy debug info
+
+
+
+
diff --git a/src/settings/main.ts b/src/settings/main.ts
index 3003db2..6d73313 100644
--- a/src/settings/main.ts
+++ b/src/settings/main.ts
@@ -1,9 +1,14 @@
-import {BrowserWindow, shell, ipcMain} from "electron";
-import {getConfig, setConfigBulk, Settings, getLang} from "../utils";
+import {BrowserWindow, shell, ipcMain, app, clipboard} from "electron";
+import {getConfig, setConfigBulk, Settings, getLang, getVersion, getConfigLocation} from "../utils";
import path from "path";
+import os from "os";
+import fs from "fs";
var settingsWindow: BrowserWindow;
var instance: number = 0;
-
+const userDataPath = app.getPath("userData");
+const storagePath = path.join(userDataPath, "/storage/");
+const themesPath = path.join(userDataPath, "/themes/");
+const pluginsPath = path.join(userDataPath, "/plugins/");
export function createSettingsWindow() {
console.log("Creating a settings window.");
instance = instance + 1;
@@ -28,9 +33,36 @@ export function createSettingsWindow() {
console.log(args);
setConfigBulk(args);
});
+ ipcMain.on("openStorageFolder", (event) => {
+ shell.openPath(storagePath);
+ });
+ ipcMain.on("openThemesFolder", (event) => {
+ shell.openPath(themesPath);
+ });
+ ipcMain.on("openPluginsFolder", (event) => {
+ shell.openPath(pluginsPath);
+ });
ipcMain.handle("getSetting", (event, toGet: string) => {
return getConfig(toGet);
});
+ ipcMain.on("copyDebugInfo", (event) => {
+ let settingsFileContent = fs.readFileSync(getConfigLocation(), "utf-8");
+ clipboard.writeText(
+ "**OS:** " +
+ os.platform() +
+ " " +
+ os.version() +
+ "\n**Architecture:** " +
+ os.arch() +
+ "\n**ArmCord version:** " +
+ getVersion() +
+ "\n**Electron version:** " +
+ process.versions.electron +
+ "\n`" +
+ settingsFileContent +
+ "`"
+ );
+ });
settingsWindow.webContents.setWindowOpenHandler(({url}) => {
shell.openExternal(url);
return {action: "deny"};
diff --git a/src/settings/preload.ts b/src/settings/preload.ts
index 38c986d..3148136 100644
--- a/src/settings/preload.ts
+++ b/src/settings/preload.ts
@@ -1,5 +1,6 @@
import {contextBridge, ipcRenderer} from "electron";
console.log("ArmCord Settings");
+
contextBridge.exposeInMainWorld("settings", {
save: (...args: any) => ipcRenderer.send("saveSettings", ...args),
getLang: (toGet: string) =>
@@ -9,5 +10,9 @@ contextBridge.exposeInMainWorld("settings", {
get: (toGet: string) =>
ipcRenderer.invoke("getSetting", toGet).then((result) => {
return result;
- }) //jank but works
+ }), //jank but works
+ openThemesFolder: () => ipcRenderer.send("openThemesFolder"),
+ openPluginsFolder: () => ipcRenderer.send("openPluginsFolder"),
+ openStorageFolder: () => ipcRenderer.send("openStorageFolder"),
+ copyDebugInfo: () => ipcRenderer.send("copyDebugInfo")
});
diff --git a/src/settings/settings.html b/src/settings/settings.html
index 15c98c8..080df08 100644
--- a/src/settings/settings.html
+++ b/src/settings/settings.html
@@ -9,6 +9,9 @@
+
+ Save Settings
+
Default
@@ -162,11 +165,11 @@
Set the icon which will appear in tray menu.
- Save Settings
+ ⚠️Advanced user zone⚠️
Open plugins folder
- Open themes folder
+ Open themes folder
Open storage folder
@@ -227,5 +230,17 @@
doneSetup: true
});
});
+ document.getElementById("settings-pluginsFolder").addEventListener("click", function () {
+ settings.openPluginsFolder();
+ });
+ document.getElementById("settings-themesFolder").addEventListener("click", function () {
+ settings.openThemesFolder();
+ });
+ document.getElementById("settings-storageFolder").addEventListener("click", function () {
+ settings.openStorageFolder();
+ });
+ document.getElementById("settings-copyDebugInfo").addEventListener("click", function () {
+ settings.copyDebugInfo();
+ });