Skip to content

The truly free, open-source, local-first, cross-platform CapCut replacement. Scriptable through a JSON-RPC API & MCP.

feat(details): plain header, project Modify dialog, honest settings icon

Jareer090ee9ede99b
diff --git a/desktop/src-tauri/src/editor_api.rs b/desktop/src-tauri/src/editor_api.rs
index 5879b822..27c045c6 100644
--- a/desktop/src-tauri/src/editor_api.rs
+++ b/desktop/src-tauri/src/editor_api.rs
@@ -174,14 +174,22 @@ pub fn editor_state(state: tauri::State<'_, EditorState>) -> Result<EditorView,
}
/// Writes the session's document to its project folder. The output size can
-/// have been edited in the preview footer, so it rides along here.
+/// have been edited in the preview footer and the name in the project
+/// details dialog, so both ride along here.
#[tauri::command]
pub fn editor_save(
state: tauri::State<'_, EditorState>,
+ name: Option<String>,
width: Option<u32>,
height: Option<u32>,
) -> Result<(), String> {
with_session(&state, |session| {
+ if let Some(name) = name {
+ let trimmed = name.trim();
+ if !trimmed.is_empty() {
+ session.settings.name = trimmed.to_owned();
+ }
+ }
if let Some(width) = width {
session.settings.width = width;
}
diff --git a/desktop/src/App.tsx b/desktop/src/App.tsx
index 94082c06..17adb292 100644
--- a/desktop/src/App.tsx
+++ b/desktop/src/App.tsx
@@ -10,6 +10,7 @@ import { ExportDialog } from "./components/ExportDialog";
import { Icon } from "./components/Icon";
import { ALL_MEDIA, MediaBin, type BinFilter } from "./components/MediaBin";
import type { MenuOption } from "./components/Menu";
+import { ModifyProjectDialog } from "./components/ModifyProjectDialog";
import { Preview } from "./components/Preview";
import {
exportClipsOf,
@@ -173,6 +174,11 @@ function Editor({
),
});
+ // The project's display name. Seeded from the session, editable through
+ // the Details panel's Modify dialog; the engine persists it on save.
+ const [projectName, setProjectName] = useState(session.name);
+ const [modifyingProject, setModifyingProject] = useState<null | { busy: boolean }>(null);
+
const [selectedClipIds, setSelectedClipIds] = useState<string[]>([]);
const [selectedMediaId, setSelectedMediaId] = useState<string | null>(null);
const [tool, setTool] = useState<Tool>("select");
@@ -867,7 +873,7 @@ function Editor({
return (
<div className="flex h-full flex-col overflow-hidden">
<TitleBar
- projectName={session.name}
+ projectName={projectName}
status={
saveState === "saving"
? "saving..."
@@ -1127,7 +1133,7 @@ function Editor({
media={inspectorMedia}
project={project}
fonts={fontsForUi}
- projectName={session.name}
+ projectName={projectName}
projectPath={session.path}
frame={frame}
duration={duration}
@@ -1137,6 +1143,7 @@ function Editor({
onChangeClip={changeClip}
onCommitClip={commitEcho}
onSpeedChange={changeSpeed}
+ onModifyProject={() => setModifyingProject({ busy: false })}
/>
</div>
</div>
@@ -1315,9 +1322,33 @@ function Editor({
{context && <ContextMenu target={context} onClose={() => setContext(null)} />}
{settingsOpen && <SettingsDialog onClose={() => setSettingsOpen(false)} />}
+ {modifyingProject && (
+ <ModifyProjectDialog
+ name={projectName}
+ frame={frame}
+ frameRate={frameRate}
+ busy={modifyingProject.busy}
+ onSave={({ name, width, height }) => {
+ setModifyingProject({ busy: true });
+ setFrame({ width, height });
+ editorSave({ width, height, name })
+ .then(() => {
+ setProjectName(name);
+ setModifyingProject(null);
+ pushToast("Project details saved", false);
+ })
+ .catch((cause: unknown) => {
+ setModifyingProject({ busy: false });
+ pushToast(String(cause), true);
+ });
+ }}
+ onCancel={() => setModifyingProject(null)}
+ />
+ )}
+
{templateDialog && (
<SaveTemplateDialog
- defaultName={session.name}
+ defaultName={projectName}
slotCount={project.media.filter((item) => item.placeholder).length}
busy={templateDialog.busy}
onSave={(name) => {
@@ -1376,7 +1407,7 @@ function Editor({
{exporting && (
<ExportDialog
- projectName={session.name}
+ projectName={projectName}
projectPath={session.path}
width={frame.width}
height={frame.height}
diff --git a/desktop/src/components/Icon.tsx b/desktop/src/components/Icon.tsx
index b64fb846..db5f6b62 100644
--- a/desktop/src/components/Icon.tsx
+++ b/desktop/src/components/Icon.tsx
@@ -240,11 +240,15 @@ const GLYPHS = {
<path d="m20 20-3.5-3.5" />
</>
),
+ // settings: three sliders with staggered knobs. Deliberately not a cog:
+ // the old ring-and-rays cog was a sun in all but name, and it sat right
+ // next to the actual sun of the theme toggle.
settings: (
<>
- <circle cx="12" cy="12" r="3.2" />
- <path d="M12 2.5v2.2M12 19.3v2.2M21.5 12h-2.2M4.7 12H2.5" />
- <path d="m18.7 5.3-1.6 1.6M6.9 17.1l-1.6 1.6M18.7 18.7l-1.6-1.6M6.9 6.9 5.3 5.3" />
+ <path d="M4 6.5h16M4 12h16M4 17.5h16" />
+ <circle cx="9.5" cy="6.5" r="2" fill="currentColor" stroke="none" />
+ <circle cx="15" cy="12" r="2" fill="currentColor" stroke="none" />
+ <circle cx="7.5" cy="17.5" r="2" fill="currentColor" stroke="none" />
</>
),
info: (
diff --git a/desktop/src/components/Inspector.tsx b/desktop/src/components/Inspector.tsx
index 13ca72c7..d77f7902 100644
--- a/desktop/src/components/Inspector.tsx
+++ b/desktop/src/components/Inspector.tsx
@@ -7,9 +7,8 @@ import { shortDuration, timecode } from "../lib/time";
* Properties of the current selection - a clip if one is selected, otherwise
* the highlighted bin item, otherwise the project itself.
*
- * Read-only for now. When these become editable the edits go to the engine as
- * commands and come back as new state; the panel stays dumb. That is what
- * makes undo possible later without unpicking it.
+ * The rows are read-only; edits go through Modify, whose changes reach the
+ * engine and come back as new state - the panel stays dumb.
*/
export function Inspector({
clip,
@@ -20,6 +19,7 @@ export function Inspector({
projectPath,
frame,
duration,
+ onModify,
}: {
clip: Clip | null;
media: MediaItem | null;
@@ -31,24 +31,38 @@ export function Inspector({
frame: { width: number; height: number };
/** Timeline length in seconds. */
duration: number;
+ /** Opens the project-details editor (name, output frame). */
+ onModify: () => void;
}) {
return (
- <div>
+ <div className="flex min-h-full flex-col">
{!clip && !media ? (
- <div className="selectable px-3 py-2">
- <Section title="Project">
- <Row label="Name" value={projectName} />
- <Row label="Folder" value={projectPath} mono wrap />
- <Row label="Output" value={`${frame.width} x ${frame.height}`} mono />
- <Row label="Rate" value={`${frameRate.toFixed(2)} fps`} mono />
- <Row label="Duration" value={timecode(duration, frameRate)} mono />
- </Section>
- <Section title="Contents">
- <Row label="Media" value={`${project.media.length}`} mono />
- <Row label="Tracks" value={`${activeTimeline(project).tracks.length}`} mono />
- <Row label="Clips" value={`${activeTimeline(project).clips.length}`} mono />
- </Section>
- </div>
+ <>
+ <div className="selectable flex-1 px-3 py-2">
+ <Section title="Project">
+ <Row label="Name" value={projectName} />
+ <Row label="Folder" value={projectPath} mono wrap />
+ <Row label="Output" value={`${frame.width} x ${frame.height}`} mono />
+ <Row label="Rate" value={`${frameRate.toFixed(2)} fps`} mono />
+ <Row label="Duration" value={timecode(duration, frameRate)} mono />
+ </Section>
+ <Section title="Contents">
+ <Row label="Media" value={`${project.media.length}`} mono />
+ <Row label="Tracks" value={`${activeTimeline(project).tracks.length}`} mono />
+ <Row label="Clips" value={`${activeTimeline(project).clips.length}`} mono />
+ </Section>
+ </div>
+ <div className="flex justify-end border-t border-hairline px-3 py-2">
+ <button
+ type="button"
+ onClick={onModify}
+ className="cursor-pointer rounded-lg bg-hover px-3.5 py-1.5 text-xs font-medium
+ text-primary transition-colors hover:bg-active"
+ >
+ Modify
+ </button>
+ </div>
+ </>
) : (
<div className="selectable px-3 py-2">
{clip && (
diff --git a/desktop/src/components/ModifyProjectDialog.tsx b/desktop/src/components/ModifyProjectDialog.tsx
new file mode 100644
index 00000000..85d677e6
--- /dev/null
+++ b/desktop/src/components/ModifyProjectDialog.tsx
@@ -0,0 +1,148 @@
+import { useEffect, useState } from "react";
+
+import { Icon } from "./Icon";
+
+/** Output bounds the encoder accepts comfortably; also the preview footer's. */
+const MIN_DIMENSION = 16;
+const MAX_DIMENSION = 8192;
+
+/**
+ * Edits the project's own details: its name and output frame.
+ *
+ * Distinct from Settings on purpose - Settings configures the app, this
+ * configures the project. The frame rate is shown but not editable: every
+ * clip boundary in the edit is quantised to its grid, and changing it would
+ * silently re-time the whole timeline. That is a conform, not a config.
+ */
+export function ModifyProjectDialog({
+ name,
+ frame,
+ frameRate,
+ busy,
+ onSave,
+ onCancel,
+}: {
+ name: string;
+ frame: { width: number; height: number };
+ frameRate: number;
+ busy: boolean;
+ onSave: (next: { name: string; width: number; height: number }) => void;
+ onCancel: () => void;
+}) {
+ const [draftName, setDraftName] = useState(name);
+ const [width, setWidth] = useState(String(frame.width));
+ const [height, setHeight] = useState(String(frame.height));
+
+ useEffect(() => {
+ const onKey = (event: KeyboardEvent) => {
+ if (event.key === "Escape") onCancel();
+ };
+ window.addEventListener("keydown", onKey);
+ return () => window.removeEventListener("keydown", onKey);
+ }, [onCancel]);
+
+ // Even dimensions inside the encoder's comfort range; the same rounding
+ // the preview footer applies, so the two entrances agree.
+ const parse = (value: string) => {
+ const number = Math.round(Number(value));
+ if (!Number.isFinite(number)) return null;
+ const clamped = Math.min(MAX_DIMENSION, Math.max(MIN_DIMENSION, number));
+ return clamped - (clamped % 2);
+ };
+ const parsedWidth = parse(width);
+ const parsedHeight = parse(height);
+ const valid = draftName.trim().length > 0 && parsedWidth !== null && parsedHeight !== null;
+
+ const save = () => {
+ if (!valid || busy) return;
+ onSave({ name: draftName.trim(), width: parsedWidth!, height: parsedHeight! });
+ };
+
+ return (
+ <div
+ className="fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-8
+ backdrop-blur-[2px]"
+ onMouseDown={(event) => {
+ if (event.target === event.currentTarget) onCancel();
+ }}
+ >
+ <div className="surface w-full max-w-sm rounded-2xl p-6">
+ <div className="mb-4 flex items-center gap-2">
+ <Icon name="settings" size={16} className="text-accent" />
+ <h2 className="text-sm font-semibold text-primary">Project details</h2>
+ </div>
+
+ <label className="mb-3 block">
+ <span className="mb-1 block text-[11px] font-semibold uppercase tracking-wider text-tertiary">
+ Name
+ </span>
+ <input
+ value={draftName}
+ autoFocus
+ spellCheck={false}
+ onChange={(event) => setDraftName(event.target.value)}
+ onKeyDown={(event) => event.key === "Enter" && save()}
+ className="w-full rounded-lg bg-sunken px-3 py-2 text-sm text-primary outline-none
+ ring-1 ring-hairline focus:ring-accent"
+ />
+ </label>
+
+ <div className="mb-3 grid grid-cols-2 gap-3">
+ {(
+ [
+ ["Width", width, setWidth],
+ ["Height", height, setHeight],
+ ] as const
+ ).map(([label, value, set]) => (
+ <label key={label} className="block">
+ <span className="mb-1 block text-[11px] font-semibold uppercase tracking-wider text-tertiary">
+ {label}
+ </span>
+ <input
+ value={value}
+ inputMode="numeric"
+ spellCheck={false}
+ onChange={(event) => set(event.target.value)}
+ onKeyDown={(event) => event.key === "Enter" && save()}
+ className="w-full rounded-lg bg-sunken px-3 py-2 font-technical text-sm
+ text-primary outline-none ring-1 ring-hairline focus:ring-accent"
+ />
+ </label>
+ ))}
+ </div>
+
+ <p className="mb-5 flex items-baseline justify-between text-xs text-secondary">
+ <span>Frame rate</span>
+ <span
+ className="font-technical text-primary"
+ title="Fixed for the project's lifetime: every cut is quantised to this grid,
+and changing it would re-time the whole edit."
+ >
+ {frameRate.toFixed(2)} fps · fixed
+ </span>
+ </p>
+
+ <div className="flex gap-1.5">
+ <button
+ type="button"
+ onClick={onCancel}
+ className="flex-1 cursor-pointer rounded-lg bg-hover px-4 py-2 text-sm text-primary
+ transition-colors hover:bg-active"
+ >
+ Cancel
+ </button>
+ <button
+ type="button"
+ disabled={busy || !valid}
+ onClick={save}
+ className="flex-1 cursor-pointer rounded-lg bg-accent px-4 py-2 text-sm font-medium
+ text-on-accent transition-colors hover:bg-accent-hover
+ disabled:cursor-not-allowed disabled:opacity-40"
+ >
+ {busy ? "Saving..." : "Save"}
+ </button>
+ </div>
+ </div>
+ </div>
+ );
+}
diff --git a/desktop/src/components/RightPanel.tsx b/desktop/src/components/RightPanel.tsx
index 218704b6..d71b01fd 100644
--- a/desktop/src/components/RightPanel.tsx
+++ b/desktop/src/components/RightPanel.tsx
@@ -67,6 +67,7 @@ export function RightPanel({
onSpeedChange,
onAddFont,
onRemoveFont,
+ onModifyProject,
}: {
tab: RightTab;
onTab: (tab: RightTab) => void;
@@ -86,6 +87,8 @@ export function RightPanel({
onSpeedChange: (speed: number) => void;
onAddFont: () => void;
onRemoveFont: (family: string) => void;
+ /** Opens the project-details editor (name, output frame). */
+ onModifyProject: () => void;
}) {
const isText = clip?.kind === "text";
const tabs = clip
@@ -99,28 +102,33 @@ export function RightPanel({
// A selection change can leave the strip showing a tab that is no longer
// offered, so the active tab falls back to the first one that exists.
const active = tabs.some((entry) => entry.id === tab) ? tab : tabs[0].id;
+ // A segmented control with one segment is a label wearing a costume; a
+ // lone tab renders as the panel's plain heading instead.
+ const single = tabs.length === 1;
return (
- <Panel>
- <div className="sticky top-0 z-10 border-b border-hairline bg-panel px-2 pb-2 pt-2">
- <div className="flex rounded-lg bg-sunken p-0.5">
- {tabs.map((entry) => (
- <button
- key={entry.id}
- type="button"
- aria-pressed={active === entry.id}
- onClick={() => onTab(entry.id)}
- className={`flex-1 cursor-pointer rounded-[6px] px-2 py-1 text-[12px] transition-colors ${
- active === entry.id
- ? "bg-panel text-primary shadow-[0_1px_2px_rgba(0,0,0,0.14)]"
- : "text-secondary hover:text-primary"
- }`}
- >
- {entry.label}
- </button>
- ))}
+ <Panel title={single ? tabs[0].label : undefined}>
+ {!single && (
+ <div className="sticky top-0 z-10 border-b border-hairline bg-panel px-2 pb-2 pt-2">
+ <div className="flex rounded-lg bg-sunken p-0.5">
+ {tabs.map((entry) => (
+ <button
+ key={entry.id}
+ type="button"
+ aria-pressed={active === entry.id}
+ onClick={() => onTab(entry.id)}
+ className={`flex-1 cursor-pointer rounded-[6px] px-2 py-1 text-[12px] transition-colors ${
+ active === entry.id
+ ? "bg-panel text-primary shadow-[0_1px_2px_rgba(0,0,0,0.14)]"
+ : "text-secondary hover:text-primary"
+ }`}
+ >
+ {entry.label}
+ </button>
+ ))}
+ </div>
</div>
- </div>
+ )}
{active === "details" && (
<Inspector
@@ -132,6 +140,7 @@ export function RightPanel({
projectPath={projectPath}
frame={frame}
duration={duration}
+ onModify={onModifyProject}
/>
)}
{active === "text" && (
diff --git a/desktop/src/lib/engine.ts b/desktop/src/lib/engine.ts
index 866aa1fb..17e6db03 100644
--- a/desktop/src/lib/engine.ts
+++ b/desktop/src/lib/engine.ts
@@ -219,11 +219,17 @@ export async function editorState(): Promise<EditorView> {
}
/** Writes the session's document to disk. The output size rides along
- * because the preview footer can edit it. */
-export async function editorSave(frame?: { width: number; height: number }): Promise<void> {
+ * because the preview footer can edit it; the name because the project
+ * details dialog can. */
+export async function editorSave(update?: {
+ width: number;
+ height: number;
+ name?: string;
+}): Promise<void> {
return invoke<void>("editor_save", {
- width: frame?.width ?? null,
- height: frame?.height ?? null,
+ name: update?.name ?? null,
+ width: update?.width ?? null,
+ height: update?.height ?? null,
});
}