Skip to content
This repository was archived by the owner on Feb 11, 2026. It is now read-only.

Commit d2a357f

Browse files
authored
Merge pull request #47 from elecordapp/rpc-settings
RPC settings tab
2 parents a2f589f + dbcd047 commit d2a357f

7 files changed

Lines changed: 117 additions & 6 deletions

File tree

res/css/structures/_UserRPC.pcss

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ Please see LICENSE files in the repository root for full details.
1010
display: flex;
1111
align-items: center;
1212

13+
user-select: none;
14+
cursor: pointer;
15+
1316
.mx_UserRPC_activity {
1417
width: 32px;
1518
height: 32px;
@@ -18,7 +21,8 @@ Please see LICENSE files in the repository root for full details.
1821
justify-content: center;
1922
align-items: center;
2023

21-
background-color: #000;
24+
color: #666c75;
25+
background-color: #1a1c1e;
2226
border-radius: 50%;
2327

2428
/* crop image to circle */

src/components/structures/UserRPC.tsx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ Please see LICENSE files in the repository root for full details.
77

88
import React, { useEffect, useState } from 'react';
99

10-
import { logger } from "matrix-js-sdk/src/logger";
10+
// import { logger } from "matrix-js-sdk/src/logger";
11+
12+
import defaultDispatcher from "../../dispatcher/dispatcher";
13+
import { Action } from "../../dispatcher/actions";
14+
import { UserTab } from "../views/dialogs/UserTab";
1115

1216
import { BridgeRPC, Activity } from '../../elecord/rpc/BridgeRPC';
1317

@@ -33,7 +37,15 @@ const UserRPC: React.FC = () => {
3337

3438
// render user activity
3539
return (
36-
<div className="mx_UserRPC">
40+
<div
41+
onClick={() => {
42+
defaultDispatcher.dispatch({
43+
action: Action.ViewUserSettings,
44+
initialTabId: UserTab.RichPresence,
45+
});
46+
}}
47+
className="mx_UserRPC"
48+
>
3749
<div className="mx_UserRPC_activity">
3850
{activity?.application_id && activity.status ? (
3951
<img

src/components/views/dialogs/UserSettingsDialog.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import KeyboardIcon from "@vector-im/compound-design-tokens/assets/web/icons/key
1818
import KeyIcon from "@vector-im/compound-design-tokens/assets/web/icons/key";
1919
import SidebarIcon from "@vector-im/compound-design-tokens/assets/web/icons/sidebar";
2020
import MicOnIcon from "@vector-im/compound-design-tokens/assets/web/icons/mic-on";
21+
import WorkspaceIcon from "@vector-im/compound-design-tokens/assets/web/icons/workspace";
2122
import LockIcon from "@vector-im/compound-design-tokens/assets/web/icons/lock";
2223
import LabsIcon from "@vector-im/compound-design-tokens/assets/web/icons/labs";
2324
import BlockIcon from "@vector-im/compound-design-tokens/assets/web/icons/block";
@@ -34,6 +35,7 @@ import SecurityUserSettingsTab from "../settings/tabs/user/SecurityUserSettingsT
3435
import NotificationUserSettingsTab from "../settings/tabs/user/NotificationUserSettingsTab";
3536
import PreferencesUserSettingsTab from "../settings/tabs/user/PreferencesUserSettingsTab";
3637
import VoiceUserSettingsTab from "../settings/tabs/user/VoiceUserSettingsTab";
38+
import RichPresenceUserSettingsTab from "../settings/tabs/user/RichPresenceUserSettingsTab";
3739
import HelpUserSettingsTab from "../settings/tabs/user/HelpUserSettingsTab";
3840
import MjolnirUserSettingsTab from "../settings/tabs/user/MjolnirUserSettingsTab";
3941
import { UIFeature } from "../../../settings/UIFeature";
@@ -78,6 +80,8 @@ function titleForTabID(tabId: UserTab): React.ReactNode {
7880
return _t("settings|sidebar|dialog_title", undefined, subs);
7981
case UserTab.Voice:
8082
return _t("settings|voip|dialog_title", undefined, subs);
83+
case UserTab.RichPresence:
84+
return _t("settings|rich_presence|dialog_title", undefined, subs);
8185
case UserTab.Security:
8286
return _t("settings|security|dialog_title", undefined, subs);
8387
case UserTab.Encryption:
@@ -179,6 +183,17 @@ export default function UserSettingsDialog(props: IProps): JSX.Element {
179183
);
180184
}
181185

186+
// elecord, rich presence tab
187+
tabs.push(
188+
new Tab(
189+
UserTab.RichPresence,
190+
_td("settings|rich_presence|title"),
191+
<WorkspaceIcon />,
192+
<RichPresenceUserSettingsTab />,
193+
"UserSettingsRichPresence",
194+
),
195+
);
196+
182197
tabs.push(
183198
new Tab(
184199
UserTab.Security,
@@ -212,6 +227,7 @@ export default function UserSettingsDialog(props: IProps): JSX.Element {
212227
);
213228
}
214229

230+
// elecord, changelog tab
215231
tabs.push(
216232
new Tab(
217233
UserTab.Changelog,

src/components/views/dialogs/UserTab.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export enum UserTab {
1414
Keyboard = "USER_KEYBOARD_TAB",
1515
Sidebar = "USER_SIDEBAR_TAB",
1616
Voice = "USER_VOICE_TAB",
17+
RichPresence = "USER_RICH_PRESENCE_TAB",
1718
Security = "USER_SECURITY_TAB",
1819
Encryption = "USER_ENCRYPTION_TAB",
1920
Labs = "USER_LABS_TAB",
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
/*
2+
Copyright 2025 hazzuk.
3+
4+
SPDX-License-Identifier: AGPL-3.0-only
5+
Please see LICENSE files in the repository root for full details.
6+
*/
7+
8+
import React from "react";
9+
import { _t } from "../../../../../languageHandler";
10+
11+
import PopOutIcon from "@vector-im/compound-design-tokens/assets/web/icons/pop-out";
12+
13+
import SettingsTab from "../SettingsTab";
14+
import { SettingsSection } from "../../shared/SettingsSection";
15+
import AccessibleButton from "../../../elements/AccessibleButton";
16+
import { SettingsSubsectionText } from "../../shared/SettingsSubsection";
17+
18+
const ERPC_URL = "https://packages.elecord.app/rpc/install/win32/x64/elecord-rpc-win.exe";
19+
20+
const RichPresenceUserSettingsTab: React.FC = () => {
21+
22+
// download external erpc app
23+
const onDownloadClick = (): void => {
24+
window.open(ERPC_URL, "_blank");
25+
};
26+
27+
return (
28+
<SettingsTab>
29+
<SettingsSection heading={_t("settings|rich_presence|setup_heading")}>
30+
31+
{/* description */}
32+
<SettingsSubsectionText>
33+
{_t("settings|rich_presence|description")}
34+
</SettingsSubsectionText>
35+
36+
{/* usage */}
37+
<SettingsSubsectionText>
38+
{_t("settings|rich_presence|usage")}
39+
</SettingsSubsectionText>
40+
41+
{/* setup steps */}
42+
<SettingsSubsectionText>
43+
{_t("settings|rich_presence|setup_steps")}
44+
</SettingsSubsectionText>
45+
46+
{/* sending notice */}
47+
<div className="mx_SettingsFlag_microcopy">
48+
{_t("settings|rich_presence|sending_notice")}
49+
</div>
50+
51+
{/* download button */}
52+
<AccessibleButton kind="primary_outline" onClick={onDownloadClick}>
53+
{_t("settings|rich_presence|download_button")}
54+
<PopOutIcon height={20} width={20} />
55+
</AccessibleButton>
56+
57+
{/* detection notice */}
58+
<div className="mx_SettingsFlag_microcopy">
59+
{_t("settings|rich_presence|detection_notice")}
60+
</div>
61+
62+
</SettingsSection>
63+
</SettingsTab>
64+
);
65+
};
66+
67+
export default RichPresenceUserSettingsTab;

src/i18n/strings/en_EN.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2762,6 +2762,17 @@
27622762
},
27632763
"prompt_invite": "Prompt before sending invites to potentially invalid matrix IDs",
27642764
"replace_plain_emoji": "Automatically replace plain text Emoji",
2765+
"rich_presence": {
2766+
"title": "Rich Presence",
2767+
"dialog_title": "<strong>Settings:</strong> Rich Presence",
2768+
"setup_heading": "RPC Setup",
2769+
"description": "Rich Presence lets your friends see what you're playing in real time.",
2770+
"usage": "When enabled, elecord will show your current game to your friends (also displayed under your profile picture).",
2771+
"setup_steps": "To enable sending Rich Presence, you'll need to download the elecord-rpc app. Just follow the simple on-screen instructions to get started. Once installed, elecord-rpc will run automatically as a lightweight background service, detecting the games you play while using elecord.",
2772+
"download_button": "Download",
2773+
"sending_notice": "When RPC is enabled, elecord will currently display your active game to any user you have a direct message with. Additionally, there's a temporary limit of up to 8 friends to be able to send RPC messages (this is to prevent unintentionally spamming your homeserver with RPC messages).",
2774+
"detection_notice": "Please note that elecord might not always detect your game reliably (especially new releases). This is a known issue and game detection will be continuously improved with future updates."
2775+
},
27652776
"security": {
27662777
"4s_public_key_in_account_data": "in account data",
27672778
"4s_public_key_status": "Secret storage public key:",

yarn.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3531,9 +3531,9 @@
35313531
integrity sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==
35323532

35333533
"@vector-im/compound-design-tokens@^4.0.0":
3534-
version "4.0.0"
3535-
resolved "https://registry.yarnpkg.com/@vector-im/compound-design-tokens/-/compound-design-tokens-4.0.0.tgz#4922404f355f09fb753e6a91cc7efe4e661c9ff1"
3536-
integrity sha512-hFfLSKrGc58rPRp9JH1mkgw3moFEgpL8RQzyDESHErq7P1lUmlIuwKFTVfK5SbdFM5GvHp7nQaFpVmxUQ3Xp+w==
3534+
version "4.0.2"
3535+
resolved "https://registry.yarnpkg.com/@vector-im/compound-design-tokens/-/compound-design-tokens-4.0.2.tgz#27363d26446eaa21880ab126fa51fec112e6fd86"
3536+
integrity sha512-y13bhPyJ5OzbGRl21F6+Y2adrjyK+mu67yKTx+o8MfmIpJzMSn4KkHZtcujMquWSh0e5ZAufsnk4VYvxbSpr1A==
35373537

35383538
"@vector-im/compound-web@^7.6.4":
35393539
version "7.6.4"

0 commit comments

Comments
 (0)