Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

Studio: shared media bar, Open with apps, steady image lightbox (#13241)

Michael Hanba21f790de35
diff --git a/studio/frontend/src/components/app-sidebar.tsx b/studio/frontend/src/components/app-sidebar.tsx
index f94ca9481d1..d91261fdf58 100644
--- a/studio/frontend/src/components/app-sidebar.tsx
+++ b/studio/frontend/src/components/app-sidebar.tsx
@@ -103,7 +103,6 @@ import {
CpuIcon,
CursorInfo02Icon,
DashboardCircleIcon,
- AudioWave01Icon,
Delete02Icon,
Download01Icon,
Edit03Icon,
@@ -140,10 +139,7 @@ import {
LayerIcon,
ApiIcon,
} from "@hugeicons/core-free-icons";
-import {
- MessageCircleIcon,
- TestTubeOutlineIcon,
-} from "@/lib/hugeicons-derived";
+import { AiSpeechIcon, MessageCircleIcon, TestTubeOutlineIcon } from "@/lib/hugeicons-derived";
import {
Tooltip,
TooltipContent,
@@ -2868,7 +2864,7 @@ export function AppSidebar() {
},
},
audio: {
- icon: AudioWave01Icon,
+ icon: AiSpeechIcon,
label: t("shell.navigation.audio"),
badge: t("shell.navigation.newBadge"),
active: pathname === "/audio" || pathname.startsWith("/audio/"),
diff --git a/studio/frontend/src/components/assistant-ui/attachment-preview.tsx b/studio/frontend/src/components/assistant-ui/attachment-preview.tsx
index e3ea8de2e18..2bcab1cc37b 100644
--- a/studio/frontend/src/components/assistant-ui/attachment-preview.tsx
+++ b/studio/frontend/src/components/assistant-ui/attachment-preview.tsx
@@ -50,6 +50,7 @@ import {
} from "@/features/library";
import { useT } from "@/i18n";
import { MAX_HIGHLIGHT_CHARS } from "@/lib/markdown-plugins";
+import { asPng } from "@/lib/copy-to-clipboard";
import { toast } from "@/lib/toast";
import { cn } from "@/lib/utils";
import { useAui, useAuiState } from "@assistant-ui/react";
@@ -131,20 +132,6 @@ const useObjectUrl = (file: File | undefined): string | undefined => {
const loadGalleryImage = (image: GalleryImage): Promise<Blob> =>
image.file ? Promise.resolve(image.file) : fetchBlob(image.image ?? "");
-/** As PNG: the one image type every browser's clipboard takes. */
-const pngOf = async (blob: Blob): Promise<Blob> => {
- if (blob.type === "image/png") return blob;
- const bitmap = await createImageBitmap(blob);
- const canvas = document.createElement("canvas");
- canvas.width = bitmap.width;
- canvas.height = bitmap.height;
- canvas.getContext("2d")?.drawImage(bitmap, 0, 0);
- bitmap.close();
- return new Promise((resolve, reject) =>
- canvas.toBlob((png) => (png ? resolve(png) : reject(new Error("PNG encoding failed"))), "image/png"),
- );
-};
-
const copyImage = (image: GalleryImage, t: ReturnType<typeof useT>): void => {
if (typeof ClipboardItem === "undefined" || !navigator.clipboard?.write) {
toast.error(t("imageViewer.copyFailed"));
@@ -152,7 +139,7 @@ const copyImage = (image: GalleryImage, t: ReturnType<typeof useT>): void => {
}
// The item is made now, inside the click, and resolves later: Safari refuses a write made after.
navigator.clipboard
- .write([new ClipboardItem({ "image/png": loadGalleryImage(image).then(pngOf) })])
+ .write([new ClipboardItem({ "image/png": loadGalleryImage(image).then(asPng) })])
.then(
() => toast.success(t("imageViewer.copied")),
() => toast.error(t("imageViewer.copyFailed")),
diff --git a/studio/frontend/src/components/command-palette.tsx b/studio/frontend/src/components/command-palette.tsx
index 710f4609901..71601924103 100644
--- a/studio/frontend/src/components/command-palette.tsx
+++ b/studio/frontend/src/components/command-palette.tsx
@@ -30,7 +30,6 @@ import { useT, type TranslationKey } from "@/i18n";
import { cn } from "@/lib/utils";
import { useCommandPaletteStore } from "@/stores/command-palette";
import {
- AudioWave01Icon,
Cancel01Icon,
ChefHatIcon,
DashboardCircleIcon,
@@ -47,6 +46,7 @@ import {
TestTube01Icon,
ApiIcon,
} from "@hugeicons/core-free-icons";
+import { AiSpeechIcon } from "@/lib/hugeicons-derived";
import { HugeiconsIcon } from "@hugeicons/react";
import { useNavigate, useRouterState } from "@tanstack/react-router";
import { Command as CommandPrimitive } from "cmdk";
@@ -128,7 +128,7 @@ const WORKSPACES: {
},
{
id: "switchToAudio",
- icon: AudioWave01Icon,
+ icon: AiSpeechIcon,
labelKey: "shell.navigation.audio",
aliases: ["speech", "tts", "voice", "music", "transcribe"],
},
diff --git a/studio/frontend/src/components/media-viewer.tsx b/studio/frontend/src/components/media-viewer.tsx
index 7b8a2829263..790e859f83c 100644
--- a/studio/frontend/src/components/media-viewer.tsx
+++ b/studio/frontend/src/components/media-viewer.tsx
@@ -376,7 +376,7 @@ export function MediaViewer({
}}
overlayClassName={
lightbox
- ? "bg-[color-mix(in_oklab,var(--background)_55%,transparent)] supports-backdrop-filter:backdrop-blur-[1px] duration-150"
+ ? "media-lightbox-overlay bg-transparent supports-backdrop-filter:backdrop-blur-[1px] duration-150"
: undefined
}
className={
diff --git a/studio/frontend/src/components/media-zoom.tsx b/studio/frontend/src/components/media-zoom.tsx
index 4ac13d62642..7da51826367 100644
--- a/studio/frontend/src/components/media-zoom.tsx
+++ b/studio/frontend/src/components/media-zoom.tsx
@@ -231,7 +231,15 @@ export function MediaZoomStage({
: (stage.height - box.height) / 2,
transform: translate(pan),
}
- : { inset: 0 }
+ : // Until measured, the clear area: a contained picture there already sits where fit
+ // puts it, so nothing moves once it loads. Longhands, not `inset`: React clears a
+ // removed shorthand after setting `left`, which put the picture at the left edge.
+ {
+ left: inset.left,
+ top: inset.top,
+ width: `calc(100% - ${inset.left + inset.right}px)`,
+ height: `calc(100% - ${inset.top + inset.bottom}px)`,
+ }
}
>
{children}
diff --git a/studio/frontend/src/features/audio/components/audio-source-input.tsx b/studio/frontend/src/features/audio/components/audio-source-input.tsx
index 34ddf92ee21..431d6ade91e 100644
--- a/studio/frontend/src/features/audio/components/audio-source-input.tsx
+++ b/studio/frontend/src/features/audio/components/audio-source-input.tsx
@@ -12,12 +12,12 @@ import {
import { cn } from "@/lib/utils";
import {
Alert02Icon,
- AudioWave01Icon,
Cancel01Icon,
Mic01Icon,
StopIcon,
Upload04Icon,
} from "@hugeicons/core-free-icons";
+import { AiSpeechIcon } from "@/lib/hugeicons-derived";
import { HugeiconsIcon } from "@hugeicons/react";
import {
type ReactNode,
@@ -269,7 +269,7 @@ export function AudioSourceInput({
<div className="grid gap-2">
<div className="flex min-w-0 items-center gap-2 text-ui-12">
<HugeiconsIcon
- icon={AudioWave01Icon}
+ icon={AiSpeechIcon}
className="size-3.5 shrink-0 text-muted-foreground"
/>
<span
diff --git a/studio/frontend/src/features/audio/pages/separate-page.tsx b/studio/frontend/src/features/audio/pages/separate-page.tsx
index 925e2e3a7d0..893a796ff46 100644
--- a/studio/frontend/src/features/audio/pages/separate-page.tsx
+++ b/studio/frontend/src/features/audio/pages/separate-page.tsx
@@ -9,7 +9,8 @@ import { Button } from "@/components/ui/button";
import type { ModelOption } from "@/features/model-picker/components/model-selector/types";
import { toast } from "@/lib/toast";
import { cn } from "@/lib/utils";
-import { AudioWave01Icon, Download01Icon } from "@hugeicons/core-free-icons";
+import { Download01Icon } from "@hugeicons/core-free-icons";
+import { AiSpeechIcon } from "@/lib/hugeicons-derived";
import { HugeiconsIcon } from "@hugeicons/react";
import { type ComponentProps, useEffect, useMemo, useState } from "react";
import {
@@ -606,7 +607,7 @@ export function SeparateOutput({
className="flex min-w-0 flex-1 items-center gap-2 px-2 py-1.5 text-left text-ui-13"
>
<HugeiconsIcon
- icon={AudioWave01Icon}
+ icon={AiSpeechIcon}
className="size-3.5 shrink-0 text-muted-foreground"
/>
<span className="min-w-0 flex-1 truncate">
diff --git a/studio/frontend/src/features/audio/pages/tts-workspace.tsx b/studio/frontend/src/features/audio/pages/tts-workspace.tsx
index e322ee2348c..4c113c3117b 100644
--- a/studio/frontend/src/features/audio/pages/tts-workspace.tsx
+++ b/studio/frontend/src/features/audio/pages/tts-workspace.tsx
@@ -19,12 +19,12 @@ import { PillTabs } from "@/features/model-picker/components/model-selector/pill
import { toast } from "@/lib/toast";
import { cn } from "@/lib/utils";
import {
- AudioWave01Icon,
Copy01Icon,
FloppyDiskIcon,
SparklesIcon,
StopIcon,
} from "@hugeicons/core-free-icons";
+import { AiSpeechIcon } from "@/lib/hugeicons-derived";
import { HugeiconsIcon } from "@hugeicons/react";
import { addAudioClipToProject, type AudioGalleryClip } from "../api";
import { AudioOptionFields } from "../audio-options-fields";
@@ -732,7 +732,7 @@ export function TtsOutput({
className="flex min-w-0 flex-1 items-center gap-2 px-2 py-1.5 text-left text-ui-13"
>
<HugeiconsIcon
- icon={AudioWave01Icon}
+ icon={AiSpeechIcon}
className="size-3.5 shrink-0 text-muted-foreground"
/>
<span className="min-w-0 flex-1 truncate">
diff --git a/studio/frontend/src/features/audio/workflows.ts b/studio/frontend/src/features/audio/workflows.ts
index ba0e64f5b88..4d36095c860 100644
--- a/studio/frontend/src/features/audio/workflows.ts
+++ b/studio/frontend/src/features/audio/workflows.ts
@@ -12,32 +12,9 @@ import {
SplitIcon,
} from "@hugeicons/core-free-icons";
import type { IconSvgElement } from "@hugeicons/react";
+import { TextToSpeechIcon } from "../../lib/hugeicons-derived.ts";
import { AUDIO_CPP_MUSIC_AUDIO_TYPE } from "./audio-cpp-catalog.ts";
-const stroke = {
- stroke: "currentColor",
- strokeLinecap: "round",
- strokeLinejoin: "round",
- strokeWidth: "1.5",
-} as const;
-
-// Hugeicons "ai-speech" (MIT). Only in core-free-icons 4.3+, newer than the pinned 4.1.1.
-const AiSpeechIcon: IconSvgElement = [
- ["path", { d: "M12 7V17", ...stroke, key: "0" }],
- ["path", { d: "M16 11L16 19", ...stroke, key: "1" }],
- ["path", { d: "M20 11L20 14", ...stroke, key: "2" }],
- ["path", { d: "M8 3V21", ...stroke, key: "3" }],
- ["path", { d: "M4 9V15", ...stroke, key: "4" }],
- [
- "path",
- {
- d: "M18.5 3.9375V5.5M18.5 5.5V7.0625M18.5 5.5H17.25M18.5 5.5H19.75M21 5.5L19.9156 5.13852C19.4179 4.97263 19.0274 4.58211 18.8615 4.08443L18.5 3L18.1385 4.08443C17.9726 4.58211 17.5821 4.97263 17.0844 5.13852L16 5.5L17.0844 5.86148C17.5821 6.02737 17.9726 6.41789 18.1385 6.91557L18.5 8L18.8615 6.91557C19.0274 6.41789 19.4179 6.02737 19.9156 5.86148L21 5.5Z",
- ...stroke,
- key: "5",
- },
- ],
-];
-
export type AudioWorkflowId =
| "speak"
| "clone"
@@ -62,7 +39,7 @@ export const AUDIO_WORKFLOWS: ReadonlyArray<{
id: "speak",
label: "Text to Speech",
heading: "Text to speech",
- icon: AiSpeechIcon,
+ icon: TextToSpeechIcon,
hint: "Turn text into speech with a built-in or designed voice",
slot: "speak",
createTrain: true,
diff --git a/studio/frontend/src/features/browser/browser-panel.tsx b/studio/frontend/src/features/browser/browser-panel.tsx
index 94e1c046ea2..838780e041a 100644
--- a/studio/frontend/src/features/browser/browser-panel.tsx
+++ b/studio/frontend/src/features/browser/browser-panel.tsx
@@ -36,7 +36,6 @@ import {
attachmentFileKind,
useChatRuntimeStore,
} from "@/features/chat";
-import { formatBytes } from "@/features/hub";
import { startLibraryChat } from "@/features/library";
import {
useSettingsDialogStore,
@@ -48,7 +47,7 @@ import { registerZoomScope } from "@/features/interface-zoom";
import { useLocale, useT } from "@/i18n";
import { isTauri } from "@/lib/api-base";
import { ChevronDownStandardIcon } from "@/lib/chevron-icons";
-import { copyToClipboard, copyToClipboardFrom } from "@/lib/copy-to-clipboard";
+import { asPng, copyToClipboard, copyToClipboardFrom } from "@/lib/copy-to-clipboard";
import { openExternalLink } from "@/lib/open-link";
import { RefreshGlyph } from "@/lib/refresh-icon";
import { ShieldAlertGlyph } from "@/lib/shield-alert-icon";
@@ -66,6 +65,8 @@ import {
Clock01Icon,
ComputerTerminal01Icon,
Copy01Icon,
+ Folder01Icon,
+ Link01Icon,
CursorRectangleSelection02Icon,
Download01Icon,
InternetIcon,
@@ -104,7 +105,17 @@ import { fileNameFromUrl, hostOf, resolveAddress } from "./address";
import { OtherSurfaceError, canPrintFrames, printPage, screenshotPage } from "./capture";
import { canScreenshot } from "./screenshot-support";
import { stageEditsPrompt } from "./stage-edits";
+import { revealLabelKey } from "./download-format";
+import { isDangerousDownload } from "./download-safety";
import { type BrowserDownload, saveBrowserDownload, saveNeedsClick } from "./downloads";
+import {
+ type OpenWithApp,
+ localCopyPath,
+ openLocalCopy,
+ openWithApps,
+ revealLocalCopy,
+ withLocalCopy,
+} from "./open-with";
import { DownloadsButton } from "./downloads-button";
import { BROWSER_FIND_TARGET, registerBrowserFind } from "./find";
import { ClearBrowsingDataDialog } from "./clear-data-dialog";
@@ -1474,11 +1485,7 @@ function WebToolbar({ tab, visible }: { tab: BrowserTab | undefined; visible: bo
/** HTML and code use the browser chrome; other files keep the floating controls. */
function usesBrowserChrome(entry: Extract<BrowserEntry, { kind: "file" }>): boolean {
const kind = textFileKind(entry.name, entry.contentType, entry.plainText);
- return kind === "html" || kind === "code" || isVideoEntry(entry);
-}
-
-function isVideoEntry(entry: Extract<BrowserEntry, { kind: "file" }>): boolean {
- return !entry.plainText && mediaKind(entry.name, entry.contentType) === "video";
+ return kind === "html" || kind === "code";
}
function BrowserFileToolbar({
@@ -1761,6 +1768,8 @@ function FloatingFileToolbar({
const blob = download?.blob;
const kind = textFileKind(entry.name, entry.contentType, entry.plainText);
const hasSource = kind === "html" || kind === "markdown";
+ const media = entry.plainText ? null : mediaKind(entry.name, entry.contentType);
+ const timed = media === "video" || media === "audio";
const showsSource = kind === "code" || kind === "text" || (hasSource && view.mode === "source");
const htmlPreview = kind === "html" && view.mode === "preview";
const setView = (patch: Partial<FileViewState>) => useBrowserStore.getState().setFileView(tab.id, patch);
@@ -1940,29 +1949,31 @@ function FloatingFileToolbar({
) : null}
</DropdownMenuContent>
</DropdownMenu>
- {/* A true circle, glyph centred; the label is its tooltip. */}
- <IconButton
- label={t("browser.file.requestEdits")}
- // Without a chat to send marks to, stages a prompt naming the file.
- onClick={() =>
- canAnnotate
- ? toggleAnnotating()
- : (requestEdits ?? stageEditsPrompt)(
- t("browser.file.requestEditsPrompt", { name: entry.name }),
- )
- }
- className={cn(
- PILL,
- "size-9 rounded-full p-0 text-foreground",
- annotating && "text-primary hover:text-primary",
- )}
- >
- <HugeiconsIcon
- icon={CursorRectangleSelection02Icon}
- strokeWidth={1.75}
- className={ANNOTATE_GLYPH}
- />
- </IconButton>
+ {/* A true circle, glyph centred; the label is its tooltip. A clip or a track has nothing to mark. */}
+ {timed ? null : (
+ <IconButton
+ label={t("browser.file.requestEdits")}
+ // Without a chat to send marks to, stages a prompt naming the file.
+ onClick={() =>
+ canAnnotate
+ ? toggleAnnotating()
+ : (requestEdits ?? stageEditsPrompt)(
+ t("browser.file.requestEditsPrompt", { name: entry.name }),
+ )
+ }
+ className={cn(
+ PILL,
+ "size-9 rounded-full p-0 text-foreground",
+ annotating && "text-primary hover:text-primary",
+ )}
+ >
+ <HugeiconsIcon
+ icon={CursorRectangleSelection02Icon}
+ strokeWidth={1.75}
+ className={ANNOTATE_GLYPH}
+ />
+ </IconButton>
+ )}
<span
aria-hidden={true}
className="min-w-0 flex-1 pointer-events-none!"
@@ -2043,16 +2054,9 @@ function FloatingFileToolbar({
</Tooltip>
</>
) : null}
- {kind ? (
- <CircleButton
- label={copied ? t("browser.file.copied") : t("browser.file.copy")}
- icon={copied ? Tick02Icon : Copy01Icon}
- disabled={!blob}
- onClick={copyContents}
- className="hidden size-9 @[40rem]:flex"
- />
- ) : null}
- <ScaleMenu
+ <CopySplit tab={tab} entry={entry} blob={blob} copied={copied} onCopyContents={copyContents} />
+ {timed ? null : (
+ <ScaleMenu
value={tab.zoom}
scales={ATTACHMENT_PAGE_SCALES}
contentClassName="browser-menu"
@@ -2062,7 +2066,9 @@ function FloatingFileToolbar({
.setZoom(tab.id, value === "fit" ? 1 : value)
}
className={cn(PILL, "mr-0 hidden h-9 pr-2.5 @[28rem]:flex")}
- />
+ />
+ )}
+ <OpenSplit key={entry.fileId} entry={entry} blob={blob} />
<CircleButton
label={t("browser.download")}
icon={Download01Icon}
@@ -2075,9 +2081,13 @@ function FloatingFileToolbar({
);
}
-const SPLIT_PILL = cn(PILL, "flex h-9 shrink-0 items-center rounded-full");
+const SPLIT_PILL = cn(
+ PILL,
+ "flex h-9 shrink-0 items-center rounded-full",
+ "has-[[data-state=open]]:bg-[color-mix(in_oklab,var(--pill-bg),var(--foreground)_var(--pill-hover))]",
+);
const SPLIT_PART =
- "flex h-full cursor-pointer items-center rounded-full text-ui-13p5 text-foreground outline-none transition-colors hover:bg-[color-mix(in_oklab,var(--foreground)_6%,transparent)] focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 data-[state=open]:bg-[color-mix(in_oklab,var(--foreground)_8%,transparent)]";
+ "flex h-full cursor-pointer items-center rounded-full text-ui-13p5 text-foreground outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50";
function SplitChevron() {
return (
@@ -2089,34 +2099,34 @@ function SplitChevron() {
);
}
-/** Video file bar: the name, then Copy and Open, each with its options. */
-function VideoFileToolbar({
+type FileEntry = Extract<BrowserEntry, { kind: "file" }>;
+
+function CopySplit({
tab,
entry,
- visible,
-}: { tab: BrowserTab; entry: Extract<BrowserEntry, { kind: "file" }>; visible: boolean }) {
+ blob,
+ copied,
+ onCopyContents,
+}: {
+ tab: BrowserTab;
+ entry: FileEntry;
+ blob: Blob | undefined;
+ copied: boolean;
+ onCopyContents: () => void;
+}) {
const t = useT();
- const navigate = useNavigate();
- const download = tabDownload(tab);
- const blob = download?.blob;
- const { goBack, goForward } = useBrowserStore.getState();
- // A blob URL can't be handed to another app from the desktop app.
- const tabType = isTauri ? null : browserTabType(entry.name, entry.contentType || blob?.type || "");
- const canOpenTab = tabType !== null;
- const frameCopies = canCopyVideoFrame();
- const openInBrowser = () => {
- if (!blob || !tabType) return;
- const url = URL.createObjectURL(new Blob([blob], { type: tabType }));
- window.open(url, "_blank", "noopener,noreferrer");
- window.setTimeout(() => URL.revokeObjectURL(url), 60_000);
- };
- const openInNewChat = () => {
+ const kind = textFileKind(entry.name, entry.contentType, entry.plainText);
+ const media = entry.plainText ? null : mediaKind(entry.name, entry.contentType);
+ // The desktop app's clipboard takes no images (video-registry.ts), so it copies the path instead.
+ const images = canCopyVideoFrame();
+ const copyImage = () => {
if (!blob) return;
- startLibraryChat(navigate, {
- files: [new File([blob], entry.name, { type: entry.contentType || blob.type })],
- });
+ // The item is made now, inside the click, and resolves later: Safari refuses a write made after.
+ navigator.clipboard.write([new ClipboardItem({ "image/png": asPng(blob) })]).then(
+ () => toast.success(t("imageViewer.copied")),
+ () => toast.error(t("imageViewer.copyFailed")),
+ );
};
- const save = () => download && void saveBrowserDownload(download);
const copyFrame = () => {
const video = tabVideo(tab.id);
if (!video) return;
@@ -2124,126 +2134,189 @@ function VideoFileToolbar({
ok ? toast.success(t("browser.video.frameCopied")) : toast.error(t("browser.video.copyFrameFailed")),
);
};
- const copyName = () =>
- void copyToClipboard(entry.name).then((ok) => ok && toast.success(t("browser.video.nameCopied")));
- const extension = /\.([a-z0-9]+)$/i.exec(entry.name)?.[1]?.toUpperCase();
- const meta = [extension, blob ? formatBytes(blob.size) : null].filter(Boolean).join(" · ");
+ const copyPath = () => {
+ if (!blob) return;
+ void copyToClipboardFrom(() => withLocalCopy(blob, entry.name, (copy) => localCopyPath(copy.id))).then((ok) =>
+ ok ? toast.success(t("browser.file.pathCopied")) : toast.error(t("browser.file.copyFailed")),
+ );
+ };
+ const options: { label: string; icon: IconSvgElement; run: () => void }[] = [];
+ if (kind) options.push({ label: t("browser.file.copy"), icon: Copy01Icon, run: onCopyContents });
+ if (media === "image" && images) options.push({ label: t("imageViewer.copy"), icon: Copy01Icon, run: copyImage });
+ if (media === "video" && images) {
+ options.push({ label: t("browser.video.copyFrame"), icon: Copy01Icon, run: copyFrame });
+ }
+ if (isTauri) options.push({ label: t("browser.file.copyPath"), icon: Link01Icon, run: copyPath });
+ const [first, ...rest] = options;
+ if (!first) return null;
return (
- <>
- {/* As the panel narrows, back/forward and then Copy hide before the name does. */}
- <div className="hidden shrink-0 items-center gap-0.5 @[34rem]:flex">
- <IconButton
- label={t("browser.back")}
- disabled={tab.index === 0}
- onClick={() => goBack(tab.id)}
- className={NAV_BUTTON}
- >
- <ArrowLeft strokeWidth={NAV_STROKE} className={NAV_ICON} />
- </IconButton>
- <IconButton
- label={t("browser.forward")}
- disabled={tab.index >= tab.history.length - 1}
- onClick={() => goForward(tab.id)}
- className={NAV_BUTTON}
- >
- <ArrowRight strokeWidth={NAV_STROKE} className={NAV_ICON} />
- </IconButton>
- </div>
- <div
- title={entry.name}
- className={cn(PILL_SURFACE, "flex h-9 min-w-24 flex-1 items-center gap-2 rounded-full px-3.5")}
- >
- <KindIcon name={entry.name} contentType={entry.contentType} className="size-4.5" />
- <span className="min-w-0 truncate text-ui-13p5 text-foreground">{entry.name}</span>
- {meta ? (
- <span className="hidden shrink-0 text-ui-12 text-muted-foreground @[30rem]:inline">{meta}</span>
- ) : null}
- </div>
- {/* Without Copy frame (desktop app) the name is all there is to copy. */}
- <div className={cn(SPLIT_PILL, "hidden @[26rem]:flex")}>
- <Tooltip>
- <TooltipTrigger asChild={true}>
- <button
- type="button"
- aria-label={frameCopies ? t("browser.video.copyFrame") : t("browser.video.copyName")}
- onClick={frameCopies ? copyFrame : copyName}
- className={cn(SPLIT_PART, frameCopies ? "pl-2.5 pr-1" : "px-2.5")}
- >
- <HugeiconsIcon icon={Copy01Icon} strokeWidth={1.75} className="size-4.5" />
- </button>
- </TooltipTrigger>
- <TooltipContent side="bottom" className="tooltip-compact">
- {frameCopies ? t("browser.video.copyFrame") : t("browser.video.copyName")}
- </TooltipContent>
- </Tooltip>
- {frameCopies ? (
- <DropdownMenu>
- <DropdownMenuTrigger asChild={true}>
- <button type="button" aria-label={t("browser.video.copyOptions")} className={cn(SPLIT_PART, "pr-2 pl-1")}>
- <SplitChevron />
- </button>
- </DropdownMenuTrigger>
- <DropdownMenuContent align="end" sideOffset={6} className="browser-menu min-w-52 rounded-[20px] p-1.5">
- <DropdownMenuItem onSelect={copyFrame}>
- <HugeiconsIcon icon={Copy01Icon} strokeWidth={1.75} className="size-4" />
- {t("browser.video.copyFrame")}
- </DropdownMenuItem>
- <DropdownMenuItem onSelect={copyName}>
- <HugeiconsIcon icon={TextWrapIcon} strokeWidth={1.75} className="size-4" />
- {t("browser.video.copyName")}
- </DropdownMenuItem>
- </DropdownMenuContent>
- </DropdownMenu>
- ) : null}
- </div>
- <div className={SPLIT_PILL}>
- <button
- type="button"
- disabled={!blob}
- onClick={canOpenTab ? openInBrowser : save}
- title={canOpenTab ? t("browser.file.newBrowserTab") : t("browser.video.saveAs")}
- className={cn(SPLIT_PART, "gap-1.5 pr-1.5 pl-3")}
- >
- <HugeiconsIcon
- icon={canOpenTab ? ArrowUpRight01Icon : Download01Icon}
- strokeWidth={1.75}
- className="size-4.5"
- />
- {canOpenTab ? t("browser.video.open") : t("browser.video.saveAs")}
- </button>
+ <div className={cn(SPLIT_PILL, "hidden @[40rem]:flex")}>
+ <Tooltip>
+ <TooltipTrigger asChild={true}>
+ <button
+ type="button"
+ aria-label={first.label}
+ disabled={!blob}
+ onClick={first.run}
+ className={cn(SPLIT_PART, rest.length > 0 ? "pl-2.5 pr-1" : "px-2.5")}
+ >
+ <HugeiconsIcon icon={copied ? Tick02Icon : first.icon} strokeWidth={1.75} className="size-4.5" />
+ </button>
+ </TooltipTrigger>
+ <TooltipContent side="bottom" className="tooltip-compact">
+ {first.label}
+ </TooltipContent>
+ </Tooltip>
+ {rest.length > 0 ? (
<DropdownMenu>
<DropdownMenuTrigger asChild={true}>
<button
type="button"
disabled={!blob}
- aria-label={t("browser.video.openOptions")}
- className={cn(SPLIT_PART, "pr-2.5 pl-1")}
+ aria-label={t("browser.video.copyOptions")}
+ className={cn(SPLIT_PART, "pr-2 pl-1")}
>
<SplitChevron />
</button>
</DropdownMenuTrigger>
- <DropdownMenuContent align="end" sideOffset={6} className="browser-menu min-w-56 rounded-[20px] p-1.5">
- {canOpenTab ? (
- <DropdownMenuItem onSelect={openInBrowser}>
- <HugeiconsIcon icon={InternetIcon} strokeWidth={1.75} className="size-4.5" />
- {t("browser.file.newBrowserTab")}
+ <DropdownMenuContent align="end" sideOffset={6} className="browser-menu min-w-52 rounded-[20px] p-1.5">
+ {options.map((option) => (
+ <DropdownMenuItem key={option.label} onSelect={option.run}>
+ <HugeiconsIcon icon={option.icon} strokeWidth={1.75} className="size-4" />
+ {option.label}
</DropdownMenuItem>
- ) : null}
- <DropdownMenuItem onSelect={openInNewChat}>
- <HugeiconsIcon icon={BubbleChatAddIcon} strokeWidth={1.75} className="size-4.5" />
- {t("browser.file.newChat")}
- </DropdownMenuItem>
- <DropdownMenuSeparator />
- <DropdownMenuItem onSelect={save}>
- <HugeiconsIcon icon={Download01Icon} strokeWidth={1.75} className="size-4.5" />
- {t("browser.video.saveAs")}
- </DropdownMenuItem>
+ ))}
</DropdownMenuContent>
</DropdownMenu>
- </div>
- <DownloadsButton className={cn(TOOLBAR_ICON_BUTTON, NAV_BUTTON)} visible={visible} idleHidden={true} />
- <PanelMenu tab={tab} />
- </>
+ ) : null}
+ </div>
+ );
+}
+
+function AppIcon({ app }: { app: OpenWithApp }) {
+ return app.icon ? (
+ <img src={app.icon} alt="" aria-hidden={true} className="size-4.5 shrink-0" />
+ ) : (
+ <HugeiconsIcon icon={ArrowUpRight01Icon} strokeWidth={1.75} className="size-4.5" />
+ );
+}
+
+function OpenSplit({ entry, blob }: { entry: FileEntry; blob: Blob | undefined }) {
+ const t = useT();
+ const navigate = useNavigate();
+ const [apps, setApps] = useState<OpenWithApp[] | null>(null);
+ const listing = useRef(false);
+ // Programs and scripts never open from here (browser_open_with.rs); their folder still does.
+ const runsCode = isDangerousDownload(entry.name);
+ const tabType = isTauri ? null : browserTabType(entry.name, entry.contentType || blob?.type || "");
+ const failed = () => toast.error(t("browser.file.openFailed", { name: entry.name }));
+ const listApps = () => {
+ if (!isTauri || !blob || runsCode || listing.current) return;
+ listing.current = true;
+ withLocalCopy(blob, entry.name, (copy) => openWithApps(copy.id)).then(setApps, () => setApps([]));
+ };
+ const openWith = (app?: string) => {
+ if (!blob) return;
+ void withLocalCopy(blob, entry.name, (copy) => openLocalCopy(copy.id, app)).catch(failed);
+ };
+ const reveal = () => {
+ if (!blob) return;
+ void withLocalCopy(blob, entry.name, (copy) => revealLocalCopy(copy.id)).catch(failed);
+ };
+ const openInNewChat = () => {
+ if (!blob) return;
+ startLibraryChat(navigate, {
+ files: [new File([blob], entry.name, { type: entry.contentType || blob.type })],
+ });
+ };
+ const openInBrowser = () => {
+ if (!blob || !tabType) return;
+ const url = URL.createObjectURL(new Blob([blob], { type: tabType }));
+ window.open(url, "_blank", "noopener,noreferrer");
+ window.setTimeout(() => URL.revokeObjectURL(url), 60_000);
+ };
+ const defaultApp = apps?.find((app) => app.default) ?? null;
+ const primary = isTauri
+ ? runsCode
+ ? { label: t(revealLabelKey()), run: reveal }
+ : { label: t("browser.video.open"), run: () => openWith() }
+ : tabType
+ ? { label: t("browser.video.open"), run: openInBrowser }
+ : { label: t("browser.file.newChat"), run: openInNewChat };
+ return (
+ <div className={SPLIT_PILL} onPointerEnter={listApps} onFocus={listApps}>
+ <button
+ type="button"
+ disabled={!blob}
+ onClick={primary.run}
+ title={defaultApp ? defaultApp.name : undefined}
+ className={cn(SPLIT_PART, "gap-2 pr-1.5 pl-3")}
+ >
+ {defaultApp && !runsCode ? (
+ <AppIcon app={defaultApp} />
+ ) : (
+ <HugeiconsIcon
+ icon={isTauri && runsCode ? Folder01Icon : ArrowUpRight01Icon}
+ strokeWidth={1.75}
+ className="size-4.5"
+ />
+ )}
+ {primary.label}
+ </button>
+ <DropdownMenu onOpenChange={(open) => open && listApps()}>
+ <DropdownMenuTrigger asChild={true}>
+ <button
+ type="button"
+ disabled={!blob}
+ aria-label={t("browser.video.openOptions")}
+ className={cn(SPLIT_PART, "pr-2.5 pl-1")}
+ >
+ <SplitChevron />
+ </button>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end" sideOffset={6} className="browser-menu min-w-56 rounded-[20px] p-1.5">
+ {isTauri && !runsCode ? (
+ <>
+ {apps === null ? (
+ <div className="flex h-8 items-center px-2.5">
+ <Spinner className="size-4" />
+ </div>
+ ) : (
+ apps.map((app) => (
+ <DropdownMenuItem key={app.path} onSelect={() => openWith(app.path)}>
+ <AppIcon app={app} />
+ {app.name}
+ </DropdownMenuItem>
+ ))
+ )}
+ {apps?.length === 0 ? (
+ <DropdownMenuItem onSelect={() => openWith()}>
+ <HugeiconsIcon icon={ArrowUpRight01Icon} strokeWidth={1.75} className="size-4.5" />
+ {t("browser.video.open")}
+ </DropdownMenuItem>
+ ) : null}
+ <DropdownMenuSeparator />
+ </>
+ ) : null}
+ {isTauri ? (
+ <DropdownMenuItem onSelect={reveal}>
+ <HugeiconsIcon icon={Folder01Icon} strokeWidth={1.75} className="size-4.5" />
+ {t(revealLabelKey())}
+ </DropdownMenuItem>
+ ) : null}
+ {tabType ? (
+ <DropdownMenuItem onSelect={openInBrowser}>
+ <HugeiconsIcon icon={InternetIcon} strokeWidth={1.75} className="size-4.5" />
+ {t("browser.file.newBrowserTab")}
+ </DropdownMenuItem>
+ ) : null}
+ <DropdownMenuItem onSelect={openInNewChat}>
+ <HugeiconsIcon icon={BubbleChatAddIcon} strokeWidth={1.75} className="size-4.5" />
+ {t("browser.file.newChat")}
+ </DropdownMenuItem>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ </div>
);
}
@@ -2403,8 +2476,6 @@ export const BrowserPanel = memo(function BrowserPanel({ active = true }: { acti
{activeTab && activeEntry?.kind === "file" ? (
floatingFileControls ? (
<FloatingFileToolbar tab={activeTab} entry={activeEntry} visible={active} />
- ) : isVideoEntry(activeEntry) ? (
- <VideoFileToolbar tab={activeTab} entry={activeEntry} visible={active} />
) : (
<BrowserFileToolbar tab={activeTab} entry={activeEntry} visible={active} />
)
@@ -2412,7 +2483,7 @@ export const BrowserPanel = memo(function BrowserPanel({ active = true }: { acti
<WebToolbar tab={activeTab} visible={active} />
)}
</div>
- {floatingFileControls || (activeEntry?.kind === "file" && isVideoEntry(activeEntry)) ? null : (
+ {floatingFileControls ? null : (
<BookmarksBar tab={activeTab} />
)}
{deviceWidth ? <DeviceBar /> : null}
diff --git a/studio/frontend/src/features/browser/open-with.ts b/studio/frontend/src/features/browser/open-with.ts
new file mode 100644
index 00000000000..4d362c7d0d7
--- /dev/null
+++ b/studio/frontend/src/features/browser/open-with.ts
@@ -0,0 +1,58 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
+
+
+import { NATIVE_FILE_NAME_HEADER, encodeNativeFilename } from "@/lib/native-files";
+
+export type LocalCopy = { id: string; path: string };
+export type OpenWithApp = { path: string; name: string; icon: string | null; default: boolean };
+
+async function invoke<T>(command: string, args?: Record<string, unknown>): Promise<T> {
+ const core = await import("@tauri-apps/api/core");
+ return core.invoke<T>(command, args);
+}
+
+// By blob: a tab's bytes never change, so its copy is written once however often it is opened.
+const copies = new WeakMap<Blob, Map<string, Promise<LocalCopy>>>();
+
+export function localCopy(blob: Blob, name: string): Promise<LocalCopy> {
+ const byName = copies.get(blob) ?? new Map<string, Promise<LocalCopy>>();
+ copies.set(blob, byName);
+ const known = byName.get(name);
+ if (known) return known;
+ const pending = blob.arrayBuffer().then(async (bytes) => {
+ const core = await import("@tauri-apps/api/core");
+ return core.invoke<LocalCopy>("browser_file_local_copy", new Uint8Array(bytes), {
+ headers: { [NATIVE_FILE_NAME_HEADER]: encodeNativeFilename(name) },
+ });
+ });
+ byName.set(name, pending);
+ pending.catch(() => byName.delete(name));
+ return pending;
+}
+
+export async function withLocalCopy<T>(blob: Blob, name: string, use: (copy: LocalCopy) => Promise<T>): Promise<T> {
+ const pending = localCopy(blob, name);
+ try {
+ return await use(await pending);
+ } catch {
+ if (copies.get(blob)?.get(name) === pending) copies.get(blob)?.delete(name);
+ return use(await localCopy(blob, name));
+ }
+}
+
+export function openWithApps(id: string): Promise<OpenWithApp[]> {
+ return invoke<OpenWithApp[]>("browser_file_apps", { id });
+}
+
+export function openLocalCopy(id: string, app?: string): Promise<void> {
+ return invoke<void>("browser_file_open", { id, with: app ?? null });
+}
+
+export function localCopyPath(id: string): Promise<string> {
+ return invoke<string>("browser_file_path", { id });
+}
+
+export function revealLocalCopy(id: string): Promise<void> {
+ return invoke<void>("browser_file_reveal", { id });
+}
diff --git a/studio/frontend/src/features/browser/video-file.tsx b/studio/frontend/src/features/browser/video-file.tsx
index 5b9c824ccda..b1566a6c054 100644
--- a/studio/frontend/src/features/browser/video-file.tsx
+++ b/studio/frontend/src/features/browser/video-file.tsx
@@ -16,13 +16,15 @@ import { useT } from "@/i18n";
import { toast } from "@/lib/toast";
import { cn } from "@/lib/utils";
import {
- Maximize2Icon,
+ ArrowExpand01Icon,
+ ArrowShrink01Icon,
MoreHorizontalIcon,
PauseIcon,
PlayIcon,
- Volume2Icon,
- VolumeXIcon,
-} from "lucide-react";
+ VolumeHighIcon,
+ VolumeMute02Icon,
+} from "@hugeicons/core-free-icons";
+import { HugeiconsIcon } from "@hugeicons/react";
import { type KeyboardEvent, useEffect, useRef, useState } from "react";
import { canCopyVideoFrame, copyVideoFrame, registerTabVideo } from "./video-registry";
@@ -63,6 +65,7 @@ export function VideoFile({
const [volume, setVolume] = useState(1);
const [rate, setRate] = useState(1);
const [loop, setLoop] = useState(false);
+ const [fullscreened, setFullscreened] = useState(false);
useEffect(() => {
const video = videoRef.current;
@@ -70,6 +73,13 @@ export function VideoFile({
return registerTabVideo(tabId, video);
}, [tabId]);
+ // Esc and the browser's own controls leave fullscreen too, so follow the document, not the button.
+ useEffect(() => {
+ const sync = () => setFullscreened(document.fullscreenElement === rootRef.current);
+ document.addEventListener("fullscreenchange", sync);
+ return () => document.removeEventListener("fullscreenchange", sync);
+ }, []);
+
const video = () => videoRef.current;
const togglePlay = () => {
const el = video();
@@ -193,9 +203,9 @@ export function VideoFile({
className={CONTROL}
>
{playing ? (
- <PauseIcon className="size-4.5" strokeWidth={1.75} />
+ <HugeiconsIcon icon={PauseIcon} strokeWidth={1.75} className="size-4.5" />
) : (
- <PlayIcon className="size-4.5" strokeWidth={1.75} />
+ <HugeiconsIcon icon={PlayIcon} strokeWidth={1.75} className="size-4.5" />
)}
</button>
<input
@@ -240,16 +250,16 @@ export function VideoFile({
className={CONTROL}
>
{muted || volume === 0 ? (
- <VolumeXIcon className="size-4.5" strokeWidth={1.75} />
+ <HugeiconsIcon icon={VolumeMute02Icon} strokeWidth={1.75} className="size-4.5" />
) : (
- <Volume2Icon className="size-4.5" strokeWidth={1.75} />
+ <HugeiconsIcon icon={VolumeHighIcon} strokeWidth={1.75} className="size-4.5" />
)}
</button>
</div>
<DropdownMenu>
<DropdownMenuTrigger asChild={true}>
<button type="button" aria-label={t("browser.video.more")} className={cn(CONTROL, "aria-expanded:bg-[color-mix(in_oklab,var(--foreground)_8%,transparent)]")}>
- <MoreHorizontalIcon className="size-4.5" strokeWidth={1.75} />
+ <HugeiconsIcon icon={MoreHorizontalIcon} strokeWidth={1.75} className="size-4.5" />
</button>
</DropdownMenuTrigger>
<DropdownMenuContent
@@ -286,8 +296,17 @@ export function VideoFile({
) : null}
</DropdownMenuContent>
</DropdownMenu>
- <button type="button" aria-label={t("browser.video.fullscreen")} onClick={fullscreen} className={CONTROL}>
- <Maximize2Icon className="size-4" strokeWidth={1.75} />
+ <button
+ type="button"
+ aria-label={fullscreened ? t("browser.video.exitFullscreen") : t("browser.video.fullscreen")}
+ onClick={fullscreen}
+ className={CONTROL}
+ >
+ <HugeiconsIcon
+ icon={fullscreened ? ArrowShrink01Icon : ArrowExpand01Icon}
+ strokeWidth={1.75}
+ className="size-4.5"
+ />
</button>
</div>
</div>
diff --git a/studio/frontend/src/features/chat/lib/attachment-file-kind.ts b/studio/frontend/src/features/chat/lib/attachment-file-kind.ts
index 0f4452b08be..333b0302752 100644
--- a/studio/frontend/src/features/chat/lib/attachment-file-kind.ts
+++ b/studio/frontend/src/features/chat/lib/attachment-file-kind.ts
@@ -4,7 +4,6 @@
// Name and MIME type only: the bytes can be megabytes and this runs on every tile and row.
import {
- AudioWave01Icon,
Doc01Icon,
FileEmpty02Icon,
FlimSlateIcon,
@@ -15,7 +14,7 @@ import {
Zip02Icon,
} from "@hugeicons/core-free-icons";
// Relative so the node tests can load this file.
-import { SheetIcon } from "../../../lib/hugeicons-derived.ts";
+import { AiSpeechIcon, SheetIcon } from "../../../lib/hugeicons-derived.ts";
export type AttachmentFileKind =
| "image"
@@ -102,7 +101,7 @@ export function attachmentFileKind(
export const ATTACHMENT_KIND_ICONS = {
image: Image02Icon,
pdf: Pdf01Icon,
- audio: AudioWave01Icon,
+ audio: AiSpeechIcon,
video: FlimSlateIcon,
word: Doc01Icon,
document: FileEmpty02Icon,
diff --git a/studio/frontend/src/features/library/components/library-toolbar.tsx b/studio/frontend/src/features/library/components/library-toolbar.tsx
index e379e4ab825..429e411d542 100644
--- a/studio/frontend/src/features/library/components/library-toolbar.tsx
+++ b/studio/frontend/src/features/library/components/library-toolbar.tsx
@@ -11,7 +11,6 @@ import {
} from "@/components/ui/dropdown-menu";
import {
AiEditingIcon,
- AudioWave01Icon,
FileEmpty02Icon,
FilterMailIcon,
FlimSlateIcon,
@@ -29,7 +28,7 @@ import {
} from "@hugeicons/core-free-icons";
import { type TranslationKey, useT } from "@/i18n";
import { ChevronDownStandardIcon } from "@/lib/chevron-icons";
-import { SheetIcon, TestTubeOutlineIcon } from "@/lib/hugeicons-derived";
+import { AiSpeechIcon, SheetIcon, TestTubeOutlineIcon } from "@/lib/hugeicons-derived";
import { cn } from "@/lib/utils";
import { HugeiconsIcon, type IconSvgElement } from "@hugeicons/react";
import { ArrowDownUpIcon } from "lucide-react";
@@ -57,7 +56,7 @@ const SOURCE_OPTIONS: MenuOption<LibrarySource>[] = [
const TYPE_OPTIONS: MenuOption<LibraryTypeFilter>[] = [
{ value: "images", label: "library.tabs.images", icon: Image02Icon },
{ value: "videos", label: "library.tabs.videos", icon: FlimSlateIcon },
- { value: "audio", label: "library.tabs.audio", icon: AudioWave01Icon },
+ { value: "audio", label: "library.tabs.audio", icon: AiSpeechIcon },
{ value: "documents", label: "library.toolbar.documents", icon: FileEmpty02Icon },
{ value: "spreadsheets", label: "library.toolbar.spreadsheets", icon: SheetIcon },
{ value: "presentations", label: "library.toolbar.presentations", icon: Presentation01Icon },
@@ -292,7 +291,7 @@ const NEW_OPTIONS: MenuOption<NewAction>[] = [
{ value: "note", label: "library.create.note", icon: Note01Icon },
{ value: "image", label: "library.create.image", icon: Image02Icon },
{ value: "video", label: "library.create.video", icon: FlimSlateIcon },
- { value: "audio", label: "library.create.audio", icon: AudioWave01Icon },
+ { value: "audio", label: "library.create.audio", icon: AiSpeechIcon },
{ value: "model", label: "library.create.model", icon: TestTubeOutlineIcon },
{ value: "folder", label: "library.create.folder", icon: Folder01Icon },
];
diff --git a/studio/frontend/src/features/library/file-kind.ts b/studio/frontend/src/features/library/file-kind.ts
index 87c88817707..da1f42a1ce8 100644
--- a/studio/frontend/src/features/library/file-kind.ts
+++ b/studio/frontend/src/features/library/file-kind.ts
@@ -2,7 +2,6 @@
// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
import {
- AudioWave01Icon,
Doc01Icon,
FileEmpty02Icon,
FlimSlateIcon,
@@ -11,7 +10,7 @@ import {
Presentation01Icon,
SourceCodeIcon,
} from "@hugeicons/core-free-icons";
-import { SheetIcon, TestTubeOutlineIcon } from "@/lib/hugeicons-derived";
+import { AiSpeechIcon, SheetIcon, TestTubeOutlineIcon } from "@/lib/hugeicons-derived";
import type { IconSvgElement } from "@hugeicons/react";
import { documentKind } from "@/components/file-viewer/kind";
import { attachmentFileKind } from "@/features/chat/lib/attachment-file-kind";
@@ -175,7 +174,7 @@ export const KIND_ICONS: Record<LibraryFileKind, IconSvgElement> = {
presentation: Presentation01Icon,
pdf: Pdf01Icon,
code: SourceCodeIcon,
- audio: AudioWave01Icon,
+ audio: AiSpeechIcon,
video: FlimSlateIcon,
model: TestTubeOutlineIcon,
};
diff --git a/studio/frontend/src/features/library/library-page.tsx b/studio/frontend/src/features/library/library-page.tsx
index 96713da2a30..d7bb0c5a711 100644
--- a/studio/frontend/src/features/library/library-page.tsx
+++ b/studio/frontend/src/features/library/library-page.tsx
@@ -24,7 +24,6 @@ import { type TranslationKey, useT } from "@/i18n";
import { cn } from "@/lib/utils";
import { toast } from "@/lib/toast";
import {
- AudioWave01Icon,
Cancel01Icon,
FlimSlateIcon,
Delete02Icon,
@@ -37,7 +36,7 @@ import {
Upload01Icon,
} from "@hugeicons/core-free-icons";
import { ChevronRightStandardIcon } from "@/lib/chevron-icons";
-import { MessageCircleIcon, StarPointedIcon, TestTubeOutlineIcon } from "@/lib/hugeicons-derived";
+import { AiSpeechIcon, MessageCircleIcon, StarPointedIcon, TestTubeOutlineIcon } from "@/lib/hugeicons-derived";
import { HugeiconsIcon } from "@hugeicons/react";
import { useNavigate, useRouter, useSearch } from "@tanstack/react-router";
import { type ReactNode, useCallback, useEffect, useMemo, useRef, useState } from "react";
@@ -110,7 +109,7 @@ const EMPTY_COPY: Record<LibraryTab, EmptyCopy> = {
folders: [Folder01Icon, "library.empty.foldersTitle", "library.empty.foldersDescription"],
images: [Image02Icon, "library.empty.imagesTitle", "library.empty.imagesDescription"],
videos: [FlimSlateIcon, "library.empty.videosTitle", "library.empty.videosDescription"],
- audio: [AudioWave01Icon, "library.empty.audioTitle", "library.empty.audioDescription"],
+ audio: [AiSpeechIcon, "library.empty.audioTitle", "library.empty.audioDescription"],
models: [TestTubeOutlineIcon, "library.empty.modelsTitle", "library.empty.modelsDescription"],
all: [Upload01Icon, "library.empty.suggestedTitle", "library.empty.suggestedDescription"],
chats: [MessageCircleIcon, "library.chats.empty.chatsTitle", "library.chats.empty.chatsDescription"],
diff --git a/studio/frontend/src/features/model-picker/components/model-selector/pickers.tsx b/studio/frontend/src/features/model-picker/components/model-selector/pickers.tsx
index 0add7d4d708..b6d915817ff 100644
--- a/studio/frontend/src/features/model-picker/components/model-selector/pickers.tsx
+++ b/studio/frontend/src/features/model-picker/components/model-selector/pickers.tsx
@@ -123,7 +123,6 @@ import { checkVramFit, estimateLoadingVram } from "@/lib/vram";
import {
Add01Icon,
ArrowUpDownIcon,
- AudioWave01Icon,
Cancel01Icon,
Copy01Icon,
DashboardCircleIcon,
@@ -139,6 +138,7 @@ import {
Settings02Icon,
ViewIcon,
} from "@hugeicons/core-free-icons";
+import { AiSpeechIcon } from "@/lib/hugeicons-derived";
import { HugeiconsIcon } from "@hugeicons/react";
import { useNavigate } from "@tanstack/react-router";
import { ChevronDownIcon, ChevronRightIcon } from "lucide-react";
@@ -560,7 +560,7 @@ const CAPABILITY_BADGES: {
// vision indigo's lightness and chroma, as sky-300 read brighter than the tags beside it.
tone: "text-[oklch(0.5_0.08_190)] dark:text-[oklch(0.78_0.08_190)]",
Glyph: (props) => (
- <HugeiconsIcon icon={AudioWave01Icon} strokeWidth={1.8} {...props} />
+ <HugeiconsIcon icon={AiSpeechIcon} strokeWidth={1.8} {...props} />
),
},
];
diff --git a/studio/frontend/src/features/settings/components/archived-media-dialog.tsx b/studio/frontend/src/features/settings/components/archived-media-dialog.tsx
index c89b5be00d8..5c8b279dae3 100644
--- a/studio/frontend/src/features/settings/components/archived-media-dialog.tsx
+++ b/studio/frontend/src/features/settings/components/archived-media-dialog.tsx
@@ -2,11 +2,11 @@
// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
import {
- AudioWave01Icon,
Delete02Icon,
Image03Icon,
FlimSlateIcon,
} from "@hugeicons/core-free-icons";
+import { AiSpeechIcon } from "@/lib/hugeicons-derived";
import { HugeiconsIcon } from "@hugeicons/react";
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
@@ -626,7 +626,7 @@ export function ArchivedMediaView({ kind }: { kind: ArchivedMediaKind }) {
<HugeiconsIcon
icon={
isAudio
- ? AudioWave01Icon
+ ? AiSpeechIcon
: isImages
? Image03Icon
: FlimSlateIcon
diff --git a/studio/frontend/src/features/settings/components/sidebar-nav-customizer.tsx b/studio/frontend/src/features/settings/components/sidebar-nav-customizer.tsx
index dff63c7a11b..2d76a98d746 100644
--- a/studio/frontend/src/features/settings/components/sidebar-nav-customizer.tsx
+++ b/studio/frontend/src/features/settings/components/sidebar-nav-customizer.tsx
@@ -2,7 +2,6 @@
// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
import {
- AudioWave01Icon,
ChefHatIcon,
DashboardCircleIcon,
Download01Icon,
@@ -18,7 +17,7 @@ import {
import { HugeiconsIcon } from "@hugeicons/react";
import { Reorder, useDragControls } from "motion/react";
import { Switch } from "@/components/ui/switch";
-import { TestTubeOutlineIcon } from "@/lib/hugeicons-derived";
+import { AiSpeechIcon, TestTubeOutlineIcon } from "@/lib/hugeicons-derived";
import { useT } from "@/i18n";
import type { TranslationKey } from "@/i18n";
import type { IconSvgElement } from "@hugeicons/react";
@@ -41,7 +40,7 @@ const ITEM_META: Record<
images: { icon: Image03Icon, labelKey: "shell.navigation.images" },
train: { icon: TestTubeOutlineIcon, labelKey: "shell.navigation.train" },
video: { icon: FlimSlateIcon, labelKey: "shell.navigation.video" },
- audio: { icon: AudioWave01Icon, labelKey: "shell.navigation.audio" },
+ audio: { icon: AiSpeechIcon, labelKey: "shell.navigation.audio" },
recipes: { icon: ChefHatIcon, labelKey: "shell.navigation.recipes" },
export: { icon: Download01Icon, labelKey: "shell.navigation.export" },
api: { icon: ApiIcon, labelKey: "shell.navigation.api" },
diff --git a/studio/frontend/src/features/settings/tabs/data-tab.tsx b/studio/frontend/src/features/settings/tabs/data-tab.tsx
index ca874742869..80a7da89866 100644
--- a/studio/frontend/src/features/settings/tabs/data-tab.tsx
+++ b/studio/frontend/src/features/settings/tabs/data-tab.tsx
@@ -77,7 +77,6 @@ import { isDownloadCancelled, pickNativeChatImport } from "@/lib/native-files";
import { toast } from "@/lib/toast";
import {
Archive02Icon,
- AudioWave01Icon,
Delete02Icon,
Download01Icon,
FlimSlateIcon,
@@ -89,7 +88,7 @@ import {
import {
ChevronLeftIcon,
} from "lucide-react";
-import { MessageCircleIcon } from "@/lib/hugeicons-derived";
+import { AiSpeechIcon, MessageCircleIcon } from "@/lib/hugeicons-derived";
import { HugeiconsIcon } from "@hugeicons/react";
import { useNavigate, useRouterState } from "@tanstack/react-router";
import { useEffect, useRef, useState } from "react";
@@ -851,7 +850,7 @@ export function DataTab({ searchEntry }: { searchEntry?: string }) {
"archived-audio",
"archivedAudio",
"shell.navigation.audio",
- AudioWave01Icon,
+ AiSpeechIcon,
],
] as const).map(([page, label, shortLabel, icon]) => (
<button
diff --git a/studio/frontend/src/features/settings/tabs/voice-tab.tsx b/studio/frontend/src/features/settings/tabs/voice-tab.tsx
index da875b97335..2dd77364f40 100644
--- a/studio/frontend/src/features/settings/tabs/voice-tab.tsx
+++ b/studio/frontend/src/features/settings/tabs/voice-tab.tsx
@@ -59,9 +59,9 @@ import { ChevronDownStandardIcon } from "@/lib/chevron-icons";
import { MicIcon } from "@/lib/mic-icon";
import { toast } from "@/lib/toast";
import {
- AudioWave01Icon,
Search01Icon,
} from "@hugeicons/core-free-icons";
+import { AiSpeechIcon } from "@/lib/hugeicons-derived";
import { Volume02Icon } from "@/lib/volume-icons";
import { HugeiconsIcon } from "@hugeicons/react";
import { useNavigate } from "@tanstack/react-router";
@@ -1699,7 +1699,7 @@ export function VoiceTab() {
}}
>
<HugeiconsIcon
- icon={AudioWave01Icon}
+ icon={AiSpeechIcon}
className="mr-1.5 size-3.5"
/>
{t("settings.voice.readAloud.openAudioAction")}
diff --git a/studio/frontend/src/i18n/locales/ar.ts b/studio/frontend/src/i18n/locales/ar.ts
index 6e482ef2f2b..7469e61c64f 100644
--- a/studio/frontend/src/i18n/locales/ar.ts
+++ b/studio/frontend/src/i18n/locales/ar.ts
@@ -292,15 +292,13 @@ export const ar = {
loop: "تكرار",
pictureInPicture: "صورة داخل صورة",
fullscreen: "ملء الشاشة",
+ exitFullscreen: "الخروج من ملء الشاشة",
copyFrame: "نسخ الإطار",
frameCopied: "تم نسخ الإطار",
copyFrameFailed: "تعذّر نسخ الإطار.",
- copyName: "نسخ اسم الملف",
- nameCopied: "تم نسخ اسم الملف",
copyOptions: "خيارات النسخ",
open: "فتح",
openOptions: "خيارات الفتح",
- saveAs: "حفظ باسم…",
},
file: {
openIn: "فتح في",
@@ -316,6 +314,9 @@ export const ar = {
copy: "نسخ المحتوى",
copied: "تم النسخ",
copyFailed: "تعذّر نسخ الملف.",
+ copyPath: "نسخ المسار",
+ pathCopied: "تم نسخ المسار",
+ openFailed: "تعذر فتح {name}.",
wrap: "التفاف الأسطر",
},
pages: {
diff --git a/studio/frontend/src/i18n/locales/de.ts b/studio/frontend/src/i18n/locales/de.ts
index e61373d99d9..7ca318f40dc 100644
--- a/studio/frontend/src/i18n/locales/de.ts
+++ b/studio/frontend/src/i18n/locales/de.ts
@@ -292,15 +292,13 @@ export const de = {
loop: "Wiederholen",
pictureInPicture: "Bild im Bild",
fullscreen: "Vollbild",
+ exitFullscreen: "Vollbild beenden",
copyFrame: "Frame kopieren",
frameCopied: "Frame kopiert",
copyFrameFailed: "Der Frame konnte nicht kopiert werden.",
- copyName: "Dateinamen kopieren",
- nameCopied: "Dateiname kopiert",
copyOptions: "Kopieroptionen",
open: "Öffnen",
openOptions: "Öffnen-Optionen",
- saveAs: "Speichern unter…",
},
file: {
openIn: "Öffnen in",
@@ -316,6 +314,9 @@ export const de = {
copy: "Inhalt kopieren",
copied: "Kopiert",
copyFailed: "Die Datei konnte nicht kopiert werden.",
+ copyPath: "Pfad kopieren",
+ pathCopied: "Pfad kopiert",
+ openFailed: "{name} konnte nicht geöffnet werden.",
wrap: "Zeilen umbrechen",
},
pages: {
diff --git a/studio/frontend/src/i18n/locales/en.ts b/studio/frontend/src/i18n/locales/en.ts
index d4fd075d72b..c313a8aa9a9 100644
--- a/studio/frontend/src/i18n/locales/en.ts
+++ b/studio/frontend/src/i18n/locales/en.ts
@@ -290,6 +290,9 @@ export const en = {
copy: "Copy contents",
copied: "Copied",
copyFailed: "Couldn't copy the file.",
+ copyPath: "Copy path",
+ pathCopied: "Path copied",
+ openFailed: "Couldn't open {name}.",
wrap: "Wrap lines",
},
video: {
@@ -305,15 +308,13 @@ export const en = {
loop: "Loop",
pictureInPicture: "Picture in picture",
fullscreen: "Full screen",
+ exitFullscreen: "Exit full screen",
copyFrame: "Copy frame",
frameCopied: "Frame copied",
copyFrameFailed: "Couldn't copy the frame.",
- copyName: "Copy file name",
- nameCopied: "File name copied",
copyOptions: "Copy options",
open: "Open",
openOptions: "Open options",
- saveAs: "Save as…",
},
pages: {
searchDownloads: "Search download history",
diff --git a/studio/frontend/src/i18n/locales/es.ts b/studio/frontend/src/i18n/locales/es.ts
index cf3d4fcbedd..463a4881d39 100644
--- a/studio/frontend/src/i18n/locales/es.ts
+++ b/studio/frontend/src/i18n/locales/es.ts
@@ -292,15 +292,13 @@ export const es = {
loop: "Repetir",
pictureInPicture: "Imagen en imagen",
fullscreen: "Pantalla completa",
+ exitFullscreen: "Salir de pantalla completa",
copyFrame: "Copiar fotograma",
frameCopied: "Fotograma copiado",
copyFrameFailed: "No se pudo copiar el fotograma.",
- copyName: "Copiar nombre de archivo",
- nameCopied: "Nombre de archivo copiado",
copyOptions: "Opciones de copia",
open: "Abrir",
openOptions: "Opciones de apertura",
- saveAs: "Guardar como…",
},
file: {
openIn: "Abrir en",
@@ -316,6 +314,9 @@ export const es = {
copy: "Copiar contenido",
copied: "Copiado",
copyFailed: "No se pudo copiar el archivo.",
+ copyPath: "Copiar ruta",
+ pathCopied: "Ruta copiada",
+ openFailed: "No se pudo abrir {name}.",
wrap: "Ajustar líneas",
},
pages: {
diff --git a/studio/frontend/src/i18n/locales/fr.ts b/studio/frontend/src/i18n/locales/fr.ts
index 6bfa7fe162b..f277e3fe46f 100644
--- a/studio/frontend/src/i18n/locales/fr.ts
+++ b/studio/frontend/src/i18n/locales/fr.ts
@@ -292,15 +292,13 @@ export const fr = {
loop: "Lecture en boucle",
pictureInPicture: "Image dans l’image",
fullscreen: "Plein écran",
+ exitFullscreen: "Quitter le plein écran",
copyFrame: "Copier l’image",
frameCopied: "Image copiée",
copyFrameFailed: "Impossible de copier l’image.",
- copyName: "Copier le nom du fichier",
- nameCopied: "Nom du fichier copié",
copyOptions: "Options de copie",
open: "Ouvrir",
openOptions: "Options d’ouverture",
- saveAs: "Enregistrer sous…",
},
file: {
openIn: "Ouvrir dans",
@@ -316,6 +314,9 @@ export const fr = {
copy: "Copier le contenu",
copied: "Copié",
copyFailed: "Impossible de copier le fichier.",
+ copyPath: "Copier le chemin",
+ pathCopied: "Chemin copié",
+ openFailed: "Impossible d'ouvrir {name}.",
wrap: "Retour à la ligne",
},
pages: {
diff --git a/studio/frontend/src/i18n/locales/he.ts b/studio/frontend/src/i18n/locales/he.ts
index 5897fa51465..26acd615299 100644
--- a/studio/frontend/src/i18n/locales/he.ts
+++ b/studio/frontend/src/i18n/locales/he.ts
@@ -302,15 +302,13 @@ export const he = {
loop: "הפעלה חוזרת",
pictureInPicture: "תמונה בתוך תמונה",
fullscreen: "מסך מלא",
+ exitFullscreen: "יציאה ממסך מלא",
copyFrame: "העתק פריים",
frameCopied: "הפריים הועתק",
copyFrameFailed: "לא ניתן להעתיק את הפריים.",
- copyName: "העתק שם קובץ",
- nameCopied: "שם הקובץ הועתק",
copyOptions: "אפשרויות העתקה",
open: "פתח",
openOptions: "אפשרויות פתיחה",
- saveAs: "שמור בשם…",
},
file: {
openIn: "פתח ב",
@@ -326,6 +324,9 @@ export const he = {
copy: "העתק תוכן",
copied: "הועתק",
copyFailed: "העתקת הקובץ נכשלה.",
+ copyPath: "העתקת נתיב",
+ pathCopied: "הנתיב הועתק",
+ openFailed: "לא ניתן לפתוח את {name}.",
wrap: "גלישת שורות",
},
pages: {
diff --git a/studio/frontend/src/i18n/locales/hi.ts b/studio/frontend/src/i18n/locales/hi.ts
index 724830ee038..73e94f9d427 100644
--- a/studio/frontend/src/i18n/locales/hi.ts
+++ b/studio/frontend/src/i18n/locales/hi.ts
@@ -292,15 +292,13 @@ export const hi = {
loop: "लूप",
pictureInPicture: "पिक्चर इन पिक्चर",
fullscreen: "फ़ुल स्क्रीन",
+ exitFullscreen: "पूर्ण स्क्रीन से बाहर निकलें",
copyFrame: "फ़्रेम कॉपी करें",
frameCopied: "फ़्रेम कॉपी हो गया",
copyFrameFailed: "फ़्रेम कॉपी नहीं हो सका।",
- copyName: "फ़ाइल का नाम कॉपी करें",
- nameCopied: "फ़ाइल का नाम कॉपी हो गया",
copyOptions: "कॉपी विकल्प",
open: "खोलें",
openOptions: "खोलने के विकल्प",
- saveAs: "इस रूप में सहेजें…",
},
file: {
openIn: "इसमें खोलें",
@@ -316,6 +314,9 @@ export const hi = {
copy: "सामग्री कॉपी करें",
copied: "कॉपी हो गया",
copyFailed: "फ़ाइल कॉपी नहीं हो सकी।",
+ copyPath: "पथ कॉपी करें",
+ pathCopied: "पथ कॉपी किया गया",
+ openFailed: "{name} नहीं खोला जा सका।",
wrap: "लाइनें रैप करें",
},
pages: {
diff --git a/studio/frontend/src/i18n/locales/it.ts b/studio/frontend/src/i18n/locales/it.ts
index 3341a49b08d..955707517f7 100644
--- a/studio/frontend/src/i18n/locales/it.ts
+++ b/studio/frontend/src/i18n/locales/it.ts
@@ -291,15 +291,13 @@ export const it = {
loop: "Ripeti",
pictureInPicture: "Picture in picture",
fullscreen: "Schermo intero",
+ exitFullscreen: "Esci da schermo intero",
copyFrame: "Copia fotogramma",
frameCopied: "Fotogramma copiato",
copyFrameFailed: "Impossibile copiare il fotogramma.",
- copyName: "Copia nome file",
- nameCopied: "Nome file copiato",
copyOptions: "Opzioni di copia",
open: "Apri",
openOptions: "Opzioni di apertura",
- saveAs: "Salva con nome…",
},
file: {
openIn: "Apri in",
@@ -315,6 +313,9 @@ export const it = {
copy: "Copia contenuto",
copied: "Copiato",
copyFailed: "Impossibile copiare il file.",
+ copyPath: "Copia percorso",
+ pathCopied: "Percorso copiato",
+ openFailed: "Impossibile aprire {name}.",
wrap: "A capo automatico",
},
pages: {
diff --git a/studio/frontend/src/i18n/locales/ja.ts b/studio/frontend/src/i18n/locales/ja.ts
index a8f8301e110..8a914361437 100644
--- a/studio/frontend/src/i18n/locales/ja.ts
+++ b/studio/frontend/src/i18n/locales/ja.ts
@@ -293,15 +293,13 @@ export const ja = {
loop: "ループ",
pictureInPicture: "ピクチャーインピクチャー",
fullscreen: "全画面表示",
+ exitFullscreen: "全画面表示を終了",
copyFrame: "フレームをコピー",
frameCopied: "フレームをコピーしました",
copyFrameFailed: "フレームをコピーできませんでした。",
- copyName: "ファイル名をコピー",
- nameCopied: "ファイル名をコピーしました",
copyOptions: "コピーのオプション",
open: "開く",
openOptions: "開くオプション",
- saveAs: "名前を付けて保存…",
},
file: {
openIn: "開く場所",
@@ -317,6 +315,9 @@ export const ja = {
copy: "内容をコピー",
copied: "コピーしました",
copyFailed: "ファイルをコピーできませんでした。",
+ copyPath: "パスをコピー",
+ pathCopied: "パスをコピーしました",
+ openFailed: "{name} を開けませんでした。",
wrap: "行を折り返す",
},
pages: {
diff --git a/studio/frontend/src/i18n/locales/ko.ts b/studio/frontend/src/i18n/locales/ko.ts
index 426eab0c197..77dbdb3f79b 100644
--- a/studio/frontend/src/i18n/locales/ko.ts
+++ b/studio/frontend/src/i18n/locales/ko.ts
@@ -292,15 +292,13 @@ export const ko = {
loop: "반복",
pictureInPicture: "PIP 모드",
fullscreen: "전체 화면",
+ exitFullscreen: "전체 화면 종료",
copyFrame: "프레임 복사",
frameCopied: "프레임 복사됨",
copyFrameFailed: "프레임을 복사하지 못했습니다.",
- copyName: "파일 이름 복사",
- nameCopied: "파일 이름 복사됨",
copyOptions: "복사 옵션",
open: "열기",
openOptions: "열기 옵션",
- saveAs: "다른 이름으로 저장…",
},
file: {
openIn: "열기 위치",
@@ -316,6 +314,9 @@ export const ko = {
copy: "내용 복사",
copied: "복사됨",
copyFailed: "파일을 복사하지 못했습니다.",
+ copyPath: "경로 복사",
+ pathCopied: "경로를 복사했습니다",
+ openFailed: "{name}을(를) 열 수 없습니다.",
wrap: "줄 바꿈",
},
pages: {
diff --git a/studio/frontend/src/i18n/locales/pt-br.ts b/studio/frontend/src/i18n/locales/pt-br.ts
index d0e66ca8809..30d88268118 100644
--- a/studio/frontend/src/i18n/locales/pt-br.ts
+++ b/studio/frontend/src/i18n/locales/pt-br.ts
@@ -292,15 +292,13 @@ export const ptBR = {
loop: "Repetir",
pictureInPicture: "Picture-in-picture",
fullscreen: "Tela cheia",
+ exitFullscreen: "Sair da tela cheia",
copyFrame: "Copiar quadro",
frameCopied: "Quadro copiado",
copyFrameFailed: "Não foi possível copiar o quadro.",
- copyName: "Copiar nome do arquivo",
- nameCopied: "Nome do arquivo copiado",
copyOptions: "Opções de cópia",
open: "Abrir",
openOptions: "Opções de abertura",
- saveAs: "Salvar como…",
},
file: {
openIn: "Abrir em",
@@ -316,6 +314,9 @@ export const ptBR = {
copy: "Copiar conteúdo",
copied: "Copiado",
copyFailed: "Não foi possível copiar o arquivo.",
+ copyPath: "Copiar caminho",
+ pathCopied: "Caminho copiado",
+ openFailed: "Não foi possível abrir {name}.",
wrap: "Quebrar linhas",
},
pages: {
diff --git a/studio/frontend/src/i18n/locales/ru.ts b/studio/frontend/src/i18n/locales/ru.ts
index 3541f051770..b981add2e28 100644
--- a/studio/frontend/src/i18n/locales/ru.ts
+++ b/studio/frontend/src/i18n/locales/ru.ts
@@ -292,15 +292,13 @@ export const ru = {
loop: "Повтор",
pictureInPicture: "Картинка в картинке",
fullscreen: "Полноэкранный режим",
+ exitFullscreen: "Выйти из полноэкранного режима",
copyFrame: "Копировать кадр",
frameCopied: "Кадр скопирован",
copyFrameFailed: "Не удалось скопировать кадр.",
- copyName: "Копировать имя файла",
- nameCopied: "Имя файла скопировано",
copyOptions: "Параметры копирования",
open: "Открыть",
openOptions: "Параметры открытия",
- saveAs: "Сохранить как…",
},
file: {
openIn: "Открыть в",
@@ -316,6 +314,9 @@ export const ru = {
copy: "Копировать содержимое",
copied: "Скопировано",
copyFailed: "Не удалось скопировать файл.",
+ copyPath: "Копировать путь",
+ pathCopied: "Путь скопирован",
+ openFailed: "Не удалось открыть {name}.",
wrap: "Переносить строки",
},
pages: {
diff --git a/studio/frontend/src/i18n/locales/sv.ts b/studio/frontend/src/i18n/locales/sv.ts
index 38d508f10cb..e4699bb2d47 100644
--- a/studio/frontend/src/i18n/locales/sv.ts
+++ b/studio/frontend/src/i18n/locales/sv.ts
@@ -304,15 +304,13 @@ export const sv = {
loop: "Upprepa",
pictureInPicture: "Bild-i-bild",
fullscreen: "Helskärm",
+ exitFullscreen: "Avsluta helskärm",
copyFrame: "Kopiera bildruta",
frameCopied: "Bildrutan har kopierats",
copyFrameFailed: "Det gick inte att kopiera bildrutan.",
- copyName: "Kopiera filnamn",
- nameCopied: "Filnamnet har kopierats",
copyOptions: "Kopieringsalternativ",
open: "Öppna",
openOptions: "Alternativ för att öppna",
- saveAs: "Spara som…",
},
file: {
openIn: "Öppna i",
@@ -328,6 +326,9 @@ export const sv = {
copy: "Kopiera innehåll",
copied: "Kopierat",
copyFailed: "Det gick inte att kopiera filen.",
+ copyPath: "Kopiera sökväg",
+ pathCopied: "Sökvägen kopierad",
+ openFailed: "Det gick inte att öppna {name}.",
wrap: "Radbryt",
},
pages: {
diff --git a/studio/frontend/src/i18n/locales/zh-CN.ts b/studio/frontend/src/i18n/locales/zh-CN.ts
index d9523b6e745..ecad60a4de5 100644
--- a/studio/frontend/src/i18n/locales/zh-CN.ts
+++ b/studio/frontend/src/i18n/locales/zh-CN.ts
@@ -292,15 +292,13 @@ export const zhCN = {
loop: "循环播放",
pictureInPicture: "画中画",
fullscreen: "全屏",
+ exitFullscreen: "退出全屏",
copyFrame: "复制帧",
frameCopied: "已复制帧",
copyFrameFailed: "无法复制帧。",
- copyName: "复制文件名",
- nameCopied: "已复制文件名",
copyOptions: "复制选项",
open: "打开",
openOptions: "打开选项",
- saveAs: "另存为…",
},
file: {
openIn: "打开方式",
@@ -316,6 +314,9 @@ export const zhCN = {
copy: "复制内容",
copied: "已复制",
copyFailed: "无法复制文件。",
+ copyPath: "复制路径",
+ pathCopied: "已复制路径",
+ openFailed: "无法打开 {name}。",
wrap: "自动换行",
},
pages: {
diff --git a/studio/frontend/src/index.css b/studio/frontend/src/index.css
index a02f031274d..7acfe0cc7ee 100644
--- a/studio/frontend/src/index.css
+++ b/studio/frontend/src/index.css
@@ -5073,6 +5073,14 @@ html.force-reduced-motion .sidebar-section-drop-line {
display: none;
}
+.media-lightbox-overlay {
+ background: color-mix(in oklab, color-mix(in oklab, var(--background), black 7%) 64%, transparent);
+}
+
+.dark .media-lightbox-overlay {
+ background: color-mix(in oklab, color-mix(in oklab, var(--background), black 45%) 78%, transparent);
+}
+
/* Video tabs: the clip sits on a soft brand-tinted band. */
.browser-video-band {
background:
@@ -6042,6 +6050,15 @@ html:has([data-blocking-screen]) .interface-zoom-position {
padding-top: var(--browser-file-toolbar-inset);
}
+.browser-file-page .browser-video {
+ padding-top: var(--browser-file-toolbar-inset);
+}
+
+/* Full screen leaves the bar behind, and the UA sheet keeps padding, so drop the inset there. */
+.browser-file-page .browser-video:fullscreen {
+ padding-top: 0;
+}
+
/* Dark mode: the browser's tabs and controls a step lighter than the panel, their text brighter. */
.dark .browser-chrome {
--accent: color-mix(in oklab, var(--accent-base), white 7%);
diff --git a/studio/frontend/src/lib/copy-to-clipboard.ts b/studio/frontend/src/lib/copy-to-clipboard.ts
index e1369632f88..abfe1a43a93 100644
--- a/studio/frontend/src/lib/copy-to-clipboard.ts
+++ b/studio/frontend/src/lib/copy-to-clipboard.ts
@@ -127,3 +127,16 @@ export async function copyToClipboardFrom(
return false;
}
}
+
+export async function asPng(blob: Blob): Promise<Blob> {
+ if (blob.type === "image/png") return blob;
+ const bitmap = await createImageBitmap(blob);
+ const canvas = document.createElement("canvas");
+ canvas.width = bitmap.width;
+ canvas.height = bitmap.height;
+ canvas.getContext("2d")?.drawImage(bitmap, 0, 0);
+ bitmap.close();
+ return new Promise((resolve, reject) =>
+ canvas.toBlob((png) => (png ? resolve(png) : reject(new Error("PNG encoding failed"))), "image/png"),
+ );
+}
diff --git a/studio/frontend/src/lib/hugeicons-derived.ts b/studio/frontend/src/lib/hugeicons-derived.ts
index e79c44fa0df..e64ad9b19aa 100644
--- a/studio/frontend/src/lib/hugeicons-derived.ts
+++ b/studio/frontend/src/lib/hugeicons-derived.ts
@@ -75,3 +75,43 @@ export const StarPointedIcon: IconSvgElement = [
},
],
];
+
+// Hugeicons "ai-speech" and "text-to-speach" (MIT), only in core-free-icons 4.3+, newer than the pinned 4.1.1.
+const speechStroke = {
+ stroke: "currentColor",
+ strokeLinecap: "round",
+ strokeLinejoin: "round",
+ strokeWidth: "1.5",
+} as const;
+
+export const AiSpeechIcon: IconSvgElement = [
+ ["path", { d: "M12 7V17", ...speechStroke, key: "0" }],
+ ["path", { d: "M16 11L16 19", ...speechStroke, key: "1" }],
+ ["path", { d: "M20 11L20 14", ...speechStroke, key: "2" }],
+ ["path", { d: "M8 3V21", ...speechStroke, key: "3" }],
+ ["path", { d: "M4 9V15", ...speechStroke, key: "4" }],
+ [
+ "path",
+ {
+ d: "M18.5 3.9375V5.5M18.5 5.5V7.0625M18.5 5.5H17.25M18.5 5.5H19.75M21 5.5L19.9156 5.13852C19.4179 4.97263 19.0274 4.58211 18.8615 4.08443L18.5 3L18.1385 4.08443C17.9726 4.58211 17.5821 4.97263 17.0844 5.13852L16 5.5L17.0844 5.86148C17.5821 6.02737 17.9726 6.41789 18.1385 6.91557L18.5 8L18.8615 6.91557C19.0274 6.41789 19.4179 6.02737 19.9156 5.86148L21 5.5Z",
+ ...speechStroke,
+ key: "5",
+ },
+ ],
+];
+
+export const TextToSpeechIcon: IconSvgElement = [
+ ["path", { d: "M13 9L13 17", ...speechStroke, key: "0" }],
+ ["path", { d: "M17 7L17 19", ...speechStroke, key: "1" }],
+ ["path", { d: "M21 11L21 15", ...speechStroke, key: "2" }],
+ ["path", { d: "M9 15V21", ...speechStroke, key: "3" }],
+ ["path", { d: "M5 15V17", ...speechStroke, key: "4" }],
+ [
+ "path",
+ {
+ d: "M7.5 3.5V11M7.5 11H6M7.5 11H9M12 4.5C12 3.67157 11.3284 3 10.5 3H4.5C3.67157 3 3 3.67157 3 4.5",
+ ...speechStroke,
+ key: "5",
+ },
+ ],
+];
diff --git a/studio/frontend/tests/browser-settings.test.ts b/studio/frontend/tests/browser-settings.test.ts
index 73e9f35f5f0..892cd12b236 100644
--- a/studio/frontend/tests/browser-settings.test.ts
+++ b/studio/frontend/tests/browser-settings.test.ts
@@ -863,7 +863,7 @@ test("file toolbars keep a Downloads button registered, and a hidden panel close
const read = (file: string) => readFileSync(new URL(`../src/features/browser/${file}`, import.meta.url), "utf8");
// Mounted only once a save began, it would register after a quick save had already finished.
const panel = read("browser-panel.tsx");
- assert.equal(panel.match(/<DownloadsButton [^>]*visible=\{visible\} idleHidden=\{true\} \/>/g)?.length, 3);
+ assert.equal(panel.match(/<DownloadsButton [^>]*visible=\{visible\} idleHidden=\{true\} \/>/g)?.length, 2);
assert.doesNotMatch(panel, /BusyDownloadsButton/);
// The popover is portaled out of the panel, so it would stay up over the next page.
assert.match(read("downloads-button.tsx"), /if \(!visible && mode !== "closed"\) \{\s*setMode\("closed"\);/);
diff --git a/studio/frontend/tests/file-viewer-polish.test.ts b/studio/frontend/tests/file-viewer-polish.test.ts
new file mode 100644
index 00000000000..5067766c884
--- /dev/null
+++ b/studio/frontend/tests/file-viewer-polish.test.ts
@@ -0,0 +1,77 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
+
+import assert from "node:assert/strict";
+import { readFileSync } from "node:fs";
+import test from "node:test";
+
+import { registerBundlerResolver } from "./helpers/kit.ts";
+
+registerBundlerResolver();
+const { AiSpeechIcon, TextToSpeechIcon } = await import("../src/lib/hugeicons-derived.ts");
+const { ATTACHMENT_KIND_ICONS } = await import("../src/features/chat/lib/attachment-file-kind.ts");
+const { audioWorkflowTab } = await import("../src/features/audio/workflows.ts");
+
+const read = (file: string) => readFileSync(new URL(`../src/${file}`, import.meta.url), "utf8");
+
+test("audio reads as ai-speech everywhere and Text to Speech as text-to-speech", () => {
+ assert.equal(ATTACHMENT_KIND_ICONS.audio, AiSpeechIcon);
+ assert.equal(audioWorkflowTab("speak").icon, TextToSpeechIcon);
+ assert.notEqual(AiSpeechIcon, TextToSpeechIcon);
+ for (const file of ["components/app-sidebar.tsx", "components/command-palette.tsx", "features/library/file-kind.ts"]) {
+ assert.doesNotMatch(read(file), /AudioWave01Icon/, file);
+ }
+});
+
+test("a picture sits where fit puts it before it is measured, so opening it never jumps", () => {
+ const zoom = read("components/media-zoom.tsx");
+ assert.doesNotMatch(zoom, /\{ inset: 0 \}/);
+ assert.match(zoom, /left: inset\.left,\s*top: inset\.top,\s*width: `calc\(100% - \$\{inset\.left \+ inset\.right\}px\)`/);
+});
+
+test("the lightbox backdrop is a faint grey in light mode and near black in dark", () => {
+ const css = read("index.css");
+ assert.match(css, /\.media-lightbox-overlay \{\s*background: color-mix\(in oklab, color-mix\(in oklab, var\(--background\), black 7%\) 64%, transparent\);/);
+ assert.match(css, /\.dark \.media-lightbox-overlay \{\s*background: color-mix\(in oklab, color-mix\(in oklab, var\(--background\), black 45%\) 78%, transparent\);/);
+ assert.match(read("components/media-viewer.tsx"), /"media-lightbox-overlay bg-transparent /);
+});
+
+test("the video player uses Studio's icons and full screen turns into exit full screen", () => {
+ const video = read("features/browser/video-file.tsx");
+ assert.doesNotMatch(video, /from "lucide-react"/);
+ assert.match(video, /addEventListener\("fullscreenchange", sync\)/);
+ assert.match(video, /icon=\{fullscreened \? ArrowShrink01Icon : ArrowExpand01Icon\}/);
+ assert.match(video, /fullscreened \? t\("browser\.video\.exitFullscreen"\) : t\("browser\.video\.fullscreen"\)/);
+});
+
+test("a full screen video drops the floating toolbar inset", () => {
+ const css = read("index.css");
+ assert.match(css, /\.browser-file-page \.browser-video \{\s*padding-top: var\(--browser-file-toolbar-inset\);/);
+ assert.match(css, /\.browser-file-page \.browser-video:fullscreen \{\s*padding-top: 0;\s*\}/);
+});
+
+test("video tabs share the document bar: Copy and Open splits and a download icon, no Save as", () => {
+ const panel = read("features/browser/browser-panel.tsx");
+ assert.doesNotMatch(panel, /VideoFileToolbar|isVideoEntry|browser\.video\.saveAs|browser\.video\.copyName/);
+ assert.match(panel, /return kind === "html" \|\| kind === "code";\n\}/);
+ assert.match(panel, /<CopySplit tab=\{tab\} entry=\{entry\} blob=\{blob\}/);
+ assert.match(panel, /<OpenSplit key=\{entry\.fileId\} entry=\{entry\} blob=\{blob\} \/>/);
+ assert.match(panel, /const timed = media === "video" \|\| media === "audio";/);
+ assert.match(panel, /\{timed \? null : \(\s*<ScaleMenu/);
+});
+
+test("the desktop Open lists apps, opens a local copy, and never opens programs", () => {
+ const openWith = read("features/browser/open-with.ts");
+ assert.match(openWith, /const copies = new WeakMap<Blob, Map<string, Promise<LocalCopy>>>\(\);/);
+ assert.match(openWith, /"browser_file_local_copy"/);
+ const panel = read("features/browser/browser-panel.tsx");
+ assert.match(panel, /const runsCode = isDangerousDownload\(entry\.name\);/);
+ assert.match(panel, /withLocalCopy\(blob, entry\.name, \(copy\) => localCopyPath\(copy\.id\)\)/);
+ const rust = readFileSync(new URL("../../src-tauri/src/browser_open_with.rs", import.meta.url), "utf8");
+ assert.match(rust, /if crate::browser_downloads::runs_code\(&path\) \{\s*return Err/);
+ assert.match(rust, /if !app_paths\(path\)\.0\.iter\(\)\.any\(\|app\| app == with\)/);
+ const main = readFileSync(new URL("../../src-tauri/src/main.rs", import.meta.url), "utf8");
+ for (const command of ["browser_file_local_copy", "browser_file_apps", "browser_file_open", "browser_file_path", "browser_file_reveal"]) {
+ assert.match(main, new RegExp(`browser_open_with::${command},`), command);
+ }
+});
diff --git a/studio/frontend/tests/open-with-stale-copy.test.ts b/studio/frontend/tests/open-with-stale-copy.test.ts
new file mode 100644
index 00000000000..e29839b2bd5
--- /dev/null
+++ b/studio/frontend/tests/open-with-stale-copy.test.ts
@@ -0,0 +1,37 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
+
+import assert from "node:assert/strict";
+import test from "node:test";
+
+import { registerBundlerResolver } from "./helpers/kit.ts";
+
+registerBundlerResolver();
+
+const onDisk = new Set<string>();
+const calls: string[] = [];
+(globalThis as { window?: unknown }).window = {
+ __TAURI_INTERNALS__: {
+ invoke: async (command: string, args: { id?: string }) => {
+ calls.push(command);
+ if (command === "browser_file_local_copy") {
+ onDisk.add("copy");
+ return { id: "copy", path: "/cache/open-with/copy/clip.mp4" };
+ }
+ if (!onDisk.has(args.id ?? "")) throw "The file is no longer there.";
+ },
+ },
+};
+
+const { openLocalCopy, withLocalCopy } = await import("../src/features/browser/open-with.ts");
+
+test("a copy moved away after Show in Finder is written again, so Open still opens the tab", async () => {
+ const blob = new Blob(["video"]);
+ const open = () => withLocalCopy(blob, "clip.mp4", (copy) => openLocalCopy(copy.id));
+ await open();
+ await open();
+ assert.deepEqual(calls, ["browser_file_local_copy", "browser_file_open", "browser_file_open"]);
+ onDisk.clear();
+ await open();
+ assert.deepEqual(calls.slice(3), ["browser_file_open", "browser_file_local_copy", "browser_file_open"]);
+});
diff --git a/studio/src-tauri/Cargo.toml b/studio/src-tauri/Cargo.toml
index 7e9937cbc3d..2900ae3f19d 100644
--- a/studio/src-tauri/Cargo.toml
+++ b/studio/src-tauri/Cargo.toml
@@ -60,7 +60,7 @@ tokio = { version = "1", features = ["test-util"] }
[target.'cfg(target_os = "macos")'.dependencies]
objc2 = { version = "0.6", features = ["exception"] }
-objc2-app-kit = { version = "0.3.2", default-features = false, features = ["std", "NSAppearance", "NSButton", "NSControl", "NSResponder", "NSStatusBarButton", "NSStatusItem", "NSView", "NSBitmapImageRep", "NSImage", "NSImageRep", "NSPrintInfo", "NSPrintOperation", "NSWindow"] }
+objc2-app-kit = { version = "0.3.2", default-features = false, features = ["std", "NSAppearance", "NSButton", "NSControl", "NSResponder", "NSStatusBarButton", "NSStatusItem", "NSView", "NSBitmapImageRep", "NSImage", "NSImageRep", "NSPrintInfo", "NSPrintOperation", "NSWindow", "NSWorkspace", "NSGraphics"] }
objc2-foundation = { version = "0.3.2", default-features = false, features = ["std", "NSArray", "NSError", "NSDictionary", "NSKeyValueCoding", "NSKeyValueObserving", "NSObject", "NSProcessInfo", "NSString", "NSURL", "NSURLRequest", "NSURLResponse", "NSData", "NSGeometry"] }
# The browser panel's content rules (browser_webview.rs), snapshots and printing
# (browser_capture.rs) and context menu downloads (browser_context_downloads.rs); wry already
diff --git a/studio/src-tauri/src/browser_downloads.rs b/studio/src-tauri/src/browser_downloads.rs
index 56ce1c3aca0..952f0ff71ba 100644
--- a/studio/src-tauri/src/browser_downloads.rs
+++ b/studio/src-tauri/src/browser_downloads.rs
@@ -239,7 +239,7 @@ pub fn browser_download_reveal(
}
/// Extensions that run code when opened, shared with download-safety.ts.
-fn runs_code(path: &Path) -> bool {
+pub(crate) fn runs_code(path: &Path) -> bool {
static EXTENSIONS: std::sync::OnceLock<Vec<String>> = std::sync::OnceLock::new();
let extensions = EXTENSIONS.get_or_init(|| {
#[derive(Deserialize)]
diff --git a/studio/src-tauri/src/browser_open_with.rs b/studio/src-tauri/src/browser_open_with.rs
new file mode 100644
index 00000000000..496e0e96020
--- /dev/null
+++ b/studio/src-tauri/src/browser_open_with.rs
@@ -0,0 +1,329 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
+
+//! Open a browser file tab in another app, as ChatGPT's Open menu does. A tab holds its bytes in
+//! the webview, and another app can only open a file on disk, so each is copied out first.
+
+use std::collections::HashMap;
+use std::fs;
+use std::path::{Path, PathBuf};
+use std::sync::atomic::{AtomicBool, AtomicU64, Ordering};
+use std::sync::Mutex;
+
+use serde::Serialize;
+use sha2::{Digest, Sha256};
+use tauri::{AppHandle, Manager, Url};
+
+const OPEN_DIR: &str = "open-with";
+#[cfg(target_os = "macos")]
+const MAX_APPS: usize = 12;
+
+static CLEARED: AtomicBool = AtomicBool::new(false);
+static PARTIAL: AtomicU64 = AtomicU64::new(0);
+// Each id's own copy: Finder leaves a .DS_Store beside it once shown, and that lists first.
+static COPIES: Mutex<Option<HashMap<String, PathBuf>>> = Mutex::new(None);
+
+fn remember(id: &str, path: &Path) {
+ if let Ok(mut copies) = COPIES.lock() {
+ copies
+ .get_or_insert_with(HashMap::new)
+ .insert(id.to_string(), path.to_path_buf());
+ }
+}
+
+fn recall(id: &str) -> Option<PathBuf> {
+ let copies = COPIES.lock().ok()?;
+ copies
+ .as_ref()?
+ .get(id)
+ .filter(|path| path.is_file())
+ .cloned()
+}
+
+#[derive(Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct LocalCopy {
+ id: String,
+ path: String,
+}
+
+#[derive(Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct OpenWithApp {
+ path: String,
+ name: String,
+ icon: Option<String>,
+ default: bool,
+}
+
+fn root(app: &AppHandle) -> Result<PathBuf, String> {
+ app.path()
+ .app_cache_dir()
+ .map(|dir| dir.join(OPEN_DIR))
+ .map_err(|error| error.to_string())
+}
+
+fn copy_path(id: &str) -> Result<PathBuf, String> {
+ recall(id).ok_or_else(|| "The file is no longer there.".to_string())
+}
+
+/// Same bytes and name reuse one copy; an earlier run's copies are cleared on first use.
+#[tauri::command]
+pub async fn browser_file_local_copy(
+ webview: tauri::Webview,
+ app: AppHandle,
+ request: tauri::ipc::Request<'_>,
+) -> Result<LocalCopy, String> {
+ crate::native_intents::ensure_main_window(&webview)?;
+ let (name, content) = crate::native_file_dialogs::request_file(&request)?;
+ let name = crate::native_file_dialogs::safe_download_name(&name);
+ let root = root(&app)?;
+ if !CLEARED.swap(true, Ordering::SeqCst) {
+ let _ = fs::remove_dir_all(&root);
+ }
+ let mut hasher = Sha256::new();
+ hasher.update(name.as_bytes());
+ hasher.update([0]);
+ hasher.update(content.as_ref());
+ let id: String = hasher.finalize()[..16]
+ .iter()
+ .map(|byte| format!("{byte:02x}"))
+ .collect();
+ let dir = root.join(&id);
+ let path = dir.join(&name);
+ if !path.is_file() {
+ fs::create_dir_all(&dir).map_err(|error| error.to_string())?;
+ // Written outside the folder, then moved in, so a half-written copy is never opened.
+ let partial = root.join(format!(
+ "{id}.{}.partial",
+ PARTIAL.fetch_add(1, Ordering::Relaxed)
+ ));
+ fs::write(&partial, content.as_ref()).map_err(|error| error.to_string())?;
+ fs::rename(&partial, &path).map_err(|error| {
+ let _ = fs::remove_file(&partial);
+ error.to_string()
+ })?;
+ // A tab's file may come from a website or a model, so the system checks it as a download.
+ if let Ok(blank) = Url::parse("about:blank") {
+ let _ = crate::browser_webview::mark_downloaded(&path, &blank);
+ }
+ }
+ remember(&id, &path);
+ Ok(LocalCopy {
+ id,
+ path: path.to_string_lossy().into_owned(),
+ })
+}
+
+#[tauri::command]
+pub fn browser_file_apps(webview: tauri::Webview, id: String) -> Result<Vec<OpenWithApp>, String> {
+ crate::native_intents::ensure_main_window(&webview)?;
+ let path = copy_path(&id)?;
+ if crate::browser_downloads::runs_code(&path) {
+ return Ok(Vec::new());
+ }
+ Ok(platform_apps(&path))
+}
+
+#[tauri::command]
+pub fn browser_file_open(
+ webview: tauri::Webview,
+ id: String,
+ with: Option<String>,
+) -> Result<(), String> {
+ crate::native_intents::ensure_main_window(&webview)?;
+ let path = copy_path(&id)?;
+ if crate::browser_downloads::runs_code(&path) {
+ return Err("Programs and scripts open from their folder.".to_string());
+ }
+ match with {
+ None => {
+ tauri_plugin_opener::open_path(&path, None::<&str>).map_err(|error| error.to_string())
+ }
+ Some(with) => open_with(&path, &with),
+ }
+}
+
+#[tauri::command]
+pub fn browser_file_path(webview: tauri::Webview, id: String) -> Result<String, String> {
+ crate::native_intents::ensure_main_window(&webview)?;
+ Ok(copy_path(&id)?.to_string_lossy().into_owned())
+}
+
+#[tauri::command]
+pub fn browser_file_reveal(webview: tauri::Webview, id: String) -> Result<(), String> {
+ crate::native_intents::ensure_main_window(&webview)?;
+ crate::native_intents::reveal_in_file_manager(&copy_path(&id)?)
+}
+
+#[cfg(target_os = "macos")]
+fn app_paths(path: &Path) -> (Vec<String>, Option<String>) {
+ use objc2_app_kit::NSWorkspace;
+ use objc2_foundation::{NSString, NSURL};
+
+ let workspace = NSWorkspace::sharedWorkspace();
+ let url = NSURL::fileURLWithPath(&NSString::from_str(&path.to_string_lossy()));
+ let default = workspace
+ .URLForApplicationToOpenURL(&url)
+ .and_then(|app| app.path())
+ .map(|app| app.to_string());
+ let urls = workspace.URLsForApplicationsToOpenURL(&url);
+ let mut apps: Vec<String> = Vec::new();
+ for index in 0..urls.count() {
+ if let Some(app) = urls.objectAtIndex(index).path().map(|app| app.to_string()) {
+ if !apps.contains(&app) {
+ apps.push(app);
+ }
+ }
+ }
+ (apps, default)
+}
+
+#[cfg(target_os = "macos")]
+fn platform_apps(path: &Path) -> Vec<OpenWithApp> {
+ use objc2_app_kit::NSWorkspace;
+
+ let (mut apps, default) = app_paths(path);
+ if let Some(default) = &default {
+ if let Some(at) = apps.iter().position(|app| app == default) {
+ let app = apps.remove(at);
+ apps.insert(0, app);
+ }
+ }
+ apps.truncate(MAX_APPS);
+ let workspace = NSWorkspace::sharedWorkspace();
+ apps.into_iter()
+ .map(|app| {
+ let name = Path::new(&app)
+ .file_stem()
+ .map(|stem| stem.to_string_lossy().into_owned())
+ .unwrap_or_else(|| app.clone());
+ OpenWithApp {
+ icon: app_icon(&workspace, &app),
+ default: default.as_deref() == Some(app.as_str()),
+ name,
+ path: app,
+ }
+ })
+ .collect()
+}
+
+#[cfg(target_os = "macos")]
+fn app_icon(workspace: &objc2_app_kit::NSWorkspace, app: &str) -> Option<String> {
+ use base64::Engine;
+ use objc2::{AllocAnyThread, MainThreadMarker};
+ use objc2_app_kit::{NSBitmapImageFileType, NSBitmapImageRep, NSCompositingOperation, NSImage};
+ use objc2_foundation::{NSDictionary, NSPoint, NSRect, NSSize, NSString};
+
+ // Drawing into an image is AppKit's, so main thread only; a sync command runs there.
+ MainThreadMarker::new()?;
+ let icon = workspace.iconForFile(&NSString::from_str(app));
+ let size = NSSize::new(32.0, 32.0);
+ let image = NSImage::initWithSize(NSImage::alloc(), size);
+ #[allow(deprecated)]
+ image.lockFocus();
+ icon.drawInRect_fromRect_operation_fraction(
+ NSRect::new(NSPoint::new(0.0, 0.0), size),
+ NSRect::ZERO,
+ NSCompositingOperation::SourceOver,
+ 1.0,
+ );
+ #[allow(deprecated)]
+ image.unlockFocus();
+ let png = image
+ .TIFFRepresentation()
+ .and_then(|tiff| NSBitmapImageRep::imageRepWithData(&tiff))
+ // Safety: an empty properties dictionary, as browser_capture.rs passes.
+ .and_then(|bitmap| unsafe {
+ bitmap.representationUsingType_properties(
+ NSBitmapImageFileType::PNG,
+ &NSDictionary::new(),
+ )
+ })?
+ .to_vec();
+ Some(format!(
+ "data:image/png;base64,{}",
+ base64::engine::general_purpose::STANDARD.encode(png)
+ ))
+}
+
+#[cfg(target_os = "macos")]
+fn open_with(path: &Path, with: &str) -> Result<(), String> {
+ // Only an app the system lists for this file, never a path the page made up.
+ if !app_paths(path).0.iter().any(|app| app == with) {
+ return Err("That app can't open this file.".to_string());
+ }
+ std::process::Command::new("/usr/bin/open")
+ .arg("-a")
+ .arg(with)
+ .arg(path)
+ .spawn()
+ .map(|_| ())
+ .map_err(|error| format!("Couldn't open the file: {error}"))
+}
+
+#[cfg(not(target_os = "macos"))]
+fn platform_apps(_path: &Path) -> Vec<OpenWithApp> {
+ Vec::new()
+}
+
+#[cfg(not(target_os = "macos"))]
+fn open_with(_path: &Path, _with: &str) -> Result<(), String> {
+ Err("Choosing an app isn't supported here.".to_string())
+}
+
+#[cfg(test)]
+mod copy_tests {
+ use super::*;
+
+ #[test]
+ fn an_id_resolves_to_its_own_copy_not_a_sidecar_beside_it() {
+ let dir = std::env::temp_dir().join(format!("open-with-copy-{}", std::process::id()));
+ fs::create_dir_all(&dir).unwrap();
+ // .DS_Store sorts first in an APFS listing, so the first regular file would be it.
+ fs::write(dir.join(".DS_Store"), b"finder").unwrap();
+ let clip = dir.join("clip.mp4");
+ fs::write(&clip, b"video").unwrap();
+ let id = "0123456789abcdef0123456789abcdef";
+ remember(id, &clip);
+ let found = copy_path(id);
+ let unknown = copy_path("ffffffffffffffffffffffffffffffff");
+ fs::remove_file(&clip).unwrap();
+ let gone = copy_path(id);
+ let _ = fs::remove_dir_all(&dir);
+ assert_eq!(found.unwrap(), clip);
+ assert!(unknown.is_err());
+ assert!(gone.is_err());
+ }
+}
+
+#[cfg(all(test, target_os = "macos"))]
+mod tests {
+ use super::*;
+
+ #[test]
+ fn a_png_lists_preview_with_a_default() {
+ let dir = std::env::temp_dir().join(format!("open-with-test-{}", std::process::id()));
+ fs::create_dir_all(&dir).unwrap();
+ let png = dir.join("pixel.png");
+ // A real 1x1 PNG, so Launch Services types it by content as well as by extension.
+ fs::write(
+ &png,
+ base64::Engine::decode(
+ &base64::engine::general_purpose::STANDARD,
+ "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==",
+ )
+ .unwrap(),
+ )
+ .unwrap();
+ let (apps, default) = app_paths(&png);
+ let refused = open_with(&png, "/System/Applications/Calculator.app");
+ let _ = fs::remove_dir_all(&dir);
+ assert!(
+ apps.iter().any(|app| app.ends_with("/Preview.app")),
+ "{apps:?}"
+ );
+ assert!(default.is_some_and(|app| apps.contains(&app)));
+ assert!(refused.is_err());
+ }
+}
diff --git a/studio/src-tauri/src/main.rs b/studio/src-tauri/src/main.rs
index dd6d8b913dd..3781ed36452 100644
--- a/studio/src-tauri/src/main.rs
+++ b/studio/src-tauri/src/main.rs
@@ -6,6 +6,7 @@ mod browser_capture;
#[cfg(target_os = "macos")]
mod browser_context_downloads;
mod browser_downloads;
+mod browser_open_with;
mod browser_proxy;
mod browser_webview;
mod commands;
@@ -2267,6 +2268,11 @@ fn main() {
browser_downloads::browser_download_folder,
browser_downloads::browser_download_folder_pick,
browser_downloads::browser_download_folder_reset,
+ browser_open_with::browser_file_local_copy,
+ browser_open_with::browser_file_apps,
+ browser_open_with::browser_file_open,
+ browser_open_with::browser_file_path,
+ browser_open_with::browser_file_reveal,
browser_capture::browser_view_print,
set_training_active,
set_renderer_activity,
diff --git a/studio/src-tauri/src/native_file_dialogs.rs b/studio/src-tauri/src/native_file_dialogs.rs
index 0b5d2eda405..86e01a24669 100644
--- a/studio/src-tauri/src/native_file_dialogs.rs
+++ b/studio/src-tauri/src/native_file_dialogs.rs
@@ -447,7 +447,7 @@ pub async fn save_native_file(
.map(|path| saved_file_name(&path)))
}
-fn request_file<'a>(
+pub(crate) fn request_file<'a>(
request: &'a tauri::ipc::Request<'_>,
) -> Result<(String, Cow<'a, [u8]>), String> {
let encoded_name = request