Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions assets/lang/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@
"settings-noBundleUpdates-desc": "Disables automatic updates for client mods.",
"settings-hardwareAcceleration": "Hardware acceleration",
"settings-hardwareAcceleration-desc": "Hardware acceleration uses your GPU to make Legcord run faster. If you're experiencing visual glitches, try disabling this.",
"settings-processScanning": "Process scanning",
"settings-processScanning-desc": "Enables scanning for running games to improve Rich Presence detection.",
"settings-windowsLegacyScanning": "Windows legacy scanning",
"settings-windowsLegacyScanning-desc": "Uses legacy method for scanning processes on Windows (pre v1.1.6). May improve compatibility on some systems but is less efficient.",
"settings-scanInterval": "Scan interval (ms)",
"settings-scanInterval-desc": "Sets how often (in milliseconds) the process scanning occurs. Lower values may improve detection speed but can increase CPU usage.",
"settings-blockPowerSavingInVoiceChat": "Block power saving in voice chat",
"settings-blockPowerSavingInVoiceChat-desc": "Prevent Legcord from being suspended. Keeps system active but allows screen to be turned off.",
"settings-mobileMode": "Mobile mode",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"xml-formatter": "^3.6.6"
},
"dependencies": {
"arrpc": "https://github.com/Legcord/arrpc.git#015c803a80288e3345ec55f8963015a626509007",
"arrpc": "https://github.com/Legcord/arrpc.git#f7ab641ad3386d44364e227d97ba0dc847de08d1",
"electron-context-menu": "^4.0.4",
"electron-is-dev": "^3.0.1",
"electron-updater": "^6.6.2",
Expand Down
18 changes: 9 additions & 9 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions src/@types/settings.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,8 @@ export interface Settings {
additionalArguments: string;
noBundleUpdates: boolean;
overlayButtonColor: string;
processScanning: boolean;
windowsLegacyScanning: boolean;
scanInterval: number;
modCache?: Record<ValidMods, string>;
}
3 changes: 3 additions & 0 deletions src/common/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ const defaults: Settings = {
bounceOnPing: false,
legcordCSP: true,
minimizeToTray: true,
processScanning: true,
windowsLegacyScanning: false,
scanInterval: 5000,
overlayButtonColor: "#121214",
keybinds: [],
audio: {
Expand Down
11 changes: 10 additions & 1 deletion src/discord/rpcProcess.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import path from "node:path";
import { type BrowserWindow, utilityProcess } from "electron";
import { getConfig } from "../common/config.js";
import { getDetectables } from "../common/detectables.js";
import { createInviteWindow } from "./window.js";

Expand All @@ -8,7 +9,15 @@ export let processList = [];

export function startRPC(window: BrowserWindow) {
child = utilityProcess.fork(path.join(import.meta.dirname, "rpc.js"), undefined, {
env: { detectables: JSON.stringify(getDetectables()) },
env: {
detectables: JSON.stringify(getDetectables()),
settings: JSON.stringify({
processScanning: getConfig("processScanning"),
windowsLegacyScanning: getConfig("windowsLegacyScanning"),
scanInterval: getConfig("scanInterval"),
}),
},
serviceName: "legcord-rpc",
});

child.on("spawn", () => {
Expand Down
7 changes: 5 additions & 2 deletions src/rpc.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
// this file is executed in the utility process
// check window.ts for more details
// see more here https://www.electronjs.org/docs/latest/api/utility-process
import RPCServer, { type GameList } from "arrpc";
import RPCServer, { type ServerSettings, type GameList } from "arrpc";

const detectables: GameList = process.env.detectables ? JSON.parse(process.env.detectables) : [];
const RPC = new RPCServer(detectables);
const settings: ServerSettings = process.env.settings
? JSON.parse(process.env.settings)
: { processScanning: true, windowsLegacyScanning: false, scanInterval: 5000 };
const RPC = new RPCServer(detectables, settings);

RPC.on("activity", (data: string) => {
console.log(data);
Expand Down
43 changes: 34 additions & 9 deletions src/shelter/settings/pages/SettingsPage.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Show } from "solid-js";
import type { Settings } from "../../../@types/settings.js";
import { DropdownItem } from "../components/DropdownItem.jsx";
import { HeroUpdater } from "../components/HeroUpdater.jsx";
import { TextBoxItem } from "../components/TextBoxItem.jsx";
import { setConfig, toggleMod } from "../settings.js";
import classes from "./SettingsPage.module.css";
Expand All @@ -16,7 +15,6 @@ const settings = store.settings as Settings;
export function SettingsPage() {
return (
<>
<HeroUpdater />
<Header class={classes.category} tag={HeaderTags.H5}>
{store.i18n["settings-category-mods"]}
</Header>
Expand All @@ -41,13 +39,6 @@ export function SettingsPage() {
>
Equicord
</SwitchItem>
<SwitchItem
note={store.i18n["settings-invitewebsocket-desc"]}
value={settings.inviteWebsocket}
onChange={(e: boolean) => setConfig("inviteWebsocket", e, true)}
>
{store.i18n["settings-invitewebsocket"]}
</SwitchItem>
<DropdownItem
value={settings.windowStyle}
onChange={(v) => setConfig("windowStyle", v as Settings["windowStyle"], true)}
Expand Down Expand Up @@ -262,6 +253,40 @@ export function SettingsPage() {
>
{store.i18n["settings-sleepInBackground"]}
</SwitchItem>
<Header class={classes.category} tag={HeaderTags.H5}>
arRPC
</Header>
<SwitchItem
note={store.i18n["settings-invitewebsocket-desc"]}
value={settings.inviteWebsocket}
onChange={(e: boolean) => setConfig("inviteWebsocket", e, true)}
>
{store.i18n["settings-invitewebsocket"]}
</SwitchItem>
<Show when={settings.inviteWebsocket === true}>
<SwitchItem
note={store.i18n["settings-processScanning-desc"]}
value={settings.processScanning}
onChange={(e: boolean) => setConfig("processScanning", e, true)}
>
{store.i18n["settings-processScanning"]}
</SwitchItem>
<Show when={window.legcord.platform === "win32"}>
<SwitchItem
note={store.i18n["settings-windowsLegacyScanning-desc"]}
value={settings.windowsLegacyScanning}
onChange={(e: boolean) => setConfig("windowsLegacyScanning", e, true)}
>
{store.i18n["settings-windowsLegacyScanning"]}
</SwitchItem>
</Show>
<TextBoxItem
title={store.i18n["settings-scanInterval"]}
note={store.i18n["settings-scanInterval-desc"]}
value={Number(settings.scanInterval).toString()}
onInput={(v: string) => setConfig("scanInterval", Number(v))}
/>
</Show>
<Header class={classes.category} tag={HeaderTags.H5}>
{store.i18n["settings-category-debug"]}
</Header>
Expand Down
Loading