Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.
JavaScript aianthropiccross-platformgeminigroqlinuxmacosnvidiaopen-sourceopenaiparakeetspeech-to-texttranscribewhisperwindows
import { useTranslation } from "react-i18next";
import { Check, Terminal, Info } from "../icons";
import { Button } from "./button";
import { InfoBox } from "./InfoBox";
import type { PasteToolsResult } from "../../types/electron";
import {
getLinuxPasteInstallCommands,
needsLinuxPasteToolGuidance,
needsWtype,
type LinuxPasteTool,
} from "../../utils/linuxPasteTools";
interface PasteToolsInfoProps {
pasteToolsInfo: PasteToolsResult | null;
isChecking: boolean;
onCheck: () => void;
}
function LinuxInstallCommands({ tool }: { tool: LinuxPasteTool }) {
const { t } = useTranslation();
return (
<div className="mt-3 space-y-2 bg-card border border-border p-3 rounded-md font-mono text-xs overflow-x-auto">
{getLinuxPasteInstallCommands(t, tool).map(({ label, cmd }) => (
<div key={cmd}>
<div className="text-muted-foreground">{label}</div>
<div dir="ltr" className="text-foreground">
{cmd}
</div>
</div>
))}
</div>
);
}
export default function PasteToolsInfo({
pasteToolsInfo,
isChecking,
onCheck,
}: PasteToolsInfoProps) {
const { t } = useTranslation();
if (!pasteToolsInfo) {
return (
<div className="border border-border rounded-lg p-4">
<div className="flex items-center justify-between">
<div className="flex items-center gap-3">
<Terminal className="w-6 h-6 text-primary" />
<div>
<h3 className="font-semibold text-foreground">{t("pasteToolsInfo.title")}</h3>
<p className="text-sm text-muted-foreground">{t("pasteToolsInfo.checking")}</p>
</div>
</div>
{isChecking && (
<div className="animate-spin rounded-full h-5 w-5 border-b-2 border-primary"></div>
)}
</div>
</div>
);
}
// Windows - always ready
if (pasteToolsInfo.platform === "win32") {
return (
<InfoBox variant="success">
<div className="flex items-center justify-between">
<div className="flex items-center gap-3">
<Terminal className="w-6 h-6 text-success dark:text-success" />
<div>
<h3 className="font-semibold text-success dark:text-success">
{t("pasteToolsInfo.readyTitle")}
</h3>
<p className="text-sm text-success dark:text-success">
{t("pasteToolsInfo.windowsReady")}
</p>
</div>
</div>
<div className="text-success dark:text-success">
<Check className="w-5 h-5" />
</div>
</div>
</InfoBox>
);
}
if (pasteToolsInfo.platform === "linux" && !needsLinuxPasteToolGuidance(pasteToolsInfo)) {
const method = pasteToolsInfo.method || "xdotool";
const methodLabel = method === "xtest" ? "built-in (XTest)" : method;
const methodSuffix =
pasteToolsInfo.isWayland && method === "xdotool"
? t("pasteToolsInfo.xwaylandAppsOnly")
: t("pasteToolsInfo.methodReady");
return (
<InfoBox variant="success">
<div className="flex items-center justify-between">
<div className="flex items-center gap-3">
<Terminal className="w-6 h-6 text-success dark:text-success" />
<div>
<h3 className="font-semibold text-success dark:text-success">
{t("pasteToolsInfo.readyTitle")}
</h3>
<p className="text-sm text-success dark:text-success">
{t("pasteToolsInfo.usingMethodPrefix")}{" "}
<code dir="ltr" className="bg-success/20 px-1 rounded">
{methodLabel}
</code>{" "}
{methodSuffix}
</p>
</div>
</div>
<div className="text-success dark:text-success">
<Check className="w-5 h-5" />
</div>
</div>
</InfoBox>
);
}
if (needsLinuxPasteToolGuidance(pasteToolsInfo)) {
const isWayland = pasteToolsInfo.isWayland;
const wlCopyMissing = !!pasteToolsInfo.wlCopyMissing;
const wtypeMissing = needsWtype(pasteToolsInfo);
const needsPasteTool = !pasteToolsInfo.available || wtypeMissing;
const cosmicTerminalsOnly = wtypeMissing && !!pasteToolsInfo.isCosmic;
const recommendedTool = wtypeMissing
? "wtype"
: pasteToolsInfo.recommendedInstall === "wtype"
? "wtype"
: pasteToolsInfo.recommendedInstall === "xdotool"
? "xdotool"
: null;
const showInstall = recommendedTool !== null;
return (
<InfoBox variant="warning" className="space-y-3">
{/* wl-clipboard and a paste tool can both be missing; list both, so one
Re-check doesn't uncover the other. */}
{wlCopyMissing && (
<div className="flex items-start gap-3">
<Info className="w-6 h-6 text-warning dark:text-warning flex-shrink-0 mt-0.5" />
<div className="flex-1">
<h3 className="font-semibold text-warning dark:text-warning">
{t("pasteToolsInfo.wlClipboardTitle")}
</h3>
<p className="text-sm text-warning dark:text-warning mt-1">
{t("pasteToolsInfo.wlClipboardDescription")}
</p>
<LinuxInstallCommands tool="wl-clipboard" />
</div>
</div>
)}
{needsPasteTool && (
<div className="flex items-start gap-3">
<Info className="w-6 h-6 text-warning dark:text-warning flex-shrink-0 mt-0.5" />
<div className="flex-1">
<h3 className="font-semibold text-warning dark:text-warning">
{showInstall
? t("pasteToolsInfo.optionalEnableTitle")
: t("pasteToolsInfo.waylandClipboardTitle")}
</h3>
{showInstall ? (
<>
<p className="text-sm text-warning dark:text-warning mt-1">
{cosmicTerminalsOnly ? (
t("pasteToolsInfo.wtypeCosmicTerminalsDescription")
) : wtypeMissing ? (
t("pasteToolsInfo.wtypeFallbackDescription")
) : (
<>
{t("pasteToolsInfo.installPrefix")}{" "}
<code dir="ltr" className="bg-warning/20 px-1 rounded font-mono">
{recommendedTool}
</code>
:
</>
)}
</p>
<LinuxInstallCommands tool={recommendedTool} />
{isWayland && recommendedTool === "wtype" && (
<p className="text-sm text-warning dark:text-warning mt-3">
{t("pasteToolsInfo.noteXwaylandAlso")}
</p>
)}
{isWayland && recommendedTool === "xdotool" && (
<p className="text-sm text-warning dark:text-warning mt-3">
{t("pasteToolsInfo.noteXwaylandOnly")}
</p>
)}
</>
) : (
<p className="text-sm text-warning dark:text-warning mt-1">
{t("pasteToolsInfo.waylandClipboardDescription")}{" "}
<kbd dir="ltr" className="bg-warning/20 px-1 rounded text-xs">
Ctrl+V
</kbd>
.
</p>
)}
{/* Without wl-copy, a manual Ctrl+V in a Wayland app pastes stale text too. */}
{showInstall && !cosmicTerminalsOnly && !wlCopyMissing && (
<p className="text-sm text-warning dark:text-warning mt-3">
{t("pasteToolsInfo.withoutToolPrefix")}{" "}
<kbd dir="ltr" className="bg-warning/20 px-1 rounded text-xs">
Ctrl+V
</kbd>
.
</p>
)}
</div>
</div>
)}
<div className="flex justify-end">
<Button variant="outline" size="sm" onClick={onCheck} disabled={isChecking}>
{isChecking ? t("pasteToolsInfo.recheckChecking") : t("pasteToolsInfo.recheck")}
</Button>
</div>
</InfoBox>
);
}
// Fallback for macOS (shouldn't normally render this component on macOS)
return null;
}