Skip to content

Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.

fix(recording): keep the remembered display out of the Record-mode source row

EtienneLescot8d244e52ab71
diff --git a/src/components/ai-edition/v4/EditorShellV4.module.css b/src/components/ai-edition/v4/EditorShellV4.module.css
index 11c696b02..bed8df50d 100644
--- a/src/components/ai-edition/v4/EditorShellV4.module.css
+++ b/src/components/ai-edition/v4/EditorShellV4.module.css
@@ -978,10 +978,6 @@
cursor: pointer;
max-width: 220px;
}
-/* The last pick, not a live one: same button, rest colour. */
-.recRowSourceBtnRemembered {
- color: var(--muted);
-}
.recRowSourceBtn > span,
.recRowSourceBtn {
white-space: nowrap;
diff --git a/src/components/ai-edition/v4/RecStage.test.tsx b/src/components/ai-edition/v4/RecStage.test.tsx
index 63fed17ae..aefa16bf7 100644
--- a/src/components/ai-edition/v4/RecStage.test.tsx
+++ b/src/components/ai-edition/v4/RecStage.test.tsx
@@ -136,47 +136,29 @@ describe("RecStage controls", () => {
expect(getSources).not.toHaveBeenCalled();
});
- it("names the last pick in the source row only, without selecting it", async () => {
+ // The HUD names the last pick in Apple's picker after a relaunch; this row does not. Beside
+ // a preview that still asks what to record, a name reads as a source that is already chosen.
+ it("keeps the last pick in Apple's picker out of the source row", async () => {
stubRecordingPrefs({ micEnabled: false });
- const getLastPickedSource = vi.fn(async () => "Studio Display");
Object.assign(window.electronAPI as unknown as Record<string, unknown>, {
- getLastPickedSource,
+ getLastPickedSource: vi.fn(async () => "Studio Display"),
});
renderRecStage();
- const row = await screen.findByRole("button", { name: "Studio Display" });
- expect(row).toHaveAttribute("data-remembered", "true");
- // Nothing is live: the preview keeps asking what to record.
- expect(screen.getAllByText("rec.selectSource")).toHaveLength(2);
+ await screen.findByRole("button", { name: "rec.selectSource" });
+ expect(screen.queryByText("Studio Display")).toBeNull();
+ expect(screen.getAllByText("rec.selectSource")).toHaveLength(3);
});
- it("shows a live source in place of the remembered name", async () => {
+ it("shows a live source in the source row", async () => {
stubRecordingPrefs(
{ micEnabled: false },
{ id: "screen:1:0", name: "Display 1", display_id: "1", thumbnail: null, appIcon: null },
);
- const getLastPickedSource = vi.fn(async () => "Studio Display");
- Object.assign(window.electronAPI as unknown as Record<string, unknown>, {
- getLastPickedSource,
- });
- renderRecStage();
-
- const row = await screen.findByRole("button", { name: "Display 1" });
- expect(row).not.toHaveAttribute("data-remembered");
- expect(screen.queryByRole("button", { name: "Studio Display" })).toBeNull();
- });
-
- it("asks to choose when nothing was picked before", async () => {
- stubRecordingPrefs({ micEnabled: false });
- const getLastPickedSource = vi.fn(async () => null);
- Object.assign(window.electronAPI as unknown as Record<string, unknown>, {
- getLastPickedSource,
- });
renderRecStage();
- await waitFor(() => expect(getLastPickedSource).toHaveBeenCalled());
- const row = screen.getByRole("button", { name: "rec.selectSource" });
- expect(row).not.toHaveAttribute("data-remembered");
+ await screen.findByRole("button", { name: "Display 1" });
+ expect(screen.queryByText("rec.selectSource")).toBeNull();
});
it("writes autoZoomEnabled through setRecordingPrefs on click", async () => {
diff --git a/src/components/ai-edition/v4/RecStage.tsx b/src/components/ai-edition/v4/RecStage.tsx
index f4f2b2db6..aeb1a99a2 100644
--- a/src/components/ai-edition/v4/RecStage.tsx
+++ b/src/components/ai-edition/v4/RecStage.tsx
@@ -20,7 +20,6 @@ import { useCameraDevices } from "@/hooks/useCameraDevices";
import { useCameraPreviewStream } from "@/hooks/useCameraPreviewStream";
import { useMicrophoneDevices } from "@/hooks/useMicrophoneDevices";
import { usePortalOwnsSource } from "@/hooks/usePortalOwnsSource";
-import { useRememberedSourceName } from "@/hooks/useRememberedSourceName";
import { canRecordMicrophone, getPlatform } from "@/utils/platformUtils";
import styles from "./EditorShellV4.module.css";
@@ -197,10 +196,6 @@ export function RecStage({
unsubscribe?.();
};
}, []);
- // Names the last pick in Apple's picker until a new one is made. Only the source row
- // shows it: `source` stays null, so Start recording still opens the picker first and
- // the preview keeps asking what to record.
- const rememberedSourceName = useRememberedSourceName(source !== null);
const [sourceModalOpen, setSourceModalOpen] = useState(false);
const [sourceTab, setSourceTab] = useState<"screen" | "window">("screen");
const [sources, setSources] = useState<ProcessedDesktopSource[]>([]);
@@ -267,7 +262,6 @@ export function RecStage({
const sourceLabel = portalOwnsSource
? t("rec.systemPicker")
: (source?.name ?? t("rec.selectSource"));
- const rememberedRow = source === null && rememberedSourceName !== null;
return (
<div className={styles.recStage}>
@@ -341,13 +335,10 @@ export function RecStage({
</div>
<button
type="button"
- className={`${styles.recRowSourceBtn}${
- rememberedRow ? ` ${styles.recRowSourceBtnRemembered}` : ""
- }`}
- data-remembered={rememberedRow || undefined}
+ className={styles.recRowSourceBtn}
onClick={() => void openSourceModal()}
>
- {rememberedRow ? rememberedSourceName : sourceLabel}
+ {sourceLabel}
<ChevronDown size={13} style={{ opacity: 0.6 }} />
</button>
</div>