Skip to content

Linger is An Open-Source Personal Agent That Runs Fully on Your PC. We aim to break Big Tech’s grip on AI by bringing powerful local AI to everyday computers through efficient model–harness co-design, so everyone can run their own.

fix(web): keep Stop usable in a minimized recording and open new Meetings at full size

muterC2f0f1042b921
diff --git a/apps/web/AGENTS.md b/apps/web/AGENTS.md
index 47fb6774..a3e45dd7 100644
--- a/apps/web/AGENTS.md
+++ b/apps/web/AGENTS.md
@@ -97,12 +97,20 @@ build:assets` to check the initial JS budget.
must not trigger repeated hover enter/leave; sidebar expansion and Chat list
collapse remain explicit button actions. Pointer movement only resizes during
an active drag; keyboard resizing and double-click reset remain available.
+- Opening Meeting from the sidebar requests the initial picture-in-picture
+ size so a new expanded recording cannot inherit the browser's cached
+ minimized window bounds. Floating an existing in-page recording keeps the
+ browser's usual placement behavior.
- Recording picture-in-picture collapse remembers that window's actual
expanded outer dimensions and restores both dimensions with an absolute
resize inside the user's click, bounded by the current screen. A pending
native resize must not replace the saved expanded size with collapsed
metrics. Collapse never closes the window or stops the recording; native
- window placement remains under browser control.
+ window placement remains under browser control. Stop preserves the current
+ recording view and window dimensions. A minimized window, in the page
+ (including the desktop app) or picture-in-picture, shows the confirmation
+ actions side by side within its control row, so they stay on screen wherever
+ the row sits; an open window keeps the vertical confirmation card.
- Recording and Voice Mode distinguish the native window's close action from
back to tab through the shared PiP return detection. Back to tab keeps the
session running in the page and exposes a Float action; close ends it.
diff --git a/apps/web/src/features/rooms/chat/voice-mode/voice-pip.ts b/apps/web/src/features/rooms/chat/voice-mode/voice-pip.ts
index cd3c0a78..be3cc36f 100644
--- a/apps/web/src/features/rooms/chat/voice-mode/voice-pip.ts
+++ b/apps/web/src/features/rooms/chat/voice-mode/voice-pip.ts
@@ -4,7 +4,11 @@ import { isDesktopShell } from "@/app/desktop-shell";
/** Chrome and Edge 116+ only; TypeScript's DOM library does not declare it yet. */
interface DocumentPictureInPicture {
- requestWindow(options?: { height?: number; width?: number }): Promise<Window>;
+ requestWindow(options?: {
+ height?: number;
+ width?: number;
+ preferInitialWindowPlacement?: boolean;
+ }): Promise<Window>;
}
/** Voice Mode and Recording never run together; each asks for its own window. */
@@ -55,6 +59,9 @@ function publish(next: typeof pip) {
*/
export async function openVoicePip(
owner: VoicePipOwner,
+ {
+ preferInitialWindowPlacement = false,
+ }: { preferInitialWindowPlacement?: boolean } = {},
): Promise<Window | undefined> {
const pictureInPicture = api();
if (!pictureInPicture) return undefined;
@@ -66,7 +73,10 @@ export async function openVoicePip(
watchingVisibility = true;
}
try {
- const opened = await pictureInPicture.requestWindow(pipSizes[owner]);
+ const opened = await pictureInPicture.requestWindow({
+ ...pipSizes[owner],
+ preferInitialWindowPlacement,
+ });
const stopMirroring = mirrorStyles(opened.document);
opened.addEventListener("pagehide", () => {
stopMirroring();
diff --git a/apps/web/src/features/rooms/voice-control/recording-entry.tsx b/apps/web/src/features/rooms/voice-control/recording-entry.tsx
index a71b5cc5..fc0b8ac4 100644
--- a/apps/web/src/features/rooms/voice-control/recording-entry.tsx
+++ b/apps/web/src/features/rooms/voice-control/recording-entry.tsx
@@ -89,7 +89,11 @@ export function RecordingEntry({
// the browser allows it for a few seconds after, enough to load it.
const startRecording = async () => {
const pip = import("../chat/voice-mode/voice-pip");
- const opened = pip.then(({ openVoicePip }) => openVoicePip("recording"));
+ // A new Meeting opens expanded, even if the browser remembers a small
+ // window from a recording that ended while minimized.
+ const opened = pip.then(({ openVoicePip }) =>
+ openVoicePip("recording", { preferInitialWindowPlacement: true }),
+ );
try {
await voice.selectTargetRoom?.(anotherMeRoomId);
await opened;
diff --git a/apps/web/src/features/rooms/voice-control/recording-window.test.tsx b/apps/web/src/features/rooms/voice-control/recording-window.test.tsx
index 2384130f..75ff0da8 100644
--- a/apps/web/src/features/rooms/voice-control/recording-window.test.tsx
+++ b/apps/web/src/features/rooms/voice-control/recording-window.test.tsx
@@ -20,6 +20,7 @@ import {
resetVoicePipForTest,
} from "../chat/voice-mode/voice-pip";
import RecordingWindow, { pinchedPlacement } from "./recording-window";
+import { RecordingEntry } from "./recording-entry";
import {
openRecordingWindow,
resetRecordingWindowForTest,
@@ -177,7 +178,10 @@ function WindowState() {
function renderWindow(
voice: VoiceControlContextValue,
- { tenantId }: { tenantId?: string } = {},
+ {
+ tenantId,
+ showEntry = false,
+ }: { tenantId?: string; showEntry?: boolean } = {},
) {
const { runtime, routes } = api();
const queryClient = new QueryClient();
@@ -187,6 +191,9 @@ function renderWindow(
<VoiceControlContext value={value}>
<RecordingWindow />
<WindowState />
+ {showEntry ? (
+ <RecordingEntry anotherMeRoomId="room-1" tenantId="tenant-1" />
+ ) : null}
</VoiceControlContext>
</TeamHubRuntimeProvider>
</QueryClientProvider>
@@ -219,6 +226,7 @@ afterEach(() => {
// Unmount portals before removing their picture-in-picture documents.
cleanup();
Reflect.deleteProperty(window, "documentPictureInPicture");
+ Reflect.deleteProperty(window, "lingerDesktop");
document.querySelectorAll("iframe").forEach((frame) => frame.remove());
});
@@ -540,6 +548,155 @@ describe("Recording window", () => {
expect(screen.getByTestId("window-state")).toHaveTextContent("closed");
});
+ it.each(["browser", "desktop"])(
+ "asks inside the row of a minimized in-page window in %s",
+ async (host) => {
+ if (host === "desktop") {
+ defineGlobalProperty(window, "lingerDesktop", {
+ configurable: true,
+ value: {},
+ });
+ }
+ const voice = voiceValue();
+ renderWindow(voice);
+ fireEvent.click(
+ screen.getByRole("button", { name: "Minimize recording" }),
+ );
+ expect(screen.queryByRole("tablist")).toBeNull();
+
+ fireEvent.click(screen.getByRole("button", { name: "Stop recording" }));
+ expect(
+ screen.getByRole("alertdialog", { name: "Stop recording?" }),
+ ).toBeVisible();
+ expect(screen.queryByRole("tablist")).toBeNull();
+ expect(screen.getByTestId("window-state")).toHaveTextContent("minimized");
+ // The row may sit at the bottom of the viewport, where a card hanging
+ // below it would be off screen; the actions stay inside the row.
+ expect(screen.getByText("Stop recording?")).toHaveClass("sr-only");
+ expect(
+ screen.getByRole("button", { name: "Stop & save" }).parentElement,
+ ).not.toHaveClass("flex-col");
+ expect(
+ screen.getByRole("region", { name: "Hardware voice focus" }),
+ ).toHaveClass("overflow-hidden");
+ expect(screen.getByRole("button", { name: "Stop & save" })).toBeVisible();
+ expect(
+ screen.getByRole("button", { name: "Keep recording" }),
+ ).toBeVisible();
+ fireEvent.click(screen.getByRole("button", { name: "Keep recording" }));
+ expect(screen.queryByRole("alertdialog")).toBeNull();
+ expect(screen.queryByRole("tablist")).toBeNull();
+ expect(voice.leavePage).not.toHaveBeenCalled();
+
+ fireEvent.click(screen.getByRole("button", { name: "Stop recording" }));
+ fireEvent.click(screen.getByRole("button", { name: "Stop & save" }));
+ await waitFor(() => expect(voice.leavePage).toHaveBeenCalledOnce());
+ },
+ );
+
+ it("keeps the expanded Ask view while confirming Stop", () => {
+ const voice = voiceValue();
+ renderWindow(voice);
+ fireEvent.click(screen.getByRole("tab", { name: "Ask" }));
+ fireEvent.click(screen.getByRole("button", { name: "Stop recording" }));
+ expect(screen.getByRole("tab", { name: "Ask" })).toHaveAttribute(
+ "aria-selected",
+ "true",
+ );
+ expect(screen.getByTestId("window-state")).toHaveTextContent("open");
+ // The open window has room for the full question card.
+ expect(screen.getByText("Stop recording?")).not.toHaveClass("sr-only");
+ expect(
+ screen.getByRole("button", { name: "Stop & save" }).parentElement,
+ ).toHaveClass("flex-col");
+ fireEvent.click(screen.getByRole("button", { name: "Keep recording" }));
+ expect(screen.getByRole("tab", { name: "Ask" })).toHaveAttribute(
+ "aria-selected",
+ "true",
+ );
+ expect(voice.leavePage).not.toHaveBeenCalled();
+ });
+
+ it("opens a new Meeting at full size after stopping a minimized recording", async () => {
+ const { frame, pipWindow, requestWindow } = stubPictureInPicture();
+ const firstVoice = voiceValue();
+ const first = renderWindow(firstVoice);
+ await act(() => openVoicePip("recording"));
+ const floating = within(frame.contentDocument!.body);
+ fireEvent.click(
+ floating.getByRole("button", { name: "Minimize recording" }),
+ );
+ expect(pipWindow.innerHeight).toBe(104);
+ fireEvent.click(floating.getByRole("button", { name: "Stop recording" }));
+ fireEvent.click(floating.getByRole("button", { name: "Stop & save" }));
+ await waitFor(() =>
+ expect(screen.getByTestId("window-state")).toHaveTextContent("closed"),
+ );
+ first.unmount();
+
+ const next = renderWindow(
+ voiceValue({ captureState: { status: "idle" } }),
+ { showEntry: true },
+ );
+ fireEvent.click(screen.getByRole("button", { name: "Meetings" }));
+ await waitFor(() => expect(requestWindow).toHaveBeenCalledTimes(2));
+ await waitFor(() =>
+ expect(screen.getByTestId("window-state")).toHaveTextContent("open"),
+ );
+ next.rerender(
+ voiceValue({
+ captureState: {
+ status: "recording",
+ capture: { ...capture, id: "capture-2" },
+ },
+ }),
+ );
+ expect(floating.getByRole("tablist")).toBeInTheDocument();
+ expect(pipWindow.innerHeight).toBe(720);
+ expect(pipWindow.innerWidth).toBe(420);
+ });
+
+ it("uses horizontal confirmation without resizing a minimized picture-in-picture window", async () => {
+ const { frame, pipWindow } = stubPictureInPicture();
+ const voice = voiceValue();
+ renderWindow(voice);
+ await act(() => openVoicePip("recording"));
+ const floating = within(frame.contentDocument!.body);
+ pipWindow.resizeTo(560, 492);
+ fireEvent.click(
+ floating.getByRole("button", { name: "Minimize recording" }),
+ );
+ expect(pipWindow.innerHeight).toBe(104);
+ pipWindow.resizeTo.mockClear();
+
+ fireEvent.click(floating.getByRole("button", { name: "Stop recording" }));
+ expect(
+ floating.getByRole("alertdialog", { name: "Stop recording?" }),
+ ).toBeInTheDocument();
+ expect(pipWindow.outerWidth).toBe(560);
+ expect(pipWindow.innerHeight).toBe(104);
+ expect(
+ floating.getByRole("button", { name: "Stop & save" }).parentElement,
+ ).not.toHaveClass("flex-col");
+ expect(floating.getByText("Stop recording?")).toHaveClass("sr-only");
+ expect(floating.queryByRole("tablist")).toBeNull();
+ expect(screen.getByTestId("window-state")).toHaveTextContent("minimized");
+ fireEvent.click(floating.getByRole("button", { name: "Keep recording" }));
+ expect(pipWindow.innerHeight).toBe(104);
+ expect(pipWindow.resizeTo).not.toHaveBeenCalled();
+ expect(voice.leavePage).not.toHaveBeenCalled();
+ fireEvent.click(floating.getByRole("button", { name: "Open recording" }));
+ expect(pipWindow.outerHeight).toBe(492);
+ fireEvent.click(floating.getByRole("button", { name: "Stop recording" }));
+ expect(pipWindow.outerHeight).toBe(492);
+ expect(floating.getByText("Stop recording?")).not.toHaveClass("sr-only");
+ expect(
+ floating.getByRole("button", { name: "Stop & save" }).parentElement,
+ ).toHaveClass("flex-col");
+ fireEvent.click(floating.getByRole("button", { name: "Keep recording" }));
+ expect(pipWindow.outerHeight).toBe(492);
+ });
+
it("floats over other apps, and closing it minimized ends the recording", async () => {
const { frame, pipWindow } = stubPictureInPicture();
const voice = voiceValue();
@@ -912,7 +1069,19 @@ function stubPictureInPicture() {
);
}),
};
- const requestWindow = vi.fn(async () => pipWindow);
+ // Browsers reuse the last closed bounds unless the caller opts out.
+ const requestWindow = vi.fn(
+ async (options?: {
+ width?: number;
+ height?: number;
+ preferInitialWindowPlacement?: boolean;
+ }) => {
+ if (options?.preferInitialWindowPlacement) {
+ pipWindow.resizeTo(options.width!, options.height! + 32);
+ }
+ return pipWindow;
+ },
+ );
defineGlobalProperty(window, "documentPictureInPicture", {
configurable: true,
value: { requestWindow },
diff --git a/apps/web/src/features/rooms/voice-control/voice-focus-surface.tsx b/apps/web/src/features/rooms/voice-control/voice-focus-surface.tsx
index 5e4e059b..5f2b674a 100644
--- a/apps/web/src/features/rooms/voice-control/voice-focus-surface.tsx
+++ b/apps/web/src/features/rooms/voice-control/voice-focus-surface.tsx
@@ -201,6 +201,9 @@ export function VoiceFocusSurface({
// Before a recording runs, the window always shows how to start it.
const shown: RecordingView | undefined = panels ? view : "transcript";
const pip = floating === "pip";
+ // A minimized window is one row tall, in the page or floating, and a page
+ // window can sit at the bottom of the viewport; Stop asks inside that row.
+ const compactConfirmation = !shown;
// The listening title is the quiet default; anything else is news.
const notice = captureActive && title !== listeningTitle ? title : undefined;
const tabs: { id: RecordingView; label: string }[] = [
@@ -226,9 +229,13 @@ export function VoiceFocusSurface({
}
});
// Closing a running recording asks first; it ends and saves the recording.
+ // Confirmation never changes the recording view.
const close = () => {
- if (captureActive) setConfirmingStop(true);
- else void run(leave);
+ if (!captureActive) {
+ void run(leave);
+ return;
+ }
+ setConfirmingStop(true);
};
const titleBar = (
<div
@@ -239,6 +246,7 @@ export function VoiceFocusSurface({
<button
aria-label={shown ? "Minimize recording" : "Open recording"}
className={styles.windowButton}
+ disabled={confirmingStop}
onClick={() => onViewChange?.(shown ? undefined : "transcript")}
title={shown ? "Minimize; recording continues" : "Open recording"}
type="button"
@@ -255,6 +263,7 @@ export function VoiceFocusSurface({
<button
aria-label="Float recording window"
className={styles.windowButton}
+ disabled={confirmingStop}
onClick={onFloat}
title="Float over other tabs and apps"
type="button"
@@ -347,27 +356,46 @@ export function VoiceFocusSurface({
</button>
</header>
{confirmingStop ? (
- <div className={styles.confirmLayer}>
+ <div
+ className={`${styles.confirmLayer} ${pip ? "overflow-y-auto" : ""}`}
+ >
<div
aria-describedby="recording-stop-description"
aria-labelledby="recording-stop-title"
aria-modal="true"
- className={styles.confirm}
+ className={
+ compactConfirmation ? "w-full min-w-0" : styles.confirm
+ }
role="alertdialog"
>
- <h2 className={styles.confirmTitle} id="recording-stop-title">
+ <h2
+ className={
+ compactConfirmation ? "sr-only" : styles.confirmTitle
+ }
+ id="recording-stop-title"
+ >
Stop recording?
</h2>
<p
- className={styles.confirmDescription}
+ className={
+ compactConfirmation ? "sr-only" : styles.confirmDescription
+ }
id="recording-stop-description"
>
The recording is saved and summarized. You can find it in
Meetings.
</p>
- <div className="flex flex-col gap-2">
+ <div
+ className={
+ compactConfirmation ? "flex gap-2" : "flex flex-col gap-2"
+ }
+ >
<button
- className={styles.confirmStop}
+ className={
+ compactConfirmation
+ ? `${styles.confirmStop} flex-1 whitespace-nowrap`
+ : styles.confirmStop
+ }
onClick={() => {
// A failed stop shows its reason in the window behind.
setConfirmingStop(false);
@@ -381,8 +409,14 @@ export function VoiceFocusSurface({
<button
// eslint-disable-next-line jsx-a11y/no-autofocus -- the safe choice is focused on purpose because the user just asked to stop recording
autoFocus
- className={styles.confirmKeep}
- onClick={() => setConfirmingStop(false)}
+ className={
+ compactConfirmation
+ ? `${styles.confirmKeep} flex-1 whitespace-nowrap`
+ : styles.confirmKeep
+ }
+ onClick={() => {
+ setConfirmingStop(false);
+ }}
type="button"
>
Keep recording