Skip to content

Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.

feat(onboarding): add Screen Context permission (#1856)

void83622fd6eb65
diff --git a/src/assets/onboarding-permission-screen-context.webp b/src/assets/onboarding-permission-screen-context.webp
new file mode 100644
index 000000000..58356d05c
Binary files /dev/null and b/src/assets/onboarding-permission-screen-context.webp differ
diff --git a/src/components/OnboardingFlow.tsx b/src/components/OnboardingFlow.tsx
index a3cc66dc9..2fcfb1a7b 100644
--- a/src/components/OnboardingFlow.tsx
+++ b/src/components/OnboardingFlow.tsx
@@ -18,6 +18,7 @@ import { AlertDialog } from "./ui/dialog";
import { useAuth } from "../hooks/useAuth";
import { usePermissions } from "../hooks/usePermissions";
import { useClipboard } from "../hooks/useClipboard";
+import { useScreenRecordingPermission } from "../hooks/useScreenRecordingPermission";
import { useSystemAudioPermission } from "../hooks/useSystemAudioPermission";
import { useSettings } from "../hooks/useSettings";
import { useLocalStorage } from "../hooks/useLocalStorage";
@@ -26,7 +27,7 @@ import { useHotkeyModeInfo } from "../hooks/useHotkeyModeInfo";
import { useWorkspace } from "../hooks/useWorkspace";
import { useRequiredLocalModels } from "../hooks/useRequiredLocalModels";
import { usePolicyStore } from "../stores/policyStore";
-import { isAgentAllowed } from "../stores/policyRules";
+import { isAgentAllowed, isScreenContextAllowed } from "../stores/policyRules";
import { useSettingsStore } from "../stores/settingsStore";
import { getDefaultHotkey, parseHotkeyList, serializeHotkeyList } from "../utils/hotkeys";
import { formatHotkeyInstruction } from "./onboarding/hotkeyPresentation";
@@ -77,6 +78,7 @@ export default function OnboardingFlow({ onComplete }: OnboardingFlowProps) {
const { t } = useTranslation();
const { isSignedIn } = useAuth();
const agentAllowed = usePolicyStore(isAgentAllowed);
+ const screenContextAllowed = usePolicyStore(isScreenContextAllowed);
const settings = useSettings();
const settingsStore = useSettingsStore();
const {
@@ -121,6 +123,11 @@ export default function OnboardingFlow({ onComplete }: OnboardingFlowProps) {
setPermissionAlert({ title: dialog.title, description: dialog.description })
);
const systemAudio = useSystemAudioPermission();
+ const {
+ granted: screenRecordingGranted,
+ needsRelaunch: screenRecordingNeedsRelaunch,
+ request: requestScreenRecordingAccess,
+ } = useScreenRecordingPermission();
const { supportsPushToTalk, pushToTalkUnavailableReason } = useHotkeyModeInfo(
"onboarding",
dictationHotkey
@@ -169,6 +176,38 @@ export default function OnboardingFlow({ onComplete }: OnboardingFlowProps) {
(!workspacesLoaded ||
(!activeWorkspace && skipSetupChoiceForEnterprise && Boolean(enterpriseWorkspace)));
+ // The setting turns on only once the permission is actually granted, so an
+ // Enable click whose System Settings grant is abandoned can't leave screen
+ // context armed to activate silently on some later grant.
+ const [screenContextRequested, setScreenContextRequested] = useState(false);
+
+ const applyScreenContext = useCallback(() => {
+ settingsStore.setVoiceAgentScreenContext(true);
+ // Keeps the dictation overlay out of its own screenshots.
+ void window.electronAPI?.setScreenContextEnabled?.(true);
+ }, [settingsStore]);
+
+ const enableScreenContext = useCallback(async () => {
+ setScreenContextRequested(true);
+ const granted = await requestScreenRecordingAccess();
+ if (granted) applyScreenContext();
+ return granted;
+ }, [applyScreenContext, requestScreenRecordingAccess]);
+
+ // macOS grants Screen Recording in System Settings, outside the app; the
+ // permission hook re-checks on window focus. When the grant lands, complete
+ // the opt-in the Enable click started — within this session only.
+ useEffect(() => {
+ if (!screenContextRequested || !screenRecordingGranted) return;
+ if (settingsStore.voiceAgentScreenContext) return;
+ applyScreenContext();
+ }, [
+ screenContextRequested,
+ screenRecordingGranted,
+ settingsStore.voiceAgentScreenContext,
+ applyScreenContext,
+ ]);
+
const requiredModels = useRequiredLocalModels();
// Latched for the session once the step is entered (or resumed at), so a
// mid-download policy refresh or the disk check settling can't rebuild the
@@ -649,6 +688,16 @@ export default function OnboardingFlow({ onComplete }: OnboardingFlowProps) {
<CompactPermissionsStep
permissions={permissions}
systemAudio={systemAudio}
+ screenContext={
+ agentAllowed && screenContextAllowed
+ ? {
+ enabled: settingsStore.voiceAgentScreenContext,
+ granted: screenRecordingGranted,
+ needsRelaunch: screenRecordingNeedsRelaunch,
+ request: enableScreenContext,
+ }
+ : undefined
+ }
onContinue={() => void continueFromCurrentStep()}
/>
);
diff --git a/src/components/onboarding/CompactPermissionsStep.tsx b/src/components/onboarding/CompactPermissionsStep.tsx
index 21c24971a..b1097fd60 100644
--- a/src/components/onboarding/CompactPermissionsStep.tsx
+++ b/src/components/onboarding/CompactPermissionsStep.tsx
@@ -3,11 +3,13 @@ import { createPortal } from "react-dom";
import { CircleCheck } from "lucide-react";
import { useTranslation } from "react-i18next";
// Imported (not referenced by path) so Vite fingerprints them and they resolve
-// under the packaged app's file:// origin. Authored at 88px = 2x the 44px slot,
-// with their rounded corners baked in as transparency.
+// under the packaged app's file:// origin. Authored at 88px (2x the original
+// 44px slot; the row has since tightened to a 40px slot), with their rounded
+// corners baked in as transparency.
import microphoneIcon from "@/assets/onboarding-permission-microphone.webp";
import accessibilityIcon from "@/assets/onboarding-permission-accessibility.webp";
import systemAudioIcon from "@/assets/onboarding-permission-system-audio.webp";
+import screenContextIcon from "@/assets/onboarding-permission-screen-context.webp";
import type { UsePermissionsReturn } from "../../hooks/usePermissions";
import type { SystemAudioAccessResult } from "../../types/electron";
import { canManageSystemAudioInApp } from "../../utils/systemAudioAccess";
@@ -23,10 +25,16 @@ interface CompactPermissionsStepProps {
systemAudio: Pick<SystemAudioAccessResult, "granted" | "mode" | "supportsOnboardingGrant"> & {
request: () => Promise<boolean>;
};
+ screenContext?: {
+ enabled: boolean;
+ granted: boolean;
+ needsRelaunch: boolean;
+ request: () => Promise<boolean>;
+ };
onContinue: () => void;
}
-type PermissionRowId = "microphone" | "accessibility" | "system-audio";
+type PermissionRowId = "microphone" | "accessibility" | "system-audio" | "screen-context";
interface PermissionRowProps {
title: string;
@@ -50,7 +58,7 @@ function PermissionRow({
const { t } = useTranslation();
return (
- <div className="flex h-[5.25rem] items-center gap-3.5">
+ <div className="flex h-16 items-center gap-3">
{/* Decorative: the adjacent title and description already name the
permission, so announcing the icon too would just duplicate it. The
icon stays put once granted — the button carries the state. */}
@@ -58,18 +66,18 @@ function PermissionRow({
src={iconSrc}
alt=""
aria-hidden="true"
- width={44}
- height={44}
+ width={40}
+ height={40}
decoding="async"
draggable={false}
- className="size-11 shrink-0 select-none"
+ className="size-10 shrink-0 select-none"
/>
<div className="min-w-0 flex-1 text-left">
- <p className="text-base font-medium leading-5 text-[var(--onboarding-text-primary)]">
+ <p className="text-sm font-medium leading-5 text-[var(--onboarding-text-primary)]">
{title}
</p>
- <p className="mt-1 truncate text-sm leading-5 text-[var(--onboarding-text-secondary)]">
+ <p className="mt-0.5 line-clamp-2 text-xs leading-4 text-[var(--onboarding-text-secondary)]">
{description}
</p>
</div>
@@ -78,7 +86,7 @@ function PermissionRow({
type="button"
disabled={busy || disabled || granted}
onClick={() => void onRequest()}
- className={`onboarding-pressable inline-flex h-9 min-w-24 shrink-0 items-center justify-center gap-1.5 rounded-full px-3 text-sm font-normal focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[color-mix(in_srgb,var(--onboarding-accent)_30%,transparent)] disabled:cursor-default ${
+ className={`onboarding-pressable inline-flex h-8 min-w-20 shrink-0 items-center justify-center gap-1 rounded-full px-2.5 text-xs font-normal focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[color-mix(in_srgb,var(--onboarding-accent)_30%,transparent)] disabled:cursor-default ${
granted
? // Granted rows are disabled, so the disabled: variants have to
// restate the tint or it falls back to the neutral grey below.
@@ -86,7 +94,7 @@ function PermissionRow({
: "bg-[var(--onboarding-surface-tertiary)] text-[var(--onboarding-text-secondary)] hover:bg-[var(--onboarding-surface-tertiary-hover)] disabled:bg-[var(--onboarding-surface-tertiary)] disabled:text-[var(--onboarding-text-secondary)]"
}`}
>
- {granted && !busy && <CircleCheck className="size-4 shrink-0" aria-hidden="true" />}
+ {granted && !busy && <CircleCheck className="size-3.5 shrink-0" aria-hidden="true" />}
{busy
? t("common.loading")
: granted
@@ -100,6 +108,7 @@ function PermissionRow({
export default function CompactPermissionsStep({
permissions,
systemAudio,
+ screenContext,
onContinue,
}: CompactPermissionsStepProps) {
const { t } = useTranslation();
@@ -113,6 +122,9 @@ export default function CompactPermissionsStep({
// showing those rows there is either a no-op button or a dead disabled one.
const showAccessibility = platform === "darwin";
const showSystemAudio = platform === "darwin";
+ // Screen Context: macOS grants via TCC, Windows is a permissionless opt-in;
+ // Linux is hidden because Wayland capture is unsupported.
+ const showScreenContext = platform === "darwin" || platform === "win32";
const showLinuxPasteGuidance =
platform === "linux" &&
permissions.pasteToolsInfo !== null &&
@@ -141,26 +153,26 @@ export default function CompactPermissionsStep({
// Literal white, not tokens: this sits on the indigo hero, which
// stays indigo in both themes.
style={{ WebkitAppRegion: "no-drag" } as CSSProperties}
- className={`onboarding-pressable fixed top-5 z-[60] h-8 rounded-full bg-white px-4 text-sm font-medium text-neutral-950 transition-colors hover:bg-white/85 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/70 ${platform === "darwin" ? "right-5" : "right-24"}`}
+ className={`onboarding-pressable fixed top-4 z-[60] h-7 rounded-full bg-white px-3 text-xs font-medium text-neutral-950 transition-colors hover:bg-white/85 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/70 ${platform === "darwin" ? "right-4" : "right-24"}`}
>
{t("common.continue")}
</button>,
document.body
)}
- <div className="onboarding-shell-scroll h-full overflow-y-auto px-6 pb-6 pt-44 text-center">
+ <div className="onboarding-shell-scroll h-full overflow-y-auto px-5 pb-4 pt-44 text-center">
{/* text-balance evens the two lines out ("Set up OpenWhispr" / "in 3
minutes") instead of leaving one word stranded. Preferred over a
hardcoded <br> because the break point stays correct in all 9
locales, where the string length differs. */}
- <h1 className="onboarding-display-title mx-auto max-w-72 text-balance">
+ <h1 className="onboarding-display-title mx-auto max-w-72 text-balance text-3xl!">
{t("onboarding.rehaul.permissions.title")}
</h1>
- <p className="mt-3 text-base text-[var(--onboarding-text-secondary)]">
+ <p className="mt-2 text-sm text-[var(--onboarding-text-secondary)]">
{t("auth.welcomeSubtitle")}
</p>
- <div className="mt-[3.125rem] rounded-[1.35rem] bg-[var(--onboarding-surface-secondary)] px-4 py-1.5">
+ <div className="mt-8 rounded-[1.35rem] bg-[var(--onboarding-surface-secondary)] px-3 py-1">
<PermissionRow
title={t("onboarding.permissions.microphoneTitle")}
description={t("onboarding.rehaul.permissions.microphoneDescription")}
@@ -198,10 +210,29 @@ export default function CompactPermissionsStep({
/>
</>
)}
+ {showScreenContext && screenContext && (
+ <>
+ <div className="h-px bg-[var(--onboarding-surface-tertiary)]" />
+ <PermissionRow
+ title={t("dictationAgent.screenContext.title")}
+ description={t("onboarding.rehaul.permissions.screenContextDescription")}
+ granted={screenContext.enabled && screenContext.granted}
+ busy={busyPermission === "screen-context"}
+ iconSrc={screenContextIcon}
+ onRequest={() => request("screen-context", screenContext.request)}
+ />
+ </>
+ )}
</div>
+ {platform === "darwin" && screenContext?.enabled && screenContext.needsRelaunch && (
+ <p className="mt-2 text-left text-xs leading-4 text-warning/80">
+ {t("dictationAgent.screenContext.relaunchHint")}
+ </p>
+ )}
+
{!permissions.micPermissionGranted && permissions.micPermissionError && (
- <div className="mt-4 text-left">
+ <div className="mt-3 text-left">
<MicPermissionWarning
error={permissions.micPermissionError}
onOpenSoundSettings={() => void permissions.openSoundInputSettings()}
@@ -211,7 +242,7 @@ export default function CompactPermissionsStep({
)}
{showLinuxPasteGuidance && (
- <div className="mt-4 text-left">
+ <div className="mt-3 text-left">
<PasteToolsInfo
pasteToolsInfo={permissions.pasteToolsInfo}
isChecking={permissions.isCheckingPasteTools}
diff --git a/src/index.css b/src/index.css
index dae3a6dd5..71a49071d 100644
--- a/src/index.css
+++ b/src/index.css
@@ -824,7 +824,9 @@ h1 {
}
/* The compact first-run steps (auth + permissions, per COMPACT_STEPS in
- OnboardingFlow.tsx) intentionally keep their existing 32px scale. */
+ OnboardingFlow.tsx) intentionally keep their existing 32px scale. Exception:
+ CompactPermissionsStep overrides its title to 30px (text-3xl!) so all four
+ permission rows fit the authored 480×624 window without scrolling. */
.onboarding-canvas.compact .onboarding-display-title {
font-size: 2rem; /* 32px */
}
diff --git a/src/locales/de/translation.json b/src/locales/de/translation.json
index a3d40b7ab..64995a4ac 100644
--- a/src/locales/de/translation.json
+++ b/src/locales/de/translation.json
@@ -186,6 +186,7 @@
"accessibilityDescription": "Fügt Text in deine aktive App ein.",
"systemAudioTitle": "Systemaudio",
"systemAudioDescription": "Nimmt Audio aus anderen Apps auf.",
+ "screenContextDescription": "Lässt deinen Sprachassistenten deinen Bildschirm sehen. Wird nie gespeichert.",
"enable": "Aktivieren",
"enabled": "Aktiviert"
},
diff --git a/src/locales/en/translation.json b/src/locales/en/translation.json
index c0eb843dd..8e3940a32 100644
--- a/src/locales/en/translation.json
+++ b/src/locales/en/translation.json
@@ -186,6 +186,7 @@
"accessibilityDescription": "Pastes text into your active app.",
"systemAudioTitle": "System Audio",
"systemAudioDescription": "Captures audio from other apps.",
+ "screenContextDescription": "Lets your voice assistant see your screen. Never stored.",
"enable": "Enable",
"enabled": "Enabled"
},
diff --git a/src/locales/es/translation.json b/src/locales/es/translation.json
index 13f8a9c05..39582c763 100644
--- a/src/locales/es/translation.json
+++ b/src/locales/es/translation.json
@@ -186,6 +186,7 @@
"accessibilityDescription": "Pega texto en tu aplicación activa.",
"systemAudioTitle": "Audio del Sistema",
"systemAudioDescription": "Captura audio de otras aplicaciones.",
+ "screenContextDescription": "Permite que tu asistente de voz vea tu pantalla. Nunca se guarda.",
"enable": "Activar",
"enabled": "Activado"
},
diff --git a/src/locales/fr/translation.json b/src/locales/fr/translation.json
index 5c3eb7eab..61102d779 100644
--- a/src/locales/fr/translation.json
+++ b/src/locales/fr/translation.json
@@ -186,6 +186,7 @@
"accessibilityDescription": "Colle le texte dans votre application active.",
"systemAudioTitle": "Audio Système",
"systemAudioDescription": "Capture l’audio d’autres applications.",
+ "screenContextDescription": "Permet à votre assistant vocal de voir votre écran. Jamais enregistré.",
"enable": "Activer",
"enabled": "Activé"
},
diff --git a/src/locales/it/translation.json b/src/locales/it/translation.json
index b8c197611..bc512f9b9 100644
--- a/src/locales/it/translation.json
+++ b/src/locales/it/translation.json
@@ -186,6 +186,7 @@
"accessibilityDescription": "Incolla il testo nell’app attiva.",
"systemAudioTitle": "Audio di Sistema",
"systemAudioDescription": "Acquisisce l’audio da altre app.",
+ "screenContextDescription": "Consente all’assistente vocale di vedere lo schermo. Mai salvato.",
"enable": "Attiva",
"enabled": "Attivato"
},
diff --git a/src/locales/ja/translation.json b/src/locales/ja/translation.json
index 9fd1ea323..71a25bd7f 100644
--- a/src/locales/ja/translation.json
+++ b/src/locales/ja/translation.json
@@ -186,6 +186,7 @@
"accessibilityDescription": "アクティブなアプリにテキストを貼り付けます。",
"systemAudioTitle": "システムオーディオ",
"systemAudioDescription": "ほかのアプリの音声を取り込みます。",
+ "screenContextDescription": "音声アシスタントが作業中の画面を確認できます。保存はされません。",
"enable": "有効にする",
"enabled": "有効"
},
diff --git a/src/locales/pt/translation.json b/src/locales/pt/translation.json
index 85b6de06a..c29e71f6e 100644
--- a/src/locales/pt/translation.json
+++ b/src/locales/pt/translation.json
@@ -165,6 +165,7 @@
"accessibilityDescription": "Cola o texto no app ativo.",
"systemAudioTitle": "Áudio do Sistema",
"systemAudioDescription": "Captura o áudio de outros apps.",
+ "screenContextDescription": "Permite que o assistente de voz veja sua tela. Nunca é salvo.",
"enable": "Ativar",
"enabled": "Ativado"
},
diff --git a/src/locales/ru/translation.json b/src/locales/ru/translation.json
index 05254ea2d..1c52a94eb 100644
--- a/src/locales/ru/translation.json
+++ b/src/locales/ru/translation.json
@@ -186,6 +186,7 @@
"accessibilityDescription": "Вставляет текст в активное приложение.",
"systemAudioTitle": "Системное аудио",
"systemAudioDescription": "Записывает звук из других приложений.",
+ "screenContextDescription": "Позволяет голосовому помощнику видеть ваш экран. Никогда не сохраняется.",
"enable": "Включить",
"enabled": "Включено"
},
diff --git a/src/locales/zh-CN/translation.json b/src/locales/zh-CN/translation.json
index 75a4be5d5..9de63bc53 100644
--- a/src/locales/zh-CN/translation.json
+++ b/src/locales/zh-CN/translation.json
@@ -186,6 +186,7 @@
"accessibilityDescription": "将文本粘贴到当前应用。",
"systemAudioTitle": "系统音频",
"systemAudioDescription": "捕获其他应用的音频。",
+ "screenContextDescription": "让语音助手查看当前屏幕,绝不保存。",
"enable": "启用",
"enabled": "已启用"
},
diff --git a/src/locales/zh-TW/translation.json b/src/locales/zh-TW/translation.json
index 84ac53b4c..dabc56369 100644
--- a/src/locales/zh-TW/translation.json
+++ b/src/locales/zh-TW/translation.json
@@ -186,6 +186,7 @@
"accessibilityDescription": "將文字貼到目前的 App。",
"systemAudioTitle": "系統音訊",
"systemAudioDescription": "擷取其他 App 的音訊。",
+ "screenContextDescription": "讓語音助理查看目前螢幕,絕不儲存。",
"enable": "啟用",
"enabled": "已啟用"
},
diff --git a/test/components/onboardingCompatibility.test.js b/test/components/onboardingCompatibility.test.js
index d4378e55e..ec475c966 100644
--- a/test/components/onboardingCompatibility.test.js
+++ b/test/components/onboardingCompatibility.test.js
@@ -7,9 +7,9 @@ const { createRendererServer, installBrowserGlobals } = require("../lib/renderer
const noop = () => {};
const asyncNoop = async () => {};
-async function createOnboardingRenderer(t) {
+async function createOnboardingRenderer(t, platform = "linux") {
installBrowserGlobals(t, {
- window: { electronAPI: { getPlatform: () => "linux" } },
+ window: { electronAPI: { getPlatform: () => platform } },
});
return createRendererServer(t, {
cachePrefix: "openwhispr-onboarding-compatibility-",
@@ -27,9 +27,10 @@ async function createOnboardingRenderer(t) {
"onboarding-permission-microphone.webp": `export default "microphone.webp";`,
"onboarding-permission-accessibility.webp": `export default "accessibility.webp";`,
"onboarding-permission-system-audio.webp": `export default "system-audio.webp";`,
+ "onboarding-permission-screen-context.webp": `export default "screen-context.webp";`,
"/utils/platform": `
- export function getPlatform() { return "linux"; }
- export function getCachedPlatform() { return "linux"; }
+ export function getPlatform() { return "${platform}"; }
+ export function getCachedPlatform() { return "${platform}"; }
`,
},
});
@@ -61,6 +62,13 @@ const systemAudio = {
request: async () => false,
};
+const screenContext = {
+ enabled: false,
+ granted: false,
+ needsRelaunch: false,
+ request: async () => false,
+};
+
test("compact Linux onboarding keeps minimize and close controls", async (t) => {
const vite = await createOnboardingRenderer(t);
const { default: OnboardingShell } = await vite.ssrLoadModule(
@@ -136,3 +144,107 @@ test("Linux onboarding shows paste-tool installation and recheck guidance", asyn
assert.match(markup, /sudo apt install xdotool/);
assert.match(markup, />pasteToolsInfo.recheck<\/button>/);
});
+
+test("macOS onboarding offers optional Screen Context setup", async (t) => {
+ const vite = await createOnboardingRenderer(t, "darwin");
+ const { default: CompactPermissionsStep } = await vite.ssrLoadModule(
+ "/components/onboarding/CompactPermissionsStep.tsx"
+ );
+
+ const markup = renderToStaticMarkup(
+ React.createElement(CompactPermissionsStep, {
+ permissions: permissions(),
+ systemAudio,
+ screenContext,
+ onContinue: noop,
+ })
+ );
+
+ assert.match(markup, /dictationAgent\.screenContext\.title/);
+ assert.match(markup, /screen-context\.webp/);
+ assert.doesNotMatch(markup, /dictationAgent\.screenContext\.relaunchHint/);
+});
+
+test("macOS onboarding shows the Screen Context relaunch guidance when needed", async (t) => {
+ const vite = await createOnboardingRenderer(t, "darwin");
+ const { default: CompactPermissionsStep } = await vite.ssrLoadModule(
+ "/components/onboarding/CompactPermissionsStep.tsx"
+ );
+
+ const markup = renderToStaticMarkup(
+ React.createElement(CompactPermissionsStep, {
+ permissions: permissions(),
+ systemAudio,
+ screenContext: {
+ ...screenContext,
+ enabled: true,
+ granted: true,
+ needsRelaunch: true,
+ },
+ onContinue: noop,
+ })
+ );
+
+ assert.match(markup, /dictationAgent\.screenContext\.relaunchHint/);
+ assert.match(markup, />onboarding\.rehaul\.permissions\.enabled<\/button>/);
+});
+
+test("macOS onboarding omits Screen Context when the flow does not offer it", async (t) => {
+ const vite = await createOnboardingRenderer(t, "darwin");
+ const { default: CompactPermissionsStep } = await vite.ssrLoadModule(
+ "/components/onboarding/CompactPermissionsStep.tsx"
+ );
+
+ const markup = renderToStaticMarkup(
+ React.createElement(CompactPermissionsStep, {
+ permissions: permissions(),
+ systemAudio,
+ onContinue: noop,
+ })
+ );
+
+ assert.doesNotMatch(markup, /dictationAgent\.screenContext\.title/);
+});
+
+test("Windows onboarding offers Screen Context as a permissionless opt-in", async (t) => {
+ const vite = await createOnboardingRenderer(t, "win32");
+ const { default: CompactPermissionsStep } = await vite.ssrLoadModule(
+ "/components/onboarding/CompactPermissionsStep.tsx"
+ );
+
+ const markup = renderToStaticMarkup(
+ React.createElement(CompactPermissionsStep, {
+ permissions: permissions(),
+ systemAudio,
+ screenContext: {
+ ...screenContext,
+ enabled: true,
+ granted: true,
+ },
+ onContinue: noop,
+ })
+ );
+
+ assert.match(markup, /dictationAgent\.screenContext\.title/);
+ assert.match(markup, /screen-context\.webp/);
+ assert.match(markup, />onboarding\.rehaul\.permissions\.enabled<\/button>/);
+ assert.doesNotMatch(markup, /dictationAgent\.screenContext\.relaunchHint/);
+});
+
+test("Linux onboarding does not show Screen Context", async (t) => {
+ const vite = await createOnboardingRenderer(t);
+ const { default: CompactPermissionsStep } = await vite.ssrLoadModule(
+ "/components/onboarding/CompactPermissionsStep.tsx"
+ );
+
+ const markup = renderToStaticMarkup(
+ React.createElement(CompactPermissionsStep, {
+ permissions: permissions(),
+ systemAudio,
+ screenContext,
+ onContinue: noop,
+ })
+ );
+
+ assert.doesNotMatch(markup, /dictationAgent\.screenContext\.title/);
+});