Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(calls): share a screen or window from the macOS app (#9208)

Eric Hayes45b93b0d07f5
diff --git a/apps/web/native-commands.json b/apps/web/native-commands.json
index bed3bec453..528da430ba 100644
--- a/apps/web/native-commands.json
+++ b/apps/web/native-commands.json
@@ -1,6 +1,7 @@
{
"commands": [
"ack_bundle_update_reload",
+ "allow_screen_capture",
"check_for_update",
"clear_shared_files",
"close_linux_notification",
@@ -36,6 +37,7 @@
"graphql_cache_watch",
"graphql_cache_write",
"is_ipad",
+ "list_screen_capture_sources",
"macrod_detect_agents",
"macrod_inspect",
"macrod_start",
@@ -108,6 +110,7 @@
"read_shared_file_text",
"record_frontend_diagnostic",
"request_macos_notification_permission",
+ "request_screen_capture_access",
"restart_native_update",
"send_linux_notification",
"send_macos_notification",
diff --git a/apps/web/src/features/channel/Call/CallContext.tsx b/apps/web/src/features/channel/Call/CallContext.tsx
index 0a6c875117..2324475022 100644
--- a/apps/web/src/features/channel/Call/CallContext.tsx
+++ b/apps/web/src/features/channel/Call/CallContext.tsx
@@ -60,6 +60,7 @@ import {
type NativeCallConnectionState,
useMaybeNativeCallState,
} from './native-call-state';
+import { ScreenShareError } from './screen-share-error';
import {
isNativeCallEnabled,
prepareNativeCallJoin,
@@ -1580,10 +1581,27 @@ function createCallState() {
if (!r) return;
const newSharing = !store.isScreenSharing;
try {
- await r.localParticipant.setScreenShareEnabled(
- newSharing,
- screenShareCaptureOptions(persistedShareScreenAudio())
+ const outcome = await traceCallMedia(
+ 'screen_share',
+ {
+ 'call.id': store.activeCallId ?? undefined,
+ 'call.media.enabled': newSharing,
+ },
+ async (span) => {
+ if (newSharing) {
+ // The picker stays out of the startup bundle CallProvider is in.
+ const { startScreenShare } = await import('./screen-share');
+ return startScreenShare(
+ r,
+ span,
+ screenShareCaptureOptions(persistedShareScreenAudio())
+ );
+ }
+ await r.localParticipant.setScreenShareEnabled(false);
+ return 'shared';
+ }
);
+ if (outcome === 'cancelled') return;
setStore('isScreenSharing', newSharing);
analytics.track('call_action', {
action: 'screen_share_toggled',
@@ -1594,6 +1612,8 @@ function createCallState() {
});
} catch (e) {
console.error('failed to toggle screen share', e);
+ // The controls show it; browser picker failures include cancelling.
+ if (e instanceof ScreenShareError) throw e;
}
}
diff --git a/apps/web/src/features/channel/Call/ScreenSourcePicker.tsx b/apps/web/src/features/channel/Call/ScreenSourcePicker.tsx
new file mode 100644
index 0000000000..420c734ccf
--- /dev/null
+++ b/apps/web/src/features/channel/Call/ScreenSourcePicker.tsx
@@ -0,0 +1,186 @@
+import { t } from '@app/lib/i18n';
+import {
+ ActionDialogShell,
+ Button,
+ Dialog,
+ type ManagedDialogProps,
+ type OpenDialogOptions,
+ openDialog,
+ RadioGroup,
+} from '@ui';
+import { createSignal, For, type JSX, Show } from 'solid-js';
+import type {
+ ScreenCaptureSource,
+ ScreenCaptureSources,
+} from './desktop-screen-capture';
+
+type ScreenSourcePickerProps = ManagedDialogProps & {
+ sources: ScreenCaptureSources;
+ onPick: (source: ScreenCaptureSource) => void;
+};
+
+type SourceRow = {
+ source: ScreenCaptureSource;
+ label: string;
+ detail?: string;
+};
+
+function screenRows(sources: ScreenCaptureSource[]): SourceRow[] {
+ let external = 0;
+ return sources
+ .filter((source) => source.kind === 'screen')
+ .map((source) => {
+ if (source.builtin) {
+ return { source, label: t('calls.builtInDisplay') };
+ }
+ external += 1;
+ return { source, label: t('calls.display', { number: external }) };
+ });
+}
+
+function windowRows(sources: ScreenCaptureSource[]): SourceRow[] {
+ return sources
+ .filter((source) => source.kind === 'window')
+ .map((source) => ({
+ source,
+ label: source.name ?? source.appName ?? '',
+ detail: source.name ? (source.appName ?? undefined) : undefined,
+ }));
+}
+
+function SourceSection(props: { title: string; children: JSX.Element }) {
+ return (
+ <div role="group" aria-label={props.title} class="flex flex-col gap-1">
+ <div class="text-xs font-medium text-ink-muted">{props.title}</div>
+ {props.children}
+ </div>
+ );
+}
+
+function SourceItem(props: { row: SourceRow }) {
+ return (
+ <RadioGroup.Item
+ value={props.row.source.id}
+ class="min-w-0 rounded-lg px-2 py-1.5 not-touch:hover:bg-hover touch:min-h-[44px]"
+ >
+ <RadioGroup.ItemControl />
+ <div class="flex min-w-0 flex-col">
+ <RadioGroup.ItemLabel class="truncate text-sm text-ink">
+ {props.row.label}
+ </RadioGroup.ItemLabel>
+ <Show when={props.row.detail}>
+ {(detail) => (
+ <RadioGroup.ItemDescription class="truncate text-xs text-ink-muted">
+ {detail()}
+ </RadioGroup.ItemDescription>
+ )}
+ </Show>
+ </div>
+ </RadioGroup.Item>
+ );
+}
+
+function ScreenSourcePicker(props: ScreenSourcePickerProps) {
+ const screens = () => screenRows(props.sources.sources);
+ const windows = () => windowRows(props.sources.sources);
+ const [selected, setSelected] = createSignal(
+ props.sources.sources[0]?.id ?? ''
+ );
+
+ const share = (event: Event) => {
+ event.preventDefault();
+ const source = props.sources.sources.find((s) => s.id === selected());
+ if (source) props.onPick(source);
+ };
+
+ return (
+ <Dialog
+ open={props.open}
+ onOpenChange={props.onOpenChange}
+ class="w-[90%] max-w-110"
+ visibleScrim
+ >
+ <form onSubmit={share}>
+ <ActionDialogShell>
+ <ActionDialogShell.Body class="space-y-4">
+ <ActionDialogShell.Header>
+ <ActionDialogShell.Title>
+ {t('calls.shareScreenTitle')}
+ </ActionDialogShell.Title>
+ <ActionDialogShell.Description>
+ {t('calls.shareScreenDescription')}
+ </ActionDialogShell.Description>
+ </ActionDialogShell.Header>
+ <Show when={!props.sources.hasAccess}>
+ <p role="alert" class="text-sm text-ink-muted">
+ {t('calls.screenAccessNeeded')}
+ </p>
+ </Show>
+ <RadioGroup
+ value={selected()}
+ onChange={setSelected}
+ aria-label={t('calls.shareScreenTitle')}
+ class="gap-4"
+ >
+ <SourceSection title={t('calls.screens')}>
+ <For each={screens()}>{(row) => <SourceItem row={row} />}</For>
+ </SourceSection>
+ <SourceSection title={t('calls.windows')}>
+ <For
+ each={windows()}
+ fallback={
+ <p class="px-2 text-sm text-ink-muted">
+ {t('calls.noWindows')}
+ </p>
+ }
+ >
+ {(row) => <SourceItem row={row} />}
+ </For>
+ </SourceSection>
+ </RadioGroup>
+ </ActionDialogShell.Body>
+ <ActionDialogShell.Footer>
+ <Button
+ type="button"
+ variant="ghost"
+ onClick={() => props.onOpenChange(false)}
+ >
+ {t('common.cancel')}
+ </Button>
+ <Button type="submit" variant="primary" disabled={!selected()}>
+ {t('calls.share')}
+ </Button>
+ </ActionDialogShell.Footer>
+ </ActionDialogShell>
+ </form>
+ </Dialog>
+ );
+}
+
+/**
+ * Asks which screen or window to share. Resolves with the chosen source, or
+ * `undefined` when dismissed.
+ */
+export async function pickScreenSource(
+ sources: ScreenCaptureSources,
+ options?: OpenDialogOptions
+): Promise<ScreenCaptureSource | undefined> {
+ let picked: ScreenCaptureSource | undefined;
+
+ const handle = openDialog(
+ (managed: ManagedDialogProps & { sources: ScreenCaptureSources }) => (
+ <ScreenSourcePicker
+ {...managed}
+ onPick={(source) => {
+ picked = source;
+ managed.onOpenChange(false);
+ }}
+ />
+ ),
+ { sources },
+ options
+ );
+
+ await handle.closed;
+ return picked;
+}
diff --git a/apps/web/src/features/channel/Call/desktop-screen-capture.ts b/apps/web/src/features/channel/Call/desktop-screen-capture.ts
new file mode 100644
index 0000000000..50e4bacb28
--- /dev/null
+++ b/apps/web/src/features/channel/Call/desktop-screen-capture.ts
@@ -0,0 +1,87 @@
+/**
+ * Screen capture in the macOS desktop app.
+ *
+ * Chromium runs there without a screen picker and refuses
+ * `getDisplayMedia()`. The app lists sources natively, shows its own picker,
+ * arms a one-shot native grant, and opens the chosen source with Chromium's
+ * desktop `getUserMedia()` constraints.
+ */
+import { isTauri } from '@core/util/platform';
+import { invoke } from '@tauri-apps/api/core';
+import { errAsync, ResultAsync } from 'neverthrow';
+
+export type ScreenCaptureSource = {
+ /** Chromium's desktop media id, e.g. `screen:1:0` or `window:42:0`. */
+ id: string;
+ kind: 'screen' | 'window';
+ /** The window title, when macOS exposes it. */
+ name: string | null;
+ appName: string | null;
+ builtin: boolean;
+};
+
+export type ScreenCaptureSources = {
+ /** Whether macOS Screen Recording access is granted. */
+ hasAccess: boolean;
+ sources: ScreenCaptureSource[];
+};
+
+export type ListScreenCaptureSourcesError =
+ | { kind: 'unsupported' }
+ | { kind: 'native'; error: unknown };
+
+const LIST_COMMAND = 'list_screen_capture_sources';
+
+/**
+ * Lists the screens and windows the user can share. `unsupported` outside the
+ * macOS app, and on native builds from before the picker shipped.
+ */
+export function listScreenCaptureSources(): ResultAsync<
+ ScreenCaptureSources,
+ ListScreenCaptureSourcesError
+> {
+ if (!isTauri()) return errAsync({ kind: 'unsupported' });
+ return ResultAsync.fromPromise(
+ invoke<ScreenCaptureSources>(LIST_COMMAND),
+ (error): ListScreenCaptureSourcesError =>
+ error === `Command ${LIST_COMMAND} not found`
+ ? { kind: 'unsupported' }
+ : { kind: 'native', error }
+ );
+}
+
+/** Shows the macOS Screen Recording prompt the first time it is asked. */
+export function requestScreenCaptureAccess(): Promise<boolean> {
+ return invoke<boolean>('request_screen_capture_access');
+}
+
+/**
+ * Chromium's desktop capture constraints, which the DOM types don't describe:
+ * `mandatory` predates the standard constraint syntax.
+ */
+function desktopCaptureConstraints(sourceId: string): MediaStreamConstraints {
+ const constraints = {
+ audio: false,
+ video: {
+ mandatory: {
+ chromeMediaSource: 'desktop',
+ chromeMediaSourceId: sourceId,
+ maxFrameRate: 30,
+ },
+ },
+ };
+ return constraints as unknown as MediaStreamConstraints;
+}
+
+/** Opens a video track of the source the user picked. */
+export async function captureScreenSource(
+ sourceId: string
+): Promise<MediaStreamTrack> {
+ await invoke('allow_screen_capture');
+ const stream = await navigator.mediaDevices.getUserMedia(
+ desktopCaptureConstraints(sourceId)
+ );
+ const [track] = stream.getVideoTracks();
+ if (!track) throw new Error('Screen capture returned no video track');
+ return track;
+}
diff --git a/apps/web/src/features/channel/Call/screen-share-error.ts b/apps/web/src/features/channel/Call/screen-share-error.ts
new file mode 100644
index 0000000000..b99981377f
--- /dev/null
+++ b/apps/web/src/features/channel/Call/screen-share-error.ts
@@ -0,0 +1,7 @@
+/**
+ * A screen share failure with a message meant for the user. Failures of the
+ * browser's own picker are not: a cancelled picker rejects like a denial.
+ */
+export class ScreenShareError extends Error {
+ override name = 'ScreenShareError';
+}
diff --git a/apps/web/src/features/channel/Call/screen-share.ts b/apps/web/src/features/channel/Call/screen-share.ts
new file mode 100644
index 0000000000..44c442482a
--- /dev/null
+++ b/apps/web/src/features/channel/Call/screen-share.ts
@@ -0,0 +1,79 @@
+import { t } from '@app/lib/i18n';
+import type { Span } from '@macro-inc/observability';
+import type { Room, ScreenShareCaptureOptions } from 'livekit-client';
+import { callMediaErrorType } from './call-media-telemetry';
+import {
+ captureScreenSource,
+ listScreenCaptureSources,
+ requestScreenCaptureAccess,
+} from './desktop-screen-capture';
+import { LK_TRACK_SOURCE } from './livekit-loader';
+import { pickScreenSource } from './ScreenSourcePicker';
+import { ScreenShareError } from './screen-share-error';
+
+export type ScreenShareStart = 'shared' | 'cancelled';
+
+/** Keeps the cause's type on the span, which records only the wrapper. */
+function shareFailed(span: Span, message: string, cause: unknown) {
+ span.setAttr('call.media.screen_share.error_type', callMediaErrorType(cause));
+ return new ScreenShareError(message, { cause });
+}
+
+/**
+ * Starts sharing a screen. The macOS desktop app picks the source in Macro's
+ * own picker; everywhere else the browser shows its own. Resolves
+ * `cancelled` when the user dismisses Macro's picker.
+ */
+export async function startScreenShare(
+ room: Room,
+ span: Span,
+ browserOptions?: ScreenShareCaptureOptions
+): Promise<ScreenShareStart> {
+ const listed = await listScreenCaptureSources();
+ if (listed.isErr()) {
+ if (listed.error.kind === 'native') {
+ throw shareFailed(span, t('calls.shareFailed'), listed.error.error);
+ }
+ span.setAttr('call.media.screen_share.picker', 'browser');
+ await room.localParticipant.setScreenShareEnabled(true, browserOptions);
+ return 'shared';
+ }
+
+ span.setAttr('call.media.screen_share.picker', 'native');
+ span.setAttr('call.media.screen_share.has_access', listed.value.hasAccess);
+ span.setAttr(
+ 'call.media.screen_share.source_count',
+ listed.value.sources.length
+ );
+ // The macOS prompt comes up beside the picker; capture still works once the
+ // user allows it and reopens the app.
+ if (!listed.value.hasAccess) await requestScreenCaptureAccess();
+
+ const source = await pickScreenSource(listed.value);
+ if (!source) {
+ span.setAttr('call.media.screen_share.cancelled', true);
+ return 'cancelled';
+ }
+ span.setAttr('call.media.screen_share.source_kind', source.kind);
+
+ let track: MediaStreamTrack;
+ try {
+ track = await captureScreenSource(source.id);
+ } catch (error) {
+ // macOS refuses capture until Screen Recording is allowed.
+ const message =
+ callMediaErrorType(error) === 'NotAllowedError'
+ ? t('calls.screenAccessNeeded')
+ : t('calls.shareFailed');
+ throw shareFailed(span, message, error);
+ }
+ try {
+ await room.localParticipant.publishTrack(track, {
+ source: LK_TRACK_SOURCE.ScreenShare,
+ });
+ } catch (error) {
+ track.stop();
+ throw shareFailed(span, t('calls.shareFailed'), error);
+ }
+ return 'shared';
+}
diff --git a/apps/web/src/features/channel/Call/tests/screen-share.test.ts b/apps/web/src/features/channel/Call/tests/screen-share.test.ts
new file mode 100644
index 0000000000..6983c74492
--- /dev/null
+++ b/apps/web/src/features/channel/Call/tests/screen-share.test.ts
@@ -0,0 +1,118 @@
+import type { Span } from '@macro-inc/observability';
+import type { Room } from 'livekit-client';
+import { errAsync, okAsync } from 'neverthrow';
+import { beforeEach, describe, expect, it, vi } from 'vitest';
+import type { ScreenCaptureSources } from '../desktop-screen-capture';
+import { ScreenShareError } from '../screen-share-error';
+
+const native = vi.hoisted(() => ({
+ list: vi.fn(),
+ request: vi.fn(async () => false),
+ capture: vi.fn(),
+ pick: vi.fn(),
+}));
+
+vi.mock('../desktop-screen-capture', () => ({
+ listScreenCaptureSources: native.list,
+ requestScreenCaptureAccess: native.request,
+ captureScreenSource: native.capture,
+}));
+vi.mock('../ScreenSourcePicker', () => ({ pickScreenSource: native.pick }));
+
+const { startScreenShare } = await import('../screen-share');
+
+const SOURCES: ScreenCaptureSources = {
+ hasAccess: true,
+ sources: [
+ {
+ id: 'screen:1:0',
+ kind: 'screen',
+ name: null,
+ appName: null,
+ builtin: true,
+ },
+ ],
+};
+
+function fakeRoom() {
+ const localParticipant = {
+ setScreenShareEnabled: vi.fn(async () => undefined),
+ publishTrack: vi.fn(async () => undefined),
+ };
+ return { room: { localParticipant } as unknown as Room, localParticipant };
+}
+
+const span = { setAttr: vi.fn() } as unknown as Span;
+
+function fakeTrack() {
+ return { stop: vi.fn() } as unknown as MediaStreamTrack;
+}
+
+beforeEach(() => vi.clearAllMocks());
+
+describe('startScreenShare', () => {
+ it('uses the browser picker where the native one is missing', async () => {
+ native.list.mockReturnValue(errAsync({ kind: 'unsupported' }));
+ const { room, localParticipant } = fakeRoom();
+
+ const options = { audio: false };
+
+ await expect(startScreenShare(room, span, options)).resolves.toBe('shared');
+ expect(localParticipant.setScreenShareEnabled).toHaveBeenCalledWith(
+ true,
+ options
+ );
+ expect(native.pick).not.toHaveBeenCalled();
+ });
+
+ it('publishes the picked source as the screen share', async () => {
+ native.list.mockReturnValue(okAsync(SOURCES));
+ native.pick.mockResolvedValue(SOURCES.sources[0]);
+ const track = fakeTrack();
+ native.capture.mockResolvedValue(track);
+ const { room, localParticipant } = fakeRoom();
+
+ await expect(startScreenShare(room, span)).resolves.toBe('shared');
+ expect(native.capture).toHaveBeenCalledWith('screen:1:0');
+ expect(localParticipant.publishTrack).toHaveBeenCalledWith(track, {
+ source: 'screen_share',
+ });
+ });
+
+ it('opens nothing when the picker is dismissed', async () => {
+ native.list.mockReturnValue(okAsync(SOURCES));
+ native.pick.mockResolvedValue(undefined);
+ const { room, localParticipant } = fakeRoom();
+
+ await expect(startScreenShare(room, span)).resolves.toBe('cancelled');
+ expect(native.capture).not.toHaveBeenCalled();
+ expect(localParticipant.publishTrack).not.toHaveBeenCalled();
+ });
+
+ it('asks for Screen Recording access when macOS refuses capture', async () => {
+ native.list.mockReturnValue(okAsync(SOURCES));
+ native.pick.mockResolvedValue(SOURCES.sources[0]);
+ native.capture.mockRejectedValue(
+ new DOMException('Permission denied', 'NotAllowedError')
+ );
+ const { room } = fakeRoom();
+
+ const started = startScreenShare(room, span);
+ await expect(started).rejects.toBeInstanceOf(ScreenShareError);
+ await expect(started).rejects.toThrow('Screen Recording');
+ });
+
+ it('stops the captured track when publishing fails', async () => {
+ native.list.mockReturnValue(okAsync(SOURCES));
+ native.pick.mockResolvedValue(SOURCES.sources[0]);
+ const track = fakeTrack();
+ native.capture.mockResolvedValue(track);
+ const { room, localParticipant } = fakeRoom();
+ localParticipant.publishTrack.mockRejectedValue(new Error('closed'));
+
+ await expect(startScreenShare(room, span)).rejects.toThrow(
+ "Couldn't share your screen"
+ );
+ expect(track.stop).toHaveBeenCalled();
+ });
+});
diff --git a/apps/web/src/features/channel/Call/tests/screen-source-picker.test.tsx b/apps/web/src/features/channel/Call/tests/screen-source-picker.test.tsx
new file mode 100644
index 0000000000..4301a9382e
--- /dev/null
+++ b/apps/web/src/features/channel/Call/tests/screen-source-picker.test.tsx
@@ -0,0 +1,99 @@
+/** @vitest-environment jsdom */
+import { ImperativeDialogHost } from '@app/components/ui/components/ImperativeDialog';
+import {
+ cleanup,
+ fireEvent,
+ render,
+ screen,
+ waitFor,
+} from '@solidjs/testing-library';
+import type { ComponentProps } from 'solid-js';
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+import type { ScreenCaptureSources } from '../desktop-screen-capture';
+import { pickScreenSource } from '../ScreenSourcePicker';
+
+vi.mock('@core/mobile/isMobile', () => ({ isMobile: () => false }));
+vi.mock('@ui', async () => ({
+ ...(await import('@app/components/ui/components/ImperativeDialog')),
+ ...(await import('@app/components/ui/components/Dialog')),
+ ...(await import('@app/components/ui/components/ActionDialogShell')),
+ ...(await import('@app/components/ui/components/RadioGroup')),
+ Button: (props: ComponentProps<'button'>) => (
+ <button type={props.type} disabled={props.disabled} onClick={props.onClick}>
+ {props.children}
+ </button>
+ ),
+}));
+beforeEach(() => vi.stubGlobal('scrollTo', vi.fn()));
+afterEach(() => {
+ cleanup();
+ vi.unstubAllGlobals();
+});
+
+const SOURCES: ScreenCaptureSources = {
+ hasAccess: true,
+ sources: [
+ {
+ id: 'screen:1:0',
+ kind: 'screen',
+ name: null,
+ appName: null,
+ builtin: true,
+ },
+ {
+ id: 'screen:2:0',
+ kind: 'screen',
+ name: null,
+ appName: null,
+ builtin: false,
+ },
+ {
+ id: 'window:42:0',
+ kind: 'window',
+ name: 'Quarterly plan',
+ appName: 'Keynote',
+ builtin: false,
+ },
+ ],
+};
+
+function share() {
+ fireEvent.click(screen.getByRole('button', { name: 'Share' }));
+}
+
+describe('screen source picker', () => {
+ it('shares the main screen unless the user picks another source', async () => {
+ render(() => <ImperativeDialogHost />);
+ const picked = pickScreenSource(SOURCES);
+
+ expect(
+ (screen.getByLabelText('Built-in display') as HTMLInputElement).checked
+ ).toBe(true);
+ screen.getByLabelText('Display 1');
+ fireEvent.click(screen.getByLabelText('Quarterly plan'));
+ share();
+
+ await expect(picked).resolves.toMatchObject({ id: 'window:42:0' });
+ });
+
+ it('resolves with nothing when cancelled', async () => {
+ render(() => <ImperativeDialogHost />);
+ const picked = pickScreenSource(SOURCES);
+
+ fireEvent.click(screen.getByRole('button', { name: 'Cancel' }));
+
+ await expect(picked).resolves.toBeUndefined();
+ await waitFor(() =>
+ expect(screen.queryByText('Share your screen')).toBeNull()
+ );
+ });
+
+ it('explains missing Screen Recording access', async () => {
+ render(() => <ImperativeDialogHost />);
+ const picked = pickScreenSource({ ...SOURCES, hasAccess: false });
+
+ expect(screen.getByRole('alert').textContent).toContain('Screen Recording');
+ fireEvent.click(screen.getByRole('button', { name: 'Cancel' }));
+ await expect(picked).resolves.toBeUndefined();
+ });
+});
diff --git a/apps/web/src/lib/i18n/locales/en.ts b/apps/web/src/lib/i18n/locales/en.ts
index 14dd13d1b8..008f5c1dba 100644
--- a/apps/web/src/lib/i18n/locales/en.ts
+++ b/apps/web/src/lib/i18n/locales/en.ts
@@ -1,3 +1,4 @@
+import calls from './en/calls';
import channelLabels from './en/channel-labels';
import channelSections from './en/channel-sections';
import commandMenu from './en/command-menu';
@@ -19,6 +20,7 @@ import viewMenus from './en/view-menus';
* `./en`; translations in `./<language>.ts` mirror these keys.
*/
export default {
+ calls,
channelLabels,
channelSections,
commandMenu,
diff --git a/apps/web/src/lib/i18n/locales/en/calls.ts b/apps/web/src/lib/i18n/locales/en/calls.ts
new file mode 100644
index 0000000000..0801181fb2
--- /dev/null
+++ b/apps/web/src/lib/i18n/locales/en/calls.ts
@@ -0,0 +1,13 @@
+export default {
+ shareScreenTitle: 'Share your screen',
+ shareScreenDescription: 'Choose a screen or window to share with the call.',
+ screens: 'Screens',
+ windows: 'Windows',
+ builtInDisplay: 'Built-in display',
+ display: 'Display {{number}}',
+ noWindows: 'No other windows are open.',
+ screenAccessNeeded:
+ 'Macro needs Screen Recording access. Turn on Macro in System Settings › Privacy & Security › Screen & System Audio Recording, then reopen Macro.',
+ share: 'Share',
+ shareFailed: "Couldn't share your screen. Try again.",
+};
diff --git a/apps/web/tauri/Cargo.lock b/apps/web/tauri/Cargo.lock
index a536dd2a29..9a7247b352 100644
--- a/apps/web/tauri/Cargo.lock
+++ b/apps/web/tauri/Cargo.lock
@@ -277,6 +277,8 @@ dependencies = [
"nom 8.0.0",
"objc2 0.5.2",
"objc2 0.6.4",
+ "objc2-core-foundation",
+ "objc2-core-graphics",
"objc2-foundation 0.3.2",
"objc2-intents",
"objc2-ui-kit",
@@ -4880,6 +4882,7 @@ checksum = "e022c9d066895efa1345f8e33e584b9f958da2fd4cd116792e15e07e4720a807"
dependencies = [
"bitflags 2.11.1",
"dispatch2",
+ "libc",
"objc2 0.6.4",
"objc2-core-foundation",
"objc2-io-surface",
diff --git a/apps/web/tauri/desktop-cef/AGENTS.md b/apps/web/tauri/desktop-cef/AGENTS.md
index 1a51bdf1ed..a5dd9bfc77 100644
--- a/apps/web/tauri/desktop-cef/AGENTS.md
+++ b/apps/web/tauri/desktop-cef/AGENTS.md
@@ -73,6 +73,11 @@ thin binary over `../src-tauri` (`app_lib::run_with`) that selects
- Keep the HTTP/WebSocket fork revision and Nix source hash aligned with the
shared native workspace; native cookies use Application Support as documented
in `../src-tauri/README.md#native-authentication-cookies`.
+- The app hosts Chromium in Alloy style, which has no screen picker and refuses
+ `getDisplayMedia()`. Screen sharing goes through Macro's picker and
+ `../src-tauri/src/screen_capture.rs`: `main.rs` registers
+ `on_desktop_capture_request` (a hook of the `macro-cef` fork), which grants a
+ desktop capture only right after the user picks a source.
- Keep `tauri.conf.json` aligned with `../src-tauri/tauri.conf.json` and
`tauri.macos.conf.json`: the CLI bundles from this file, while the app's
runtime config still comes from `../src-tauri`.
diff --git a/apps/web/tauri/desktop-cef/Cargo.lock b/apps/web/tauri/desktop-cef/Cargo.lock
index 21d4360987..84fedfb7e4 100644
--- a/apps/web/tauri/desktop-cef/Cargo.lock
+++ b/apps/web/tauri/desktop-cef/Cargo.lock
@@ -285,6 +285,8 @@ dependencies = [
"nom 8.0.0",
"objc2 0.5.3",
"objc2 0.6.5",
+ "objc2-core-foundation",
+ "objc2-core-graphics",
"objc2-foundation 0.3.2",
"objc2-intents",
"objc2-ui-kit",
@@ -8085,7 +8087,7 @@ checksum = "adb6935a6f5c20170eeceb1a3835a49e12e19d792f6dd344ccc76a985ca5a6ca"
[[package]]
name = "tauri"
version = "2.11.5"
-source = "git+https://github.com/macro-inc/tauri?rev=285fb6b1#285fb6b1cb2fc20666da1688f4c74e240a100035"
+source = "git+https://github.com/macro-inc/tauri?rev=4b8a46f1#4b8a46f15c0a54a5c06a1486cd5432d444c17bd8"
dependencies = [
"anyhow",
"bytes",
@@ -8133,7 +8135,7 @@ dependencies = [
[[package]]
name = "tauri-build"
version = "2.6.3"
-source = "git+https://github.com/macro-inc/tauri?rev=285fb6b1#285fb6b1cb2fc20666da1688f4c74e240a100035"
+source = "git+https://github.com/macro-inc/tauri?rev=4b8a46f1#4b8a46f15c0a54a5c06a1486cd5432d444c17bd8"
dependencies = [
"anyhow",
"cargo_toml",
@@ -8153,7 +8155,7 @@ dependencies = [
[[package]]
name = "tauri-codegen"
version = "2.6.3"
-source = "git+https://github.com/macro-inc/tauri?rev=285fb6b1#285fb6b1cb2fc20666da1688f4c74e240a100035"
+source = "git+https://github.com/macro-inc/tauri?rev=4b8a46f1#4b8a46f15c0a54a5c06a1486cd5432d444c17bd8"
dependencies = [
"base64 0.22.1",
"brotli",
@@ -8179,7 +8181,7 @@ dependencies = [
[[package]]
name = "tauri-macros"
version = "2.6.3"
-source = "git+https://github.com/macro-inc/tauri?rev=285fb6b1#285fb6b1cb2fc20666da1688f4c74e240a100035"
+source = "git+https://github.com/macro-inc/tauri?rev=4b8a46f1#4b8a46f15c0a54a5c06a1486cd5432d444c17bd8"
dependencies = [
"heck 0.5.0",
"proc-macro2",
@@ -8597,7 +8599,7 @@ dependencies = [
[[package]]
name = "tauri-runtime"
version = "2.11.3"
-source = "git+https://github.com/macro-inc/tauri?rev=285fb6b1#285fb6b1cb2fc20666da1688f4c74e240a100035"
+source = "git+https://github.com/macro-inc/tauri?rev=4b8a46f1#4b8a46f15c0a54a5c06a1486cd5432d444c17bd8"
dependencies = [
"cookie",
"dpi",
@@ -8617,7 +8619,7 @@ dependencies = [
[[package]]
name = "tauri-runtime-cef"
version = "0.1.0"
-source = "git+https://github.com/macro-inc/tauri?rev=285fb6b1#285fb6b1cb2fc20666da1688f4c74e240a100035"
+source = "git+https://github.com/macro-inc/tauri?rev=4b8a46f1#4b8a46f15c0a54a5c06a1486cd5432d444c17bd8"
dependencies = [
"base64 0.22.1",
"cef",
@@ -8654,7 +8656,7 @@ dependencies = [
[[package]]
name = "tauri-utils"
version = "2.9.3"
-source = "git+https://github.com/macro-inc/tauri?rev=285fb6b1#285fb6b1cb2fc20666da1688f4c74e240a100035"
+source = "git+https://github.com/macro-inc/tauri?rev=4b8a46f1#4b8a46f15c0a54a5c06a1486cd5432d444c17bd8"
dependencies = [
"anyhow",
"brotli",
diff --git a/apps/web/tauri/desktop-cef/Cargo.toml b/apps/web/tauri/desktop-cef/Cargo.toml
index b698d94dfe..336588bcb4 100644
--- a/apps/web/tauri/desktop-cef/Cargo.toml
+++ b/apps/web/tauri/desktop-cef/Cargo.toml
@@ -22,16 +22,16 @@ app = { path = "../src-tauri", features = ["cef"] }
tauri = { version = "2.11", features = ["devtools", "protocol-asset"] }
[target.'cfg(target_os = "macos")'.dependencies]
-tauri-runtime-cef = { git = "https://github.com/macro-inc/tauri", rev = "285fb6b1", features = ["devtools"] }
+tauri-runtime-cef = { git = "https://github.com/macro-inc/tauri", rev = "4b8a46f1", features = ["devtools"] }
[patch.crates-io]
# Tauri's feat/cef branch plus the macro fork patches (macro-inc/tauri macro-cef).
-tauri = { git = "https://github.com/macro-inc/tauri", rev = "285fb6b1" }
-tauri-build = { git = "https://github.com/macro-inc/tauri", rev = "285fb6b1" }
-tauri-codegen = { git = "https://github.com/macro-inc/tauri", rev = "285fb6b1" }
-tauri-macros = { git = "https://github.com/macro-inc/tauri", rev = "285fb6b1" }
-tauri-runtime = { git = "https://github.com/macro-inc/tauri", rev = "285fb6b1" }
-tauri-utils = { git = "https://github.com/macro-inc/tauri", rev = "285fb6b1" }
+tauri = { git = "https://github.com/macro-inc/tauri", rev = "4b8a46f1" }
+tauri-build = { git = "https://github.com/macro-inc/tauri", rev = "4b8a46f1" }
+tauri-codegen = { git = "https://github.com/macro-inc/tauri", rev = "4b8a46f1" }
+tauri-macros = { git = "https://github.com/macro-inc/tauri", rev = "4b8a46f1" }
+tauri-runtime = { git = "https://github.com/macro-inc/tauri", rev = "4b8a46f1" }
+tauri-utils = { git = "https://github.com/macro-inc/tauri", rev = "4b8a46f1" }
# The CEF runtime builds on winit-gtk4, whose `dpi` must be the one Tauri uses.
dpi = { git = "https://github.com/tauri-apps/winit-gtk4", rev = "3d7c7cd19d3c752f75762ceea535444e63bdf8de" }
diff --git a/apps/web/tauri/desktop-cef/src/main.rs b/apps/web/tauri/desktop-cef/src/main.rs
index db5ed9b4a4..fa5daa3199 100644
--- a/apps/web/tauri/desktop-cef/src/main.rs
+++ b/apps/web/tauri/desktop-cef/src/main.rs
@@ -9,9 +9,23 @@ fn main() {
// asks for keychain access on launch. Sign-in lives in the native HTTP
// cookie jar, not Chromium's, so the mock keychain protects nothing less.
#[cfg(target_os = "macos")]
- app_lib::run_with(tauri::Builder::default().runtime(
- tauri_runtime_cef::Cef::default().secret_storage(tauri_runtime_cef::SecretStorage::Mock),
- ));
+ app_lib::run_with(
+ tauri::Builder::default().runtime(
+ tauri_runtime_cef::Cef::default()
+ .secret_storage(tauri_runtime_cef::SecretStorage::Mock),
+ ),
+ configure_window,
+ );
#[cfg(not(target_os = "macos"))]
compile_error!("desktop-cef is the macOS build; other platforms build ../src-tauri");
}
+
+/// Alloy style has no screen picker, so screen sharing is granted only after
+/// the user picks a source in the app's own picker.
+#[cfg(target_os = "macos")]
+fn configure_window<'a>(
+ window: tauri::WebviewWindowBuilder<'a, app_lib::AppRuntime, tauri::App<app_lib::AppRuntime>>,
+) -> tauri::WebviewWindowBuilder<'a, app_lib::AppRuntime, tauri::App<app_lib::AppRuntime>> {
+ use tauri_runtime_cef::WebviewWindowBuilderCefExt;
+ window.on_desktop_capture_request(app_lib::screen_capture::take_screen_capture_grant)
+}
diff --git a/apps/web/tauri/src-tauri/Cargo.toml b/apps/web/tauri/src-tauri/Cargo.toml
index 8b052c1cc5..59040e50b8 100644
--- a/apps/web/tauri/src-tauri/Cargo.toml
+++ b/apps/web/tauri/src-tauri/Cargo.toml
@@ -104,12 +104,28 @@ zbus = "5"
block2 = "0.6"
libc = "0.2"
objc2 = "0.6"
+objc2-core-foundation = { version = "0.3", default-features = false, features = [
+ "std",
+ "CFString",
+] }
+objc2-core-graphics = { version = "0.3", default-features = false, features = [
+ "std",
+ "libc",
+ "CGDirectDisplay",
+ "CGDisplayConfiguration",
+ "CGError",
+ "CGWindow",
+] }
objc2-foundation = { version = "0.3", default-features = false, features = [
"std",
+ "NSArray",
"NSBundle",
"NSData",
+ "NSDictionary",
+ "NSEnumerator",
"NSError",
"NSString",
+ "NSValue",
] }
objc2-intents = { version = "0.3", default-features = false, features = [
"std",
diff --git a/apps/web/tauri/src-tauri/src/lib.rs b/apps/web/tauri/src-tauri/src/lib.rs
index 1cc28fc691..cc24e2ba3f 100644
--- a/apps/web/tauri/src-tauri/src/lib.rs
+++ b/apps/web/tauri/src-tauri/src/lib.rs
@@ -43,6 +43,8 @@ mod linux_notification;
mod logging;
#[cfg(target_os = "macos")]
mod macos_notification_permission;
+#[cfg(feature = "cef")]
+pub mod screen_capture;
mod share_target;
mod staged_upload;
mod whatsapp_passkey;
@@ -131,7 +133,14 @@ type Type = std::sync::OnceLock<
#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
- run_with(tauri::Builder::default());
+ run_with(tauri::Builder::default(), configured_window);
+}
+
+/// The startup window as configured, for runtimes without extra window options.
+fn configured_window<'a>(
+ window: tauri::WebviewWindowBuilder<'a, AppRuntime, tauri::App<AppRuntime>>,
+) -> tauri::WebviewWindowBuilder<'a, AppRuntime, tauri::App<AppRuntime>> {
+ window
}
/// The runtime type behind the default `tauri::Builder`: wry everywhere, except
@@ -141,11 +150,21 @@ pub type AppRuntime = tauri::Wry;
#[cfg(feature = "cef")]
pub type AppRuntime = tauri::DynRuntime;
+/// Applies runtime-specific options to each startup window before it is built.
+pub type ConfigureWindow =
+ for<'a> fn(
+ tauri::WebviewWindowBuilder<'a, AppRuntime, tauri::App<AppRuntime>>,
+ ) -> tauri::WebviewWindowBuilder<'a, AppRuntime, tauri::App<AppRuntime>>;
+
/// Runs the app on a builder whose webview runtime is already selected.
-/// `desktop-cef` passes a Chromium builder; every other build calls [`run`].
-pub fn run_with(builder: tauri::Builder<AppRuntime>) {
+/// `desktop-cef` passes a Chromium builder and its window options; every other
+/// build calls [`run`].
+pub fn run_with(builder: tauri::Builder<AppRuntime>, configure_window: ConfigureWindow) {
use tracing_subscriber::EnvFilter;
+ #[cfg(mobile)]
+ let _ = configure_window;
+
let diagnostics = diagnostics::Diagnostics::from_launch();
let recording = diagnostics.is_recording();
@@ -382,6 +401,12 @@ pub fn run_with(builder: tauri::Builder<AppRuntime>) {
macos_notification_permission::request_macos_notification_permission,
#[cfg(target_os = "macos")]
macos_notification_permission::send_macos_notification,
+ #[cfg(feature = "cef")]
+ screen_capture::list_screen_capture_sources,
+ #[cfg(feature = "cef")]
+ screen_capture::request_screen_capture_access,
+ #[cfg(feature = "cef")]
+ screen_capture::allow_screen_capture,
graphql_cache_plugin::commands::graphql_cache_init,
graphql_cache_plugin::commands::graphql_cache_init_with_schema,
graphql_cache_plugin::commands::graphql_cache_current_revision,
@@ -439,9 +464,9 @@ pub fn run_with(builder: tauri::Builder<AppRuntime>) {
for config in &startup_windows {
let navigation = navigation.clone();
let handle = app.handle().clone();
- tauri::WebviewWindowBuilder::from_config(app, config)?
- .on_new_window(move |url, _features| navigation.on_new_window(&handle, &url))
- .build()?;
+ let window = tauri::WebviewWindowBuilder::from_config(app, config)?
+ .on_new_window(move |url, _features| navigation.on_new_window(&handle, &url));
+ configure_window(window).build()?;
}
#[cfg(desktop)]
desktop_update::setup(app, recording)?;
diff --git a/apps/web/tauri/src-tauri/src/screen_capture.rs b/apps/web/tauri/src-tauri/src/screen_capture.rs
new file mode 100644
index 0000000000..0a803d558e
--- /dev/null
+++ b/apps/web/tauri/src-tauri/src/screen_capture.rs
@@ -0,0 +1,190 @@
+//! Screen sharing for the macOS Chromium build.
+//!
+//! CEF hosts the app as an Alloy style browser, which has no desktop media
+//! picker and refuses `getDisplayMedia()`. The frontend shows its own picker
+//! over [`list_screen_capture_sources`], arms a one-shot grant with
+//! [`allow_screen_capture`], and requests the chosen source through
+//! `getUserMedia()` with `chromeMediaSource: 'desktop'`. The runtime's desktop
+//! capture hook calls [`take_screen_capture_grant`], so a page cannot capture
+//! the screen unless the user just picked a source.
+
+use std::sync::Mutex;
+use std::time::{Duration, Instant};
+
+use objc2::rc::Retained;
+use objc2::runtime::AnyObject;
+use objc2_core_foundation::CFString;
+use objc2_core_graphics::{
+ CGDirectDisplayID, CGDisplayIsBuiltin, CGError, CGGetActiveDisplayList, CGMainDisplayID,
+ CGPreflightScreenCaptureAccess, CGRequestScreenCaptureAccess, CGWindowListCopyWindowInfo,
+ CGWindowListOption, kCGNullWindowID, kCGWindowLayer, kCGWindowName, kCGWindowNumber,
+ kCGWindowOwnerName, kCGWindowOwnerPID,
+};
+use objc2_foundation::{NSArray, NSDictionary, NSNumber, NSString};
+use serde::Serialize;
+
+/// How long a pick stays valid while the frontend opens the capture stream.
+const GRANT_TTL: Duration = Duration::from_secs(10);
+
+const MAX_DISPLAYS: u32 = 16;
+
+static GRANT_EXPIRES_AT: Mutex<Option<Instant>> = Mutex::new(None);
+
+#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize)]
+#[serde(rename_all = "lowercase")]
+pub enum ScreenCaptureSourceKind {
+ Screen,
+ Window,
+}
+
+/// A screen or window the user can share.
+#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct ScreenCaptureSource {
+ /// Chromium's `DesktopMediaID` string, passed as `chromeMediaSourceId`.
+ pub id: String,
+ pub kind: ScreenCaptureSourceKind,
+ /// The window title, when macOS exposes it. Screens have none; the
+ /// frontend labels them.
+ pub name: Option<String>,
+ /// The owning application, for windows.
+ pub app_name: Option<String>,
+ /// Whether a screen is the built-in display.
+ pub builtin: bool,
+}
+
+#[derive(Debug, Clone, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct ScreenCaptureSources {
+ /// Whether macOS Screen Recording access is granted. Without it, capture
+ /// fails and window titles are hidden.
+ pub has_access: bool,
+ pub sources: Vec<ScreenCaptureSource>,
+}
+
+/// Lists the displays and on-screen windows, displays first.
+#[tauri::command]
+pub fn list_screen_capture_sources() -> ScreenCaptureSources {
+ let has_access = CGPreflightScreenCaptureAccess();
+ let mut sources = displays();
+ sources.extend(windows());
+ ScreenCaptureSources {
+ has_access,
+ sources,
+ }
+}
+
+/// Shows the macOS Screen Recording prompt the first time; afterwards macOS
+/// only reports the stored answer. Returns whether access is granted.
+#[tauri::command]
+pub fn request_screen_capture_access() -> bool {
+ CGRequestScreenCaptureAccess()
+}
+
+/// Arms a single desktop capture grant for the source the user just picked.
+#[tauri::command]
+pub fn allow_screen_capture() {
+ *lock_grant() = Some(Instant::now() + GRANT_TTL);
+}
+
+/// Consumes the armed grant. Called by the CEF desktop capture hook on its UI
+/// thread for every desktop capture request.
+pub fn take_screen_capture_grant() -> bool {
+ lock_grant()
+ .take()
+ .is_some_and(|expires_at| Instant::now() < expires_at)
+}
+
+fn lock_grant() -> std::sync::MutexGuard<'static, Option<Instant>> {
+ // The guarded value is a plain deadline, so a poisoned lock is still usable.
+ GRANT_EXPIRES_AT
+ .lock()
+ .unwrap_or_else(std::sync::PoisonError::into_inner)
+}
+
+fn displays() -> Vec<ScreenCaptureSource> {
+ let mut ids: [CGDirectDisplayID; MAX_DISPLAYS as usize] = [0; MAX_DISPLAYS as usize];
+ let mut count = 0u32;
+ // SAFETY: `ids` holds `MAX_DISPLAYS` entries and `count` is a valid out pointer.
+ let error = unsafe { CGGetActiveDisplayList(MAX_DISPLAYS, ids.as_mut_ptr(), &raw mut count) };
+ if error != CGError::Success {
+ tracing::warn!(error = error.0, "failed to list displays");
+ return Vec::new();
+ }
+
+ let main = CGMainDisplayID();
+ let mut ids = ids[..count as usize].to_vec();
+ // The main display first, so it is the default choice.
+ ids.sort_by_key(|id| *id != main);
+ ids.into_iter()
+ .map(|id| ScreenCaptureSource {
+ id: format!("screen:{id}:0"),
+ kind: ScreenCaptureSourceKind::Screen,
+ name: None,
+ app_name: None,
+ builtin: CGDisplayIsBuiltin(id),
+ })
+ .collect()
+}
+
+fn windows() -> Vec<ScreenCaptureSource> {
+ let options =
+ CGWindowListOption::OptionOnScreenOnly | CGWindowListOption::ExcludeDesktopElements;
+ let Some(info) = CGWindowListCopyWindowInfo(options, kCGNullWindowID) else {
+ return Vec::new();
+ };
+ // SAFETY: CFArray is toll-free bridged to NSArray, and every element of the
+ // window list is a CFDictionary keyed by CFString.
+ let info: &NSArray<NSDictionary<NSString, AnyObject>> = unsafe { &*(&raw const *info).cast() };
+
+ let own_pid = i64::from(std::process::id());
+ info.iter()
+ .filter_map(|window| {
+ // Layer 0 holds normal application windows; menus, the Dock and
+ // overlays sit on other layers.
+ if number(&window, unsafe { kCGWindowLayer })? != 0 {
+ return None;
+ }
+ if number(&window, unsafe { kCGWindowOwnerPID })? == own_pid {
+ return None;
+ }
+ let id = number(&window, unsafe { kCGWindowNumber })?;
+ let app_name = string(&window, unsafe { kCGWindowOwnerName });
+ // Titles are only readable with Screen Recording access.
+ let title = string(&window, unsafe { kCGWindowName }).filter(|t| !t.is_empty());
+ if title.is_none() && app_name.is_none() {
+ return None;
+ }
+ Some(ScreenCaptureSource {
+ id: format!("window:{id}:0"),
+ kind: ScreenCaptureSourceKind::Window,
+ name: title,
+ app_name,
+ builtin: false,
+ })
+ })
+ .collect()
+}
+
+fn value(
+ window: &NSDictionary<NSString, AnyObject>,
+ key: &CFString,
+) -> Option<Retained<AnyObject>> {
+ // SAFETY: CFString is toll-free bridged to NSString.
+ let key: &NSString = unsafe { &*std::ptr::from_ref(key).cast() };
+ window.objectForKey(key)
+}
+
+fn number(window: &NSDictionary<NSString, AnyObject>, key: &CFString) -> Option<i64> {
+ value(window, key)?
+ .downcast::<NSNumber>()
+ .ok()
+ .map(|number| number.longLongValue())
+}
+
+fn string(window: &NSDictionary<NSString, AnyObject>, key: &CFString) -> Option<String> {
+ value(window, key)?
+ .downcast::<NSString>()
+ .ok()
+ .map(|string| string.to_string())
+}
diff --git a/docs/agent-guide/calls.md b/docs/agent-guide/calls.md
index c804334b0a..cafff5d96c 100644
--- a/docs/agent-guide/calls.md
+++ b/docs/agent-guide/calls.md
@@ -232,6 +232,15 @@ participants hear it alongside microphones, even away from the Call tab. Leave
call is a separate button. Click outside or press Escape to close a menu.
The controls also work by keyboard and touch.
+In the macOS desktop app, Screen share opens Macro's own **Share your screen**
+picker (screens first, the main display preselected, then open windows), since
+its Chromium has no system picker. Share publishes the chosen source; Cancel
+leaves sharing off. Without macOS Screen Recording access the picker says so
+and macOS shows its prompt; the user reopens Macro after allowing it. A refused
+or failed capture shows its reason under the call controls. Browsers
+and older desktop builds keep the browser's own picker. Verify on a Mac by
+sharing a display and a window, stopping, and cancelling the picker.
+
### Browser call diagnostics
Browser OpenTelemetry requires `enable-browser-otel` (or
@@ -260,7 +269,10 @@ guest names, and bearer URLs/tokens are not attributes.
`call.connect` and background `call.media.setup` are children of the join flow.
`call.media.publish_prejoin`, `enable`, and `toggle` expose publishing/capture
failures after admission; `enumerate` and `background` cover waiting-room
-device lists and effects. A completed join/setup does not imply every device
+device lists and effects. `call.media.screen_share` records which picker ran
+(`native` or `browser`), Screen Recording access, the source count and kind,
+and whether the user cancelled; failures add the underlying
+`call.media.screen_share.error_type`. A completed join/setup does not imply every device
worked: inspect its media children. Later toggles and connection-state samples
are searchable by `call.id`. `call.connection.disconnected` records the SDK's
numeric reason when available. These spans cover the browser LiveKit path,
diff --git a/flake.lock b/flake.lock
index f24490d0bb..c69a8a3296 100644
--- a/flake.lock
+++ b/flake.lock
@@ -180,17 +180,17 @@
"tauri-cef": {
"flake": false,
"locked": {
- "lastModified": 1792523699,
- "narHash": "sha256-++WQc4YpvoMPBFTuDj//856BguC1ArS6AeLTbIOn38Q=",
+ "lastModified": 1793371729,
+ "narHash": "sha256-nRfbjAGUWsbN5CBhFgfARFMEWquvCHvgsTH9a8BqA1g=",
"owner": "macro-inc",
"repo": "tauri",
- "rev": "285fb6b1cb2fc20666da1688f4c74e240a100035",
+ "rev": "4b8a46f15c0a54a5c06a1486cd5432d444c17bd8",
"type": "github"
},
"original": {
"owner": "macro-inc",
"repo": "tauri",
- "rev": "285fb6b1cb2fc20666da1688f4c74e240a100035",
+ "rev": "4b8a46f15c0a54a5c06a1486cd5432d444c17bd8",
"type": "github"
}
}
diff --git a/flake.nix b/flake.nix
index ed40a997e7..cc60fd506d 100644
--- a/flake.nix
+++ b/flake.nix
@@ -10,7 +10,7 @@
crane.url = "github:ipetkov/crane";
crane-tauri.url = "github:JPHutchins/crane-tauri";
tauri-cef = {
- url = "github:macro-inc/tauri/285fb6b1cb2fc20666da1688f4c74e240a100035";
+ url = "github:macro-inc/tauri/4b8a46f15c0a54a5c06a1486cd5432d444c17bd8";
flake = false;
};
};
diff --git a/nix/tauri-desktop.nix b/nix/tauri-desktop.nix
index 26be7e2044..d004e32272 100644
--- a/nix/tauri-desktop.nix
+++ b/nix/tauri-desktop.nix
@@ -886,8 +886,8 @@
"sha256-IdhZM/B8EyC/4/3HxQjkzNkrJeA68+43+rKity+iGLY=";
"git+https://github.com/macro-inc/tauri-plugins?rev=6ddd6600e20436388f169e936b610fe93944b7b0#6ddd6600e20436388f169e936b610fe93944b7b0" =
"sha256-5ErLW2po5ZlTTuJjsCExwC//rHYcQo2tKXiyz3w/0kQ=";
- "git+https://github.com/macro-inc/tauri?rev=285fb6b1#285fb6b1cb2fc20666da1688f4c74e240a100035" =
- "sha256-++WQc4YpvoMPBFTuDj//856BguC1ArS6AeLTbIOn38Q=";
+ "git+https://github.com/macro-inc/tauri?rev=4b8a46f1#4b8a46f15c0a54a5c06a1486cd5432d444c17bd8" =
+ "sha256-nRfbjAGUWsbN5CBhFgfARFMEWquvCHvgsTH9a8BqA1g=";
"git+https://github.com/tauri-apps/winit-gtk4?rev=3d7c7cd19d3c752f75762ceea535444e63bdf8de#3d7c7cd19d3c752f75762ceea535444e63bdf8de" =
"sha256-2mFNnZcPnVqPQ2iakMoXSKXrlHiIv+HuQZ7iOwtrKb4=";
"git+https://github.com/tursodatabase/turso?rev=79163249538197d01dec5ea7f65519454ed792e2#79163249538197d01dec5ea7f65519454ed792e2" =