Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
fix isRecording
Brendan Allan7ee880e09469
diff --git a/apps/desktop-solid/src-tauri/src/editor_instance.rs b/apps/desktop-solid/src-tauri/src/editor_instance.rsindex fc86f7b7d..828033a3c 100644--- a/apps/desktop-solid/src-tauri/src/editor_instance.rs+++ b/apps/desktop-solid/src-tauri/src/editor_instance.rs@@ -1,10 +1,9 @@use crate::playback::{self, PlaybackHandle};use crate::project_recordings::ProjectRecordings;use crate::{editor, AudioData};-use cap_project::{ProjectConfiguration, RecordingMeta};+use cap_project::ProjectConfiguration;use cap_rendering::decoder::AsyncVideoDecoder;use cap_rendering::{ProjectUniforms, RecordingDecoders, RenderOptions, RenderVideoConstants};-use ffmpeg_next::Rational;use std::ops::Deref;use std::sync::atomic::AtomicBool;use std::{path::PathBuf, process::Command, sync::Arc};diff --git a/apps/desktop-solid/src-tauri/src/lib.rs b/apps/desktop-solid/src-tauri/src/lib.rsindex f09b55dfc..84c7f6836 100644--- a/apps/desktop-solid/src-tauri/src/lib.rs+++ b/apps/desktop-solid/src-tauri/src/lib.rs@@ -132,6 +132,8 @@ impl App {pub fn clear_current_recording(&mut self) -> Option<InProgressRecording> {self.close_occluder_window();+ CurrentRecordingChanged(JsonValue::new(&None)).emit(&self.handle).ok();+self.current_recording.take()}@@ -651,6 +653,7 @@ async fn copy_rendered_video_to_clipboard(video_id: String,project: ProjectConfiguration,) -> Result<(), String> {+ println!("copying");let output_path = match get_rendered_video(app.clone(), video_id.clone(), project).await {Ok(path) => {println!("Successfully retrieved rendered video path: {:?}", path);@@ -859,7 +862,7 @@ fn show_previous_recordings_window(app: AppHandle) {.accept_first_mouse(true).content_protected(true).inner_size(- (monitor.size().width as f64) / monitor.scale_factor(),+ 800.0,(monitor.size().height as f64) / monitor.scale_factor(),).position(0.0, 0.0)diff --git a/apps/desktop-solid/src-tauri/src/permissions.rs b/apps/desktop-solid/src-tauri/src/permissions.rsindex 7ea41585e..2a74b7f54 100644--- a/apps/desktop-solid/src-tauri/src/permissions.rs+++ b/apps/desktop-solid/src-tauri/src/permissions.rs@@ -2,7 +2,6 @@ use std::process::Command;use serde::{Deserialize, Serialize};use tauri::{Manager, WebviewUrl, WebviewWindow, Wry};-use tauri_plugin_decorum::WebviewWindowExt;#[derive(Serialize, Deserialize, specta::Type)]#[serde(rename_all = "camelCase")]diff --git a/apps/desktop-solid/src-tauri/src/recording.rs b/apps/desktop-solid/src-tauri/src/recording.rsindex bf762afa1..9f1564367 100644--- a/apps/desktop-solid/src-tauri/src/recording.rs+++ b/apps/desktop-solid/src-tauri/src/recording.rs@@ -2,7 +2,7 @@ use nokhwa::utils::CameraFormat;use serde::Serialize;use specta::Type;use std::time::Instant;-use std::{path::PathBuf, time::SystemTime};+use std::path::PathBuf;use tokio::sync::watch;use crate::{diff --git a/apps/desktop-solid/src-tauri/src/tray.rs b/apps/desktop-solid/src-tauri/src/tray.rsindex ebfb8238d..35940f328 100644--- a/apps/desktop-solid/src-tauri/src/tray.rs+++ b/apps/desktop-solid/src-tauri/src/tray.rs@@ -73,7 +73,7 @@ fn create_prev_recordings_submenu<R: Runtime>(app: &AppHandle<R>) -> tauri::Resulet items: Vec<MenuItemKind<R>> = prev_recordings.iter().filter_map(|path| {- let Ok(meta) = RecordingMeta::load_for_project(&path) else {+ let Ok(meta) = RecordingMeta::load_for_project(path) else {return None;};let pretty_name = meta.pretty_name.clone();@@ -122,7 +122,7 @@ fn get_prev_recordings<R: Runtime>(app: &AppHandle<R>) -> Result<Vec<PathBuf>, treturn Ok(Vec::new());}- let entries = std::fs::read_dir(recordings_dir).map_err(|e| tauri::Error::Io(e))?;+ let entries = std::fs::read_dir(recordings_dir).map_err(tauri::Error::Io)?;Ok(entries.filter_map(Result::ok)@@ -155,7 +155,7 @@ fn get_recording_path_by_pretty_name<R: Runtime>(pretty_name: &str,) -> Option<PathBuf> {get_prev_recordings(app).ok()?.into_iter().find(|path| {- let Ok(meta) = RecordingMeta::load_for_project(&path) else {+ let Ok(meta) = RecordingMeta::load_for_project(path) else {return false;};meta.pretty_name == pretty_namediff --git a/apps/desktop-solid/src/routes/index.tsx b/apps/desktop-solid/src/routes/index.tsxindex 1f007b87f..4b98abdd2 100644--- a/apps/desktop-solid/src/routes/index.tsx+++ b/apps/desktop-solid/src/routes/index.tsx@@ -57,7 +57,7 @@ export default function () {}};- const isRecording = () => !currentRecording.data;+ const isRecording = () => !!currentRecording.data;const toggleRecording = createMutation(() => ({mutationFn: async () => {diff --git a/apps/desktop-solid/src/routes/prev-recordings.tsx b/apps/desktop-solid/src/routes/prev-recordings.tsxindex a0c111399..6790b90a8 100644--- a/apps/desktop-solid/src/routes/prev-recordings.tsx+++ b/apps/desktop-solid/src/routes/prev-recordings.tsx@@ -84,44 +84,30 @@ export default function () {const copyVideo = createMutation(() => ({mutationFn: async () => {- try {- await commands.copyRenderedVideoToClipboard(- videoId,- presets.getDefaultConfig() ?? DEFAULT_PROJECT_CONFIG- );- } catch (error) {- console.error("Failed to copy to clipboard", error);- window.alert("Failed to copy to clipboard");- } finally {- }+ await commands.copyRenderedVideoToClipboard(+ videoId,+ presets.getDefaultConfig() ?? DEFAULT_PROJECT_CONFIG+ );},}));const saveVideo = createMutation(() => ({mutationFn: async () => {- try {- const renderedPath = await commands.getRenderedVideo(- videoId,- presets.getDefaultConfig() ?? DEFAULT_PROJECT_CONFIG- );+ const renderedPath = await commands.getRenderedVideo(+ videoId,+ presets.getDefaultConfig() ?? DEFAULT_PROJECT_CONFIG+ );- if (renderedPath.status !== "ok")- throw new Error("Failed to get rendered video path");+ if (renderedPath.status !== "ok")+ throw new Error("Failed to get rendered video path");- const savePath = await save({- filters: [{ name: "MP4 Video", extensions: ["mp4"] }],- });+ const savePath = await save({+ filters: [{ name: "MP4 Video", extensions: ["mp4"] }],+ });- if (!savePath) return false;+ if (!savePath) return false;- await commands.copyFileToPath(- renderedPath.data,- savePath- );- } catch (error) {- console.error("Failed to save recording:", error);- window.alert("Failed to save recording");- }+ await commands.copyFileToPath(renderedPath.data, savePath);return true;},diff --git a/apps/desktop-solid/src/utils/queries.ts b/apps/desktop-solid/src/utils/queries.tsindex 7f8ff216e..d2b9978f4 100644--- a/apps/desktop-solid/src/utils/queries.ts+++ b/apps/desktop-solid/src/utils/queries.ts@@ -22,7 +22,7 @@ const getCurrentRecording = queryOptions({queryKey: ["currentRecording"] as const,queryFn: async () => {const o = await commands.getCurrentRecording();- if (o.status === "ok") return o.data;+ if (o.status === "ok") return o.data[0];},});diff --git a/crates/project/src/lib.rs b/crates/project/src/lib.rsindex 1275d4304..0732ef814 100644--- a/crates/project/src/lib.rs+++ b/crates/project/src/lib.rs@@ -1,6 +1,6 @@mod configuration;-use std::{io, path::PathBuf};+use std::path::PathBuf;pub use configuration::*;use serde::{Deserialize, Serialize};