Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

remove screenshots + improve timeline

Brendan Allane2a967912af2
diff --git a/apps/desktop/src-tauri/src/hotkeys.rs b/apps/desktop/src-tauri/src/hotkeys.rs
index 637248d14..df4cdc169 100644
--- a/apps/desktop/src-tauri/src/hotkeys.rs
+++ b/apps/desktop/src-tauri/src/hotkeys.rs
@@ -48,7 +48,7 @@ pub enum HotkeyAction {
StartRecording,
StopRecording,
RestartRecording,
- TakeScreenshot,
+ // TakeScreenshot,
}
#[derive(Serialize, Deserialize, Type, Default)]
@@ -89,10 +89,9 @@ pub fn init(app: &AppHandle) {
}
HotkeyAction::RestartRecording => {
let _ = RequestRestartRecording.emit(app);
- }
- HotkeyAction::TakeScreenshot => {
- let _ = RequestNewScreenshot.emit(app);
- }
+ } // HotkeyAction::TakeScreenshot => {
+ // let _ = RequestNewScreenshot.emit(app);
+ // }
}
}
}
diff --git a/apps/desktop/src-tauri/src/tray.rs b/apps/desktop/src-tauri/src/tray.rs
index 9e9e095cb..dae6b3cf3 100644
--- a/apps/desktop/src-tauri/src/tray.rs
+++ b/apps/desktop/src-tauri/src/tray.rs
@@ -77,13 +77,13 @@ pub fn create_tray(app: &AppHandle) -> tauri::Result<()> {
true,
None::<&str>,
)?,
- &MenuItem::with_id(
- app,
- TrayItem::TakeScreenshot,
- "Take Screenshot",
- true,
- None::<&str>,
- )?,
+ // &MenuItem::with_id(
+ // app,
+ // TrayItem::TakeScreenshot,
+ // "Take Screenshot",
+ // true,
+ // None::<&str>,
+ // )?,
&MenuItem::with_id(
app,
TrayItem::PreviousRecordings,
diff --git a/apps/desktop/src/routes/(window-chrome)/settings/hotkeys.tsx b/apps/desktop/src/routes/(window-chrome)/settings/hotkeys.tsx
index 206891266..f8f24a797 100644
--- a/apps/desktop/src/routes/(window-chrome)/settings/hotkeys.tsx
+++ b/apps/desktop/src/routes/(window-chrome)/settings/hotkeys.tsx
@@ -24,7 +24,7 @@ const ACTION_TEXT: Record<HotkeyAction, string> = {
startRecording: "Start Recording",
stopRecording: "Stop Recording",
restartRecording: "Restart Recording",
- takeScreenshot: "Take Screenshot",
+ // takeScreenshot: "Take Screenshot",
};
export default function () {
@@ -80,7 +80,7 @@ function Inner(props: { initialStore: HotkeysStore | null }) {
"startRecording",
"stopRecording",
"restartRecording",
- "takeScreenshot",
+ // "takeScreenshot",
] as Array<HotkeyAction>
}
>
diff --git a/apps/desktop/src/routes/editor/ConfigSidebar.tsx b/apps/desktop/src/routes/editor/ConfigSidebar.tsx
index 00b8581ee..3794d23f0 100644
--- a/apps/desktop/src/routes/editor/ConfigSidebar.tsx
+++ b/apps/desktop/src/routes/editor/ConfigSidebar.tsx
@@ -442,7 +442,8 @@ export function ConfigSidebar() {
<div
class={cx(
"flex justify-center relative border-transparent border z-10 items-center rounded-md size-9 transition will-change-transform",
- selectedTab() !== item.id && "group-hover:border-gray-300"
+ selectedTab() !== item.id &&
+ "group-hover:border-gray-300 group-disabled:border-none"
)}
>
<Dynamic component={item.icon} />
diff --git a/apps/desktop/src/routes/editor/Editor.tsx b/apps/desktop/src/routes/editor/Editor.tsx
index 5f30e89e3..724bfc03d 100644
--- a/apps/desktop/src/routes/editor/Editor.tsx
+++ b/apps/desktop/src/routes/editor/Editor.tsx
@@ -121,7 +121,7 @@ function Inner() {
<>
<Header />
<div
- class="flex overflow-y-hidden flex-col flex-1 gap-2 pb-2 w-full leading-5 animate-in fade-in"
+ class="flex overflow-y-hidden flex-col flex-1 gap-2 pb-4 w-full leading-5 animate-in fade-in"
data-tauri-drag-region
>
<div class="flex overflow-hidden flex-col flex-1">
diff --git a/apps/desktop/src/routes/editor/Timeline/ClipTrack.tsx b/apps/desktop/src/routes/editor/Timeline/ClipTrack.tsx
index 52a67940d..8116c3668 100644
--- a/apps/desktop/src/routes/editor/Timeline/ClipTrack.tsx
+++ b/apps/desktop/src/routes/editor/Timeline/ClipTrack.tsx
@@ -48,7 +48,8 @@ export function ClipTrack(props: Pick<ComponentProps<"div">, "ref">) {
<SegmentRoot
class={cx(
"overflow-hidden border border-transparent transition-colors duration-300 group",
- "hover:border-gray-500"
+ "hover:border-gray-500",
+ "bg-gradient-to-r timeline-gradient-border from-[#2675DB] via-[#4FA0FF] to-[#2675DB] shadow-[inset_0_5px_10px_5px_rgba(255,255,255,0.2)]"
)}
innerClass="ring-blue-300"
segment={{
@@ -85,10 +86,7 @@ export function ClipTrack(props: Pick<ComponentProps<"div">, "ref">) {
<SegmentHandle
position="start"
- class={cx(
- "absolute inset-y-0 z-10 opacity-0",
- "group-hover:opacity-100"
- )}
+ class="opacity-0 group-hover:opacity-100"
onMouseDown={(downEvent) => {
const start = segment.start;
@@ -147,7 +145,7 @@ export function ClipTrack(props: Pick<ComponentProps<"div">, "ref">) {
});
}}
/>
- <SegmentContent class="justify-center items-center relative dark:text-black-transparent-60 text-white-transparent-60 bg-gradient-to-r timeline-gradient-border from-[#2675DB] via-[#4FA0FF] to-[#2675DB] shadow-[inset_0_5px_10px_5px_rgba(255,255,255,0.2)]">
+ <SegmentContent class="justify-center items-center relative dark:text-black-transparent-60 text-white-transparent-60">
<Show when={segment.start > 0}>
<span class="text-black-transparent-60 text-[0.625rem] absolute top-[18px] left-5">
{formatTime(segment.start)}
@@ -177,10 +175,7 @@ export function ClipTrack(props: Pick<ComponentProps<"div">, "ref">) {
</SegmentContent>
<SegmentHandle
position="end"
- class={cx(
- "absolute inset-y-0 z-10 opacity-0",
- "group-hover:opacity-100"
- )}
+ class="opacity-0 group-hover:opacity-100"
onMouseDown={(downEvent) => {
const end = segment.end;
diff --git a/apps/desktop/src/routes/editor/Timeline/Track.tsx b/apps/desktop/src/routes/editor/Timeline/Track.tsx
index 65bdf7e8c..9b7790717 100644
--- a/apps/desktop/src/routes/editor/Timeline/Track.tsx
+++ b/apps/desktop/src/routes/editor/Timeline/Track.tsx
@@ -106,17 +106,20 @@ export function SegmentHandle(
props: ComponentProps<"div"> & { position: "start" | "end" }
) {
const ctx = useSegmentContext();
+ const hidden = () => ctx.width() < 80;
+
return (
<div
{...props}
class={cx(
- "w-3 cursor-col-resize shrink-0 data-[hidden='true']:opacity-0 transition-opacity h-full flex flex-row items-center",
+ "w-3 cursor-col-resize shrink-0 transition-opacity h-full flex flex-row items-center",
props.position === "start"
? "left-0 justify-end"
: "right-0 justify-start",
+ hidden() ? "opacity-0" : "opacity-0 group-hover:opacity-100",
props.class
)}
- data-hidden={ctx.width() < 50}
+ data-hidden={hidden()}
>
<div class="w-[3px] h-8 bg-solid-white rounded-full" />
</div>
diff --git a/apps/desktop/src/routes/editor/Timeline/ZoomTrack.tsx b/apps/desktop/src/routes/editor/Timeline/ZoomTrack.tsx
index 127664431..048435075 100644
--- a/apps/desktop/src/routes/editor/Timeline/ZoomTrack.tsx
+++ b/apps/desktop/src/routes/editor/Timeline/ZoomTrack.tsx
@@ -226,7 +226,6 @@ export function ZoomTrack(props: {
>
<SegmentHandle
position="start"
- class="absolute opacity-0 group-hover:opacity-100"
onMouseDown={createMouseDownDrag(
() => {
const start = segment.start;
@@ -264,7 +263,7 @@ export function ZoomTrack(props: {
)}
/>
<SegmentContent
- class="flex justify-center items-center cursor-pointer"
+ class="flex justify-center items-center cursor-grab"
onMouseDown={createMouseDownDrag(
() => {
const original = { ...segment };
@@ -307,7 +306,7 @@ export function ZoomTrack(props: {
return (
<Show when={ctx.width() > 100}>
- <div class="flex flex-col gap-1 justify-center items-center text-xs text-gray-50 whitespace-nowrap dark:text-gray-500">
+ <div class="flex flex-col gap-1 justify-center items-center text-xs text-gray-50 whitespace-nowrap dark:text-gray-500 animate-in fade-in">
<span class="opacity-70">Zoom</span>
<div class="flex gap-1 items-center text-md">
<IconLucideSearch class="size-3.5" />{" "}
@@ -320,7 +319,6 @@ export function ZoomTrack(props: {
</SegmentContent>
<SegmentHandle
position="end"
- class="absolute opacity-0 group-hover:opacity-100"
onMouseDown={createMouseDownDrag(
() => {
const end = segment.end;
diff --git a/apps/desktop/src/routes/editor/Timeline/index.tsx b/apps/desktop/src/routes/editor/Timeline/index.tsx
index 711302f7e..2e6cf1ac4 100644
--- a/apps/desktop/src/routes/editor/Timeline/index.tsx
+++ b/apps/desktop/src/routes/editor/Timeline/index.tsx
@@ -11,7 +11,7 @@ import { ZoomSegmentDragState, ZoomTrack } from "./ZoomTrack";
import { ClipTrack } from "./ClipTrack";
import { useEditorContext } from "../context";
-const TIMELINE_PADDING = 8;
+const TIMELINE_PADDING = 16;
export function Timeline() {
const {
@@ -240,7 +240,7 @@ function TimelineMarkings() {
return Array.from(
{ length: 2 + (state.timelineTransform.zoom + 5) / markingResolution() },
(_, i) =>
- state.timelineTransform.position - diff + i * markingResolution()
+ state.timelineTransform.position - diff + (i + 0) * markingResolution()
);
};
@@ -248,7 +248,7 @@ function TimelineMarkings() {
<div class="relative mb-1 h-4 text-xs">
<For each={timelineMarkings()}>
{(second) => (
- <>
+ <Show when={second > 0}>
<div
class="absolute bottom-1 left-0 text-center rounded-full w-1 h-1 bg-[--text-tertiary] text-[--text-tertiary]"
style={{
@@ -264,7 +264,7 @@ function TimelineMarkings() {
</div>
</Show>
</div>
- </>
+ </Show>
)}
</For>
</div>
diff --git a/apps/desktop/src/utils/tauri.ts b/apps/desktop/src/utils/tauri.ts
index 51f5e0023..66c060958 100644
--- a/apps/desktop/src/utils/tauri.ts
+++ b/apps/desktop/src/utils/tauri.ts
@@ -269,7 +269,7 @@ openEditorAfterRecording?: boolean }
export type HapticPattern = "Alignment" | "LevelChange" | "Generic"
export type HapticPerformanceTime = "Default" | "Now" | "DrawCompleted"
export type Hotkey = { code: string; meta: boolean; ctrl: boolean; alt: boolean; shift: boolean }
-export type HotkeyAction = "startRecording" | "stopRecording" | "restartRecording" | "takeScreenshot"
+export type HotkeyAction = "startRecording" | "stopRecording" | "restartRecording"
export type HotkeysConfiguration = { show: boolean }
export type HotkeysStore = { hotkeys: { [key in HotkeyAction]: Hotkey } }
export type InstantRecordingMeta = { fps: number; sample_rate: number | null }
diff --git a/crates/editor/src/playback.rs b/crates/editor/src/playback.rs
index 2ca720212..82d6815d3 100644
--- a/crates/editor/src/playback.rs
+++ b/crates/editor/src/playback.rs
@@ -94,7 +94,6 @@ impl Playback {
_ = stop_rx.changed() => { break; },
data = segment.decoders.get_frames(segment_time as f32, !project.camera.hide) => { data }
};
- debug!("decoded frame {segment_time} in {:?}", now.elapsed());
if let Some(segment_frames) = data {
let now = Instant::now();
@@ -109,11 +108,7 @@ impl Playback {
self.renderer
.render_frame(segment_frames, uniforms, segment.cursor.clone())
.await;
-
- debug!("rendered frame {segment_time} in {:?}", now.elapsed());
}
-
- debug!("frame {segment_time} done in {:?}", now.elapsed());
}
tokio::time::sleep_until(
diff --git a/crates/rendering/src/decoder/avassetreader.rs b/crates/rendering/src/decoder/avassetreader.rs
index 91131b090..6fd81e3b5 100644
--- a/crates/rendering/src/decoder/avassetreader.rs
+++ b/crates/rendering/src/decoder/avassetreader.rs
@@ -361,10 +361,11 @@ impl AVAssetReaderDecoder {
}
if current_frame > requested_frame && sender.is_some() {
- if let Some((sender, last_sent_frame)) = last_sent_frame
- .borrow()
- .clone()
- .and_then(|l| Some((sender.take()?, l)))
+ // not inlining this is important so that last_sent_frame is dropped before the sender is invoked
+ let last_sent_frame = last_sent_frame.borrow().clone();
+
+ if let Some((sender, last_sent_frame)) =
+ last_sent_frame.and_then(|l| Some((sender.take()?, l)))
{
// info!(
// "sending previous frame {} for {requested_frame}",
@@ -390,9 +391,9 @@ impl AVAssetReaderDecoder {
this.is_done = true;
- if let Some((sender, last_sent_frame)) =
- sender.take().zip(last_sent_frame.borrow().clone())
- {
+ // not inlining this is important so that last_sent_frame is dropped before the sender is invoked
+ let last_sent_frame = last_sent_frame.borrow().clone();
+ if let Some((sender, last_sent_frame)) = sender.take().zip(last_sent_frame) {
// info!(
// "sending hail mary frame {} for {requested_frame}",
// last_sent_frame.0
diff --git a/scripts/env-cli.js b/scripts/env-cli.js
index d41910eb9..585c2d6d6 100644
--- a/scripts/env-cli.js
+++ b/scripts/env-cli.js
@@ -153,6 +153,8 @@ async function main() {
}
if (hasDesktop) {
+ envs.RUST_BACKTRACE = "1";
+
const values = await group(
{
VITE_VERCEL_AUTOMATION_BYPASS_SECRET: () => {