The truly free, open-source, local-first, cross-platform CapCut replacement. Scriptable through a JSON-RPC API & MCP.
Rust ffmpegfree-video-editormodel-context-protocolnon-linear-editoroffline-firstopen-source-video-editorself-hostedvideo-editingvideo-editing-automationvideo-editing-softwarevideo-editing-toolsvideo-editorvoice-cloningyoutube-automationyoutube-shorts
// SPDX-License-Identifier: AGPL-3.0-or-later
// SPDX-FileCopyrightText: 2026 Jareer Abdullah and Concat contributors
import { Theme } from "../theme/theme.slint";
import { Glyph, Icon } from "../icons.slint";
import { CopyChip } from "modal.slint";
// The bottom-right notice.
//
// Rises in, holds, sinks out. One at a time, and the next one replaces the
// one before it rather than stacking under it: a column of notices is a log,
// and what this is for is the one sentence about what just happened.
/// A notice, as Rust hands it down.
export struct ToastData {
/// Bumped once per notice, and the only thing the layer watches. It is
/// what lets the same sentence be said twice — "Project saved" after two
/// saves is two notices, and a message compared against the last one would
/// show the first and swallow the second.
token: int,
message: string,
/// Failed notices are red and hold long enough to actually be read;
/// confirmations only need a glance.
failed: bool,
}
export component ToastLayer inherits Rectangle {
in property <ToastData> data;
/// Two holds, which are the reason this is a property at all: an error you
/// missed is an error you go looking for.
property <duration> hold: root.data.failed ? 6500ms : 3500ms;
/// Up and lit. Everything the toast does is this property animating.
property <bool> shown;
/// The one frame the risen toast spends at its start position, so the move
/// to `shown` animates rather than teleports — Slint gives a property its
/// first value without running its animation.
property <bool> raising;
/// Watched instead of `data`, so the trigger is one integer changing and
/// not a struct comparison.
property <int> token: root.data.token;
changed token => {
root.shown = false;
root.raising = true;
}
// Nothing here is hit-testable but the copy chip on a failure, and that
// is its own few pixels: the layer sits over the whole window without
// taking an event from it.
background: transparent;
Timer {
interval: 16ms;
running: root.raising;
triggered => {
root.raising = false;
root.shown = true;
}
}
// Stops itself: the trigger clears the flag it is running on. An idle
// window is left with no timer ticking in it, which is the same rule the
// tooltip layer's cooldown follows.
Timer {
interval: root.hold;
running: root.shown;
triggered => { root.shown = false; }
}
/// Measured rather than estimated, the way the tooltip's bubble is: a Text
/// parked at zero size still reports the width the string wants in the
/// real face, so the box can be sized before anything is placed.
measure := Text {
x: 0;
y: 0;
width: 0px;
height: 0px;
text: root.data.message;
font-size: Theme.fs;
visible: false;
}
Rectangle {
// 16px off both edges. The 12px it is pushed down by when it is away
// is the rise.
x: root.width - self.width - 16px;
y: root.height - self.height - 16px + (root.shown ? 0px : 12px);
// Capped, then the label elides: a notice is a sentence, and one long
// enough to reach across the window has stopped being one. A failure
// keeps room for its copy chip.
width: Math.min(root.width - 32px,
12px + icon.width + 8px + measure.preferred-width + 12px
+ (root.data.failed ? 60px : 0px));
// 12px by 8px of padding around a 16px line.
height: 32px;
border-radius: Theme.r-lg;
// Elevated and ringed, because it floats over panes that are
// themselves `panel` — the same reason the tooltip and the menus are.
// Slint has no drop shadow, so the hairline does the lifting alone and
// is the strong one for it.
background: Theme.raised;
border-width: 1px;
border-color: Theme.line-strong;
opacity: root.shown ? 1.0 : 0.0;
// Never up before there is something to say. Also what keeps the very
// first frame of the window from carrying an empty box.
visible: root.data.message != "";
// Out is slower than in: a notice arriving should catch the eye, and
// one leaving should not.
animate y, opacity {
duration: root.shown ? 260ms : 420ms;
easing: ease-out;
}
icon := Icon {
x: 12px;
y: (parent.height - self.height) / 2;
glyph: root.data.failed ? Glyph.close : Glyph.check;
size: 13px;
tint: root.data.failed ? Theme.danger : Theme.green;
}
Text {
x: icon.x + icon.width + 8px;
y: 0;
width: parent.width - self.x - 12px - (root.data.failed ? 60px : 0px);
height: parent.height;
text: root.data.message;
color: root.data.failed ? Theme.danger : Theme.fg;
font-size: Theme.fs;
vertical-alignment: center;
overflow: elide;
}
// A failure can be lifted off the screen whole, elided or not: what
// the chip copies is the message, not what fitted.
if root.data.failed: CopyChip {
x: parent.width - self.width - 6px;
y: (parent.height - self.height) / 2;
text: root.data.message;
}
}
}