From 77b54551395a46dbcfe023f40394a8c540345aaa Mon Sep 17 00:00:00 2001 From: smartfridge <37928912+smartfrigde@users.noreply.github.com> Date: Wed, 24 Aug 2022 17:25:12 +0200 Subject: [PATCH] Add zoom controls back and open settings --- src/content/css/settings.css | 33 -------------------- src/content/css/settingsEng.css | 33 ++++++++++++++++++++ src/content/splash.html | 2 +- src/ipc.ts | 15 +++++++-- src/menu.ts | 15 +++++++++ src/preload/bridge.ts | 4 +-- src/preload/preload.ts | 2 +- src/settings/hummus.html | 55 +++++++++++++++++++++++---------- src/settings/main.ts | 5 ++- src/settings/preload.ts | 7 +++++ src/utils.ts | 23 +++++++++++++- src/window.ts | 10 +++++- 12 files changed, 145 insertions(+), 59 deletions(-) create mode 100644 src/content/css/settingsEng.css diff --git a/src/content/css/settings.css b/src/content/css/settings.css index b964039..051c673 100644 --- a/src/content/css/settings.css +++ b/src/content/css/settings.css @@ -254,36 +254,3 @@ select { white-space: nowrap; outline: none !important; } -.acTheme { - height: 15em !important; -} -.acCSP { - height: 10em !important; -} -.acPatches { - height: 10em !important; -} -.acWebsocket { - height: 10em !important; -} -.acMobileMode { - height: 11em !important; -} -.acAltPaste { - height: 11em !important; -} -.acChannel { - height: 21em !important; -} -.acClientMod { - height: 18em !important; -} -.acCordwood { - height: 8em !important; -} -.acPrfmMode { - height: 10em !important; -} -.acTray { - height: 8em !important; -} diff --git a/src/content/css/settingsEng.css b/src/content/css/settingsEng.css new file mode 100644 index 0000000..4d2acac --- /dev/null +++ b/src/content/css/settingsEng.css @@ -0,0 +1,33 @@ +.acTheme { + height: 15em !important; +} +.acCSP { + height: 10em !important; +} +.acPatches { + height: 10em !important; +} +.acWebsocket { + height: 10em !important; +} +.acMobileMode { + height: 11em !important; +} +.acAltPaste { + height: 11em !important; +} +.acChannel { + height: 21em !important; +} +.acClientMod { + height: 18em !important; +} +.acCordwood { + height: 8em !important; +} +.acPrfmMode { + height: 10em !important; +} +.acTray { + height: 8em !important; +} diff --git a/src/content/splash.html b/src/content/splash.html index 0378dd1..4f9ce70 100644 --- a/src/content/splash.html +++ b/src/content/splash.html @@ -47,7 +47,7 @@ } } setTimeout(() => { - window.armcordinternal.splashEnd(); + window.armcord.splashEnd(); switch (window.armcord.channel) { case "stable": window.location.replace("https://discord.com/app"); diff --git a/src/ipc.ts b/src/ipc.ts index 131115f..045314e 100644 --- a/src/ipc.ts +++ b/src/ipc.ts @@ -1,7 +1,15 @@ //ipc stuff import {app, ipcMain, shell, desktopCapturer} from "electron"; import {mainWindow} from "./window"; -import {setConfigBulk, getVersion, getConfig, setLang, getLang, getWindowState, packageVersion} from "./utils"; +import { + setConfigBulk, + getVersion, + getConfig, + setLang, + getLang, + getWindowState, + packageVersion, getDisplayVersion +} from "./utils"; import {customTitlebar} from "./main"; import {createSettingsWindow} from "./settings/main"; export function registerIpc() { @@ -44,10 +52,13 @@ export function registerIpc() { ipcMain.on("get-app-version", (event) => { event.returnValue = getVersion(); }); + ipcMain.on("displayVersion", (event) => { + event.returnValue = getDisplayVersion(); + }); ipcMain.on("get-package-version", (event) => { event.returnValue = packageVersion; }); - ipcMain.on("splashEnd", async (event, arg) => { + ipcMain.on("splashEnd", async () => { try { var width = (await getWindowState("width")) ?? 800; var height = (await getWindowState("height")) ?? 600; diff --git a/src/menu.ts b/src/menu.ts index f6535bf..f405455 100644 --- a/src/menu.ts +++ b/src/menu.ts @@ -1,6 +1,7 @@ import {Menu, app, clipboard, globalShortcut} from "electron"; import {mainWindow} from "./window"; import {getConfig} from "./utils"; +import {createSettingsWindow} from "./settings/main"; function paste(contents: any) { const contentTypes = clipboard.availableFormats().toString(); @@ -51,6 +52,13 @@ export async function setMenu() { mainWindow.webContents.openDevTools(); } }, + { + label: "Open settings", + accelerator: "CmdOrCtrl+Shift+'", + click: function () { + createSettingsWindow(); + } + }, { label: "Quit", accelerator: "CmdOrCtrl+Q", @@ -77,6 +85,13 @@ export async function setMenu() { }, {label: "Select All", accelerator: "CmdOrCtrl+A", role: "selectAll"} ] + }, + { + label: "Zoom", + submenu: [ + {label: "Zoom in", accelerator: "CmdOrCtrl+Plus", role: "zoomIn"}, + {label: "Zoom out", accelerator: "CmdOrCtrl+-", role: "zoomOut"}, + ] } ]; diff --git a/src/preload/bridge.ts b/src/preload/bridge.ts index d421d5b..3870c4f 100644 --- a/src/preload/bridge.ts +++ b/src/preload/bridge.ts @@ -23,13 +23,13 @@ contextBridge.exposeInMainWorld("armcord", { version: ipcRenderer.sendSync("get-app-version", "app-version"), packageVersion: ipcRenderer.sendSync("get-package-version", "app-version"), getDisplayMediaSelector: getDisplayMediaSelector, + splashEnd: () => ipcRenderer.send("splashEnd"), openSettingsWindow: () => ipcRenderer.send("openSettingsWindow") }); //to be only used inside armcord internal setup/splash etc if (window.location.href.indexOf("splash.html") > -1 || window.location.href.indexOf("setup.html") > -1) { contextBridge.exposeInMainWorld("armcordinternal", { restart: () => ipcRenderer.send("restart"), - saveSettings: (...args: any) => ipcRenderer.send("saveSettings", ...args), - splashEnd: () => ipcRenderer.send("splashEnd") + saveSettings: (...args: any) => ipcRenderer.send("saveSettings", ...args) }); } diff --git a/src/preload/preload.ts b/src/preload/preload.ts index f98d82e..d0963a1 100644 --- a/src/preload/preload.ts +++ b/src/preload/preload.ts @@ -7,7 +7,7 @@ import {injectHummusTitlebar, injectTitlebar} from "./titlebar"; import {sleep, addStyle, injectJS, addScript} from "../utils"; import {ipcRenderer} from "electron"; import {injectMobileStuff} from "./mobile"; -var version = ipcRenderer.sendSync("get-app-version", "app-version"); +var version = ipcRenderer.sendSync("displayVersion"); var channel = ipcRenderer.sendSync("channel"); async function updateLang() { if (window.location.href.indexOf("setup.html") > -1) { diff --git a/src/settings/hummus.html b/src/settings/hummus.html index 15b5abc..ba2cfb9 100644 --- a/src/settings/hummus.html +++ b/src/settings/hummus.html @@ -15,6 +15,23 @@
ArmCord theme
+
+ ArmCord "themes" manage apps behaviour and looks.
+
+ Default - this is how ArmCord looks when you first launch it. It includes recreation of Discord's
+ custom titlebar and ArmCord specific styles injected into Discord.
+
+ Native - uses native titlebar of OS you're currently running (e.g Windows 7/10). Functions more
+ similar to actual Discord app on Linux.
+