From 1382acd0c5f8f83954d04a63a60906df2c7c16e4 Mon Sep 17 00:00:00 2001 From: MahmodZE <97690050+MahmodZE@users.noreply.github.com> Date: Thu, 8 Jan 2026 10:37:43 -0800 Subject: [PATCH] =?UTF-8?q?fix:=20screenshare=20picker=20modal=20closes=20?= =?UTF-8?q?on=20click-outside=20and=20won=E2=80=99t=20reopen=20(#1002)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/@types/legcordWindow.d.ts | 5 ++++- src/shelter/screenshare/components/ScreensharePicker.tsx | 4 +++- src/shelter/screenshare/components/SourceCard.tsx | 4 +++- src/shelter/screenshare/index.tsx | 3 +-- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/@types/legcordWindow.d.ts b/src/@types/legcordWindow.d.ts index a0437119..1923e8fb 100644 --- a/src/@types/legcordWindow.d.ts +++ b/src/@types/legcordWindow.d.ts @@ -1,5 +1,6 @@ import type { Node } from "@vencord/venmic"; import type { Game, GameList, ProcessInfo } from "arrpc"; +import type { IPCSources } from "../shelter/screenshare/components/SourceCard.tsx"; import type { Keybind } from "./keybind.js"; import type { Settings } from "./settings.js"; import type { ThemeManifest } from "./themeManifest.js"; @@ -45,7 +46,9 @@ export interface LegcordWindow { isPowerSavingEnabled: () => boolean; }; screenshare: { - getSources: undefined; + getSources: ( + callback: (event: Electron.IpcRendererEvent, sources: Array, ...args: unknown[]) => void, + ) => void; start: (id: string, name: string, audio: boolean) => void; venmicStart: (include: Node[]) => Promise; venmicSystemStart: (exclude: Node[]) => Promise; diff --git a/src/shelter/screenshare/components/ScreensharePicker.tsx b/src/shelter/screenshare/components/ScreensharePicker.tsx index 08b673a4..9521b8a4 100644 --- a/src/shelter/screenshare/components/ScreensharePicker.tsx +++ b/src/shelter/screenshare/components/ScreensharePicker.tsx @@ -1,5 +1,5 @@ import type { Node } from "@vencord/venmic"; -import { For, Show, createSignal } from "solid-js"; +import { For, Show, createSignal, onCleanup } from "solid-js"; import { Dropdown } from "../../settings/components/Dropdown.jsx"; import { SegmentedControl } from "../../settings/components/SegmentedControl.jsx"; import classes from "./ScreensharePicker.module.css"; @@ -88,6 +88,8 @@ export const ScreensharePicker = (props: { window.legcord.screenshare.start("none", "", false); props.close(); } + onCleanup(closeAndSave); + return ( Screenshare diff --git a/src/shelter/screenshare/components/SourceCard.tsx b/src/shelter/screenshare/components/SourceCard.tsx index 3e842c9c..ee817fca 100644 --- a/src/shelter/screenshare/components/SourceCard.tsx +++ b/src/shelter/screenshare/components/SourceCard.tsx @@ -1,9 +1,11 @@ +import type { NativeImage } from "electron"; import type { Accessor } from "solid-js"; import classes from "./SourceCard.module.css"; + export interface IPCSources { id: string; name: string; - thumbnail: HTMLCanvasElement; + thumbnail: NativeImage; } interface SourceCardProps { source: IPCSources; diff --git a/src/shelter/screenshare/index.tsx b/src/shelter/screenshare/index.tsx index 3e44f5e9..7645b79a 100644 --- a/src/shelter/screenshare/index.tsx +++ b/src/shelter/screenshare/index.tsx @@ -57,8 +57,7 @@ function onStreamEnd(dispatch: StreamDispatch) { export function onLoad() { log("Legcord Screenshare Module"); - // @ts-expect-error fix types - window.legcord.screenshare.getSources(async (_event: Event, sources: IPCSources[]) => { + window.legcord.screenshare.getSources(async (_event: Electron.IpcRendererEvent, sources: IPCSources[]) => { let audioSources: Node[] | undefined; if (window.legcord.platform === "linux") { const venmic = await window.legcord.screenshare.venmicList();