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
2 changes: 2 additions & 0 deletions src/app/OverviewPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import {
OnboardProfileCard,
PulsarProCard,
SignalCard,
DongleLedCard,
SleepCard,
DpiLightingCard,
} from "./cards/AdvancedCards";
Expand Down Expand Up @@ -463,6 +464,7 @@ export function Workspace({
show(has.lowPower, ["advanced"]) ? <LowPowerCard key="lowpower" snapshot={snapshot} /> : null,
show(has.finalmouse, ["advanced"]) ? <FinalmouseCard key="finalmouse" snapshot={snapshot} /> : null,
show(has.incott, ["advanced"]) ? <IncottCard key="incott" snapshot={snapshot} /> : null,
device && show(has.dongleLed, ["advanced"]) ? <DongleLedCard key="dongle-led" snapshot={snapshot} /> : null,
show(has.atkProfile, ["profiles"]) ? <AtkProfileCard key="atk-profile" snapshot={snapshot} /> : null,
device && show(has.atkReceiver, ["advanced"]) ? <AtkReceiverCard key="atk-receiver" snapshot={snapshot} /> : null,
show(has.atkF1Dongle, ["advanced"]) ? <AtkDongleCard key="atk-dongle" snapshot={snapshot} /> : null,
Expand Down
20 changes: 20 additions & 0 deletions src/app/cards/AdvancedCards.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,26 @@ export function SignalCard({ snapshot }: { snapshot: ControlSnapshot }): ReactNo
);
}

export function DongleLedCard({ snapshot }: { snapshot: ControlSnapshot }): ReactNode {
const status = snapshot.status;
if (!status) return null;
const locale = snapshot.preferences.locale;
const staged = snapshot.pending.keys.includes("dongle-led");
return (
<article id="dongle-led-settings" className={`setting-card${staged ? " is-staged" : ""}`} data-pending-key="dongle-led">
<div className="setting-heading compact">
<div><p>WIRELESS</p><h2>{t(locale, "adv.dongleLed")}</h2></div>
<SwitchButton
id="dongle-led-toggle"
label={t(locale, "adv.dongleLed")}
value={status.dongleLedEnabled}
onChange={() => control.toggleDongleLed()}
/>
</div>
</article>
);
}

export function DebounceCard({ snapshot }: { snapshot: ControlSnapshot }): ReactNode {
const status = snapshot.status;
if (!status) return null;
Expand Down
4 changes: 4 additions & 0 deletions src/app/cards/availability.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export interface CardAvailability {
teevolutionDpiLighting: boolean;
finalmouse: boolean;
incott: boolean;
dongleLed: boolean;
eggFilter: boolean;
eggSpdt: boolean;
eggPolling: boolean;
Expand Down Expand Up @@ -60,6 +61,7 @@ const NOTHING: CardAvailability = {
teevolutionDpiLighting: false,
finalmouse: false,
incott: false,
dongleLed: false,
eggFilter: false,
eggSpdt: false,
eggPolling: false,
Expand Down Expand Up @@ -161,6 +163,8 @@ export function cardAvailability(snapshot: ControlSnapshot): CardAvailability {
// actually reported.
incott: host
&& (status.incottFireKeyTimes != null || status.incottReceiverLedMode != null),
// Drivers report a boolean only for receivers that answer the LED command.
dongleLed: typeof status.dongleLedEnabled === "boolean",
eggFilter: eggs,
eggSpdt: eggs,
// The 4K v2 reports no divider: its polling byte is a vendor enum.
Expand Down
4 changes: 2 additions & 2 deletions src/device/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3789,7 +3789,7 @@ export function applyLightforceSwitchMode(mode: NonNullable<MouseStatus["lightfo
}

export function toggleDongleLed(): void {
if (!pulsarClient()) return;
if (!hasActiveClient()) return;
const enabled = withPendingChanges(latestDeviceStatus!).dongleLedEnabled !== true;
stageChange({
key: "dongle-led",
Expand All @@ -3800,7 +3800,7 @@ export function toggleDongleLed(): void {
status.dongleLedEnabled = enabled;
},
apply: async () => {
const client = pulsarClient();
const client = activeSettingsClient();
if (!client) throw new Error(st("ctl.receiverGone"));
if (!("setDongleLed" in client)) {
throw new Error(st("ctl.noLedControl"));
Expand Down
1 change: 1 addition & 0 deletions src/preview-fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ const ATTACKSHARK: MouseStatus = {
brand: "Attack Shark" as MouseStatus["brand"],
name: "Attack Shark R5 Ultra",
ui: { family: "attack-shark", hideUnsupportedPollingRates: true, forceShowBattery: true },
dongleLedEnabled: false,
batteryPercent: 82,
batteryState: "Discharging",
dpi: 1600,
Expand Down
Loading