Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
rework titlebar (#395)
Brendan Allan70bb7c2a4009
diff --git a/apps/desktop/src-tauri/src/general_settings.rs b/apps/desktop/src-tauri/src/general_settings.rsindex 09185dd9b..6caa5651d 100644--- a/apps/desktop/src-tauri/src/general_settings.rs+++ b/apps/desktop/src-tauri/src/general_settings.rs@@ -34,6 +34,8 @@ pub struct GeneralSettingsStore {pub commercial_license: Option<CommercialLicense>,#[serde(default)]pub last_version: Option<String>,+ #[serde(default)]+ pub window_transparency: bool,}#[derive(Serialize, Deserialize, Type, Debug)]@@ -60,6 +62,7 @@ impl Default for GeneralSettingsStore {theme: AppTheme::System,commercial_license: None,last_version: None,+ window_transparency: false,}}}diff --git a/apps/desktop/src-tauri/src/lib.rs b/apps/desktop/src-tauri/src/lib.rsindex 2e79441d9..aa3674f17 100644--- a/apps/desktop/src-tauri/src/lib.rs+++ b/apps/desktop/src-tauri/src/lib.rs@@ -82,6 +82,7 @@ use tracing_subscriber::util::SubscriberInitExt;use tracing_subscriber::Layer;use upload::{get_s3_config, upload_image, upload_video, S3UploadMeta};use web_api::ManagerExt as WebManagerExt;+use windows::set_window_transparent;use windows::{CapWindowId, ShowCapWindow};#[derive(specta::Type, Serialize)]@@ -1061,10 +1062,6 @@ async fn get_video_metadata(fn open_editor(app: AppHandle, id: String) {println!("Opening editor for recording: {}", id);- if let Some(window) = CapWindowId::Camera.get(&app) {- window.close().ok();- }-ShowCapWindow::Editor { project_id: id }.show(&app).unwrap();}@@ -1928,9 +1925,9 @@ async fn reupload_instant_video(app: AppHandle, video_id: String) -> Result<(),video_id,recording_dir.join("content/output.mp4"),config,- false,+ None,)- .await;+ .await?;Ok(())}@@ -2091,7 +2088,8 @@ pub async fn run(recording_logging_handle: LoggingHandle) {list_fails,set_fail,update_auth_plan,- reupload_instant_video+ reupload_instant_video,+ set_window_transparent]).events(tauri_specta::collect_events![RecordingOptionsChanged,diff --git a/apps/desktop/src-tauri/src/recording.rs b/apps/desktop/src-tauri/src/recording.rsindex 0a6df70e0..114f40ead 100644--- a/apps/desktop/src-tauri/src/recording.rs+++ b/apps/desktop/src-tauri/src/recording.rs@@ -217,6 +217,7 @@ pub async fn start_recording(let _ = ShowCapWindow::WindowCaptureOccluder.show(&app);}+ let (finish_upload_tx, finish_upload_rx) = flume::bounded(1);let progressive_upload = video_upload_info.as_ref().filter(|_| matches!(recording_options.mode, RecordingMode::Instant))@@ -226,6 +227,7 @@ pub async fn start_recording(id.clone(),recording_dir.join("content/output.mp4"),video_upload_info.clone(),+ Some(finish_upload_rx),)});@@ -301,6 +303,8 @@ pub async fn start_recording(fail!("recording::wait_actor_done");actor_done_rx.await.ok();+ let _ = finish_upload_tx.send(());+let mut state = state_mtx.write().await;// this clears the current recording for usdiff --git a/apps/desktop/src-tauri/src/upload.rs b/apps/desktop/src-tauri/src/upload.rsindex b4736c493..5acd49758 100644--- a/apps/desktop/src-tauri/src/upload.rs+++ b/apps/desktop/src-tauri/src/upload.rs@@ -1,6 +1,7 @@// credit @filleduchaosuse cap_utils::spawn_actor;+use flume::Receiver;use futures::stream;use image::codecs::jpeg::JpegEncoder;use image::ImageReader;@@ -17,6 +18,7 @@ use tokio::sync::mpsc;use tokio::sync::RwLock;use tokio::task;use tokio::time::sleep;+use tracing::{info, trace, warn};use crate::web_api::{self, ManagerExt};@@ -815,9 +817,16 @@ impl InstantMultipartUpload {video_id: String,file_path: PathBuf,pre_created_video: VideoUploadInfo,+ realtime_upload_done: Option<Receiver<()>>,) -> Self {Self {- handle: spawn_actor(Self::run(app, video_id, file_path, pre_created_video, true)),+ handle: spawn_actor(Self::run(+ app,+ video_id,+ file_path,+ pre_created_video,+ realtime_upload_done,+ )),}}@@ -826,39 +835,13 @@ impl InstantMultipartUpload {video_id: String,file_path: PathBuf,pre_created_video: VideoUploadInfo,- // whether the video is being created at the same time as uploaded- realtime_uploading: bool,+ realtime_video_done: Option<Receiver<()>>,) -> Result<(), String> {dbg!(&video_id, &file_path);use std::time::Duration;use tokio::sync::mpsc;use tokio::time::sleep;- // --------------------------------------------- // listen for a "RecordingStopped" signal. We'll- // finalize only after we know there's no more- // incoming data from the pipeline (plus we do- // an extra stabilization check).- // --------------------------------------------- let (recording_end_tx, mut recording_end_rx) = mpsc::channel::<()>(1);-- RecordingStopped::listen_any(&app.clone(), {- let app = app.clone();- move |_| {- let tx = recording_end_tx.clone();- let app = app.clone();-- tokio::spawn(async move {- let state = app.state::<Arc<RwLock<App>>>();- let app_state = state.read().await;- if app_state.current_recording.is_none() {- // Recording truly ended- let _ = tx.send(()).await;- }- });- }- });-// --------------------------------------------// basic constants and info for chunk approach// --------------------------------------------@@ -871,40 +854,8 @@ impl InstantMultipartUpload {let mut part_number = 1;let mut last_uploaded_position: u64 = 0;- let mut upload_complete = false;- let mut recording_stopped = false;-println!("Starting multipart upload for {video_id}...");- // --------------------------------------------- // wait until the file hits 5MB or more- // before initiating the multipart upload.- // --------------------------------------------- loop {- if !file_path.exists() {- println!("File does not exist yet, waiting...");- sleep(Duration::from_millis(500)).await;- continue;- }- match tokio::fs::metadata(&file_path).await {- Ok(metadata) => {- if metadata.len() < MIN_PART_SIZE {- sleep(Duration::from_millis(500)).await;- continue;- } else {- break;- }- }- Err(e) => {- println!("Failed to get file metadata: {}", e);- sleep(Duration::from_millis(500)).await;- }- }- }-- // Copy link to clipboard early- let _ = app.clipboard().write_text(pre_created_video.link.clone());-// --------------------------------------------// initiate the multipart upload// --------------------------------------------@@ -957,20 +908,32 @@ impl InstantMultipartUpload {println!("Multipart upload initiated with ID: {}", upload_id);+ let mut realtime_is_done = realtime_video_done.as_ref().map(|_| false);+// --------------------------------------------// Main loop while upload not complete:// - If we have >= CHUNK_SIZE new data, upload.// - If recording hasn't stopped, keep waiting.// - If recording stopped, do leftover final(s).// --------------------------------------------- while !upload_complete {- if !recording_stopped {- // Check if the recording pipeline is done- if let Ok(_) = recording_end_rx.try_recv() {- println!("Recording end detected, will finalize soon.");- recording_stopped = true;+ loop {+ if !realtime_is_done.unwrap_or(true) {+ if let Some(realtime_video_done) = &realtime_video_done {+ match realtime_video_done.try_recv() {+ Ok(_) => {+ realtime_is_done = Some(true);+ }+ Err(flume::TryRecvError::Empty) => {}+ _ => {+ warn!("cancelling upload as realtime generation failed");+ return Err(+ "cancelling upload as realtime generation failed".to_string()+ );+ }+ }}}+ dbg!(realtime_is_done);// Check the file's current sizeif !file_path.exists() {@@ -987,9 +950,12 @@ impl InstantMultipartUpload {}};- let new_data_size = file_size.saturating_sub(last_uploaded_position);+ let new_data_size = file_size - last_uploaded_position;- if new_data_size >= CHUNK_SIZE {+ if ((new_data_size >= CHUNK_SIZE)+ || new_data_size > 0 && realtime_is_done.unwrap_or(false))+ || (realtime_is_done.is_none() && new_data_size > 0)+ {// We have a full chunk to sendmatch Self::upload_chunk(&app,@@ -999,7 +965,7 @@ impl InstantMultipartUpload {&upload_id,&mut part_number,&mut last_uploaded_position,- CHUNK_SIZE,+ new_data_size.min(CHUNK_SIZE),).await{@@ -1014,138 +980,9 @@ impl InstantMultipartUpload {sleep(Duration::from_secs(1)).await;}}- } else {- if realtime_uploading {- // If recording is not done, keep waiting a bit- if !recording_stopped {- sleep(Duration::from_millis(500)).await;- continue;- }-- // --------------------------------------------- // Recording has stopped. We do repeated- // checks to ensure the file is stable (not- // still growing). Then we keep uploading- // leftover chunks until no more data arrives.- // --------------------------------------------- let max_stabilize_attempts = 8;- let mut attempts = 0;-- // We'll loop to catch any last bits that appear- // after we do a leftover chunk upload.- loop {- // Wait for the file to stabilize- println!("Waiting for file to stabilize...");- let mut stable_count = 0;- let stable_required = 3; // e.g. 3 consecutive stable checks-- // Keep track of last known size- let mut prev_size = tokio::fs::metadata(&file_path)- .await- .map(|md| md.len())- .unwrap_or(0);-- while stable_count < stable_required {- sleep(Duration::from_secs(1)).await;- let size_now = match tokio::fs::metadata(&file_path).await {- Ok(md) => md.len(),- Err(_) => 0,- };- if size_now == prev_size {- stable_count += 1;- } else {- stable_count = 0;- prev_size = size_now;- }- }-- // At this point, the file has stayed the same size- // for ~ stable_required seconds.- let final_size = prev_size;- let leftover_size = final_size.saturating_sub(last_uploaded_position);-- // Double-check moov if you want- // let moov_found = found_moov_atom(&file_path).await;-- if leftover_size > 0 {- if leftover_size >= MIN_PART_SIZE {- // We still have at least 5MB leftover, treat it like a normal part:- println!(- "File stabilized, but leftover >= 5MB. Uploading leftover chunk of {} bytes.",- leftover_size- );- match Self::upload_chunk(- &app,- &client,- &file_path,- &file_key,- &upload_id,- &mut part_number,- &mut last_uploaded_position,- leftover_size, // read leftover- )- .await- {- Ok(part) => {- uploaded_parts.push(part);- }- Err(e) => {- return Err(format!(- "Failed uploading leftover chunk: {}",- e- ));- }- }- } else {- // Less than 5 MB leftover -> final chunk- println!(- "Uploading final leftover chunk of {} bytes before completion",- leftover_size- );- match Self::upload_chunk(- &app,- &client,- &file_path,- &file_key,- &upload_id,- &mut part_number,- &mut last_uploaded_position,- leftover_size,- )- .await- {- Ok(part) => {- uploaded_parts.push(part);- println!(- "Successfully uploaded leftover chunk, part {}",- part_number - 1- );- }- Err(e) => {- return Err(format!(- "Failed to upload leftover chunk: {}",- e- ));- }- }- }-- // We just uploaded a leftover chunk, but let's see- // if more data arrives. We'll try again. If no more- // new data arrives, we can finalize.- attempts += 1;- if attempts > max_stabilize_attempts {- println!(- "Reached maximum leftover attempts, proceeding to finalize."- );- break;- }- } else {- // No leftover. We have stabilized with no new data.- println!("File is stable with no leftover data, finalizing...");- break;- }- }+ } else if new_data_size == 0 && realtime_is_done.unwrap_or(true) {+ if realtime_is_done.unwrap_or(false) {+ info!("realtime video done, uploading header chunk");match Self::upload_chunk(&app,@@ -1184,10 +1021,15 @@ impl InstantMultipartUpload {).await?;- upload_complete = true;+ break;+ } else {+ tokio::time::sleep(Duration::from_secs(1)).await;}}+ // Copy link to clipboard early+ let _ = app.clipboard().write_text(pre_created_video.link.clone());+Ok(())}diff --git a/apps/desktop/src-tauri/src/windows.rs b/apps/desktop/src-tauri/src/windows.rsindex 88bea8ebb..094c113f7 100644--- a/apps/desktop/src-tauri/src/windows.rs+++ b/apps/desktop/src-tauri/src/windows.rs@@ -90,6 +90,8 @@ impl CapWindowId {Self::Editor { .. } => "Cap Editor".to_string(),Self::SignIn => "Cap Sign In".to_string(),Self::ModeSelect => "Cap Mode Selection".to_string(),+ Self::Camera => "Cap Camera".to_string(),+ Self::RecordingsOverlay => "Cap Recordings Overlay".to_string(),_ => "Cap".to_string(),}}@@ -115,8 +117,7 @@ impl CapWindowId {#[cfg(target_os = "macos")]pub fn traffic_lights_position(&self) -> Option<Option<LogicalPosition<f64>>> {match self {- Self::Editor { .. } => Some(Some(LogicalPosition::new(20.0, 40.0))),- Self::Setup => Some(Some(LogicalPosition::new(14.0, 24.0))),+ Self::Editor { .. } => Some(Some(LogicalPosition::new(20.0, 32.0))),Self::InProgressRecording => Some(Some(LogicalPosition::new(-100.0, -100.0))),Self::Camera| Self::WindowCaptureOccluder@@ -209,16 +210,10 @@ impl ShowCapWindow {let window = self.window_builder(app, format!("/editor?id={project_id}")).maximizable(true)- .transparent(cfg!(target_os = "macos")).inner_size(1240.0, 800.0).center().build()?;- let _ = window.set_effects(tauri::utils::config::WindowEffectsConfig {- effects: vec![tauri::window::Effect::HudWindow],- ..Default::default()- });-window}Self::Upgrade => self@@ -250,7 +245,6 @@ impl ShowCapWindow {.shadow(false).fullscreen(false).always_on_top(true)- .title("Cap Camera").visible_on_all_workspaces(true).skip_taskbar(true).position(@@ -625,3 +619,19 @@ impl MonitorExt for Monitor {.any(|(x, y)| x >= left && x < right && y >= top && y < bottom)}}++#[specta::specta]+#[tauri::command(async)]+pub fn set_window_transparent(window: tauri::Window, value: bool) {+ #[cfg(target_os = "macos")]+ {+ let ns_win = window+ .ns_window()+ .expect("Failed to get native window handle")+ as *const objc2_app_kit::NSWindow;++ unsafe {+ (*ns_win).setOpaque(value);+ }+ }+}diff --git a/apps/desktop/src-tauri/tauri.windows.conf.json b/apps/desktop/src-tauri/tauri.windows.conf.jsondeleted file mode 100644index 24bf6f9dc..000000000--- a/apps/desktop/src-tauri/tauri.windows.conf.json+++ /dev/null@@ -1,12 +0,0 @@-{- "bundle": {- "resources": {- "../../../target/ffmpeg/bin/*.dll": "./"- },- "windows": {- "wix": {- "version": "0.3.26"- }- }- }-}\ No newline at end of filediff --git a/apps/desktop/src/components/Loader.tsx b/apps/desktop/src/components/Loader.tsxindex 046020e29..593848525 100644--- a/apps/desktop/src/components/Loader.tsx+++ b/apps/desktop/src/components/Loader.tsx@@ -1,6 +1,6 @@export function AbsoluteInsetLoader() {return (- <div class="w-full h-full flex items-center justify-center bg-gray-100">+ <div class="w-full h-full flex items-center justify-center"><div class="animate-spin"><IconCapLogo class="size-[4rem]" /></div>diff --git a/apps/desktop/src/components/titlebar/Titlebar.tsx b/apps/desktop/src/components/titlebar/Titlebar.tsxindex 947795e13..a387d5b38 100644--- a/apps/desktop/src/components/titlebar/Titlebar.tsx+++ b/apps/desktop/src/components/titlebar/Titlebar.tsx@@ -42,7 +42,7 @@ export default function Titlebar() {);}-function WindowControls(props: ComponentProps<"div">) {+export function WindowControls(props: ComponentProps<"div">) {const [local, otherProps] = splitProps(props, ["class"]);const ostype = type();diff --git a/apps/desktop/src/components/titlebar/controls/CaptionControlsWindows11.tsx b/apps/desktop/src/components/titlebar/controls/CaptionControlsWindows11.tsxindex 5037f4e1a..a9a018f56 100644--- a/apps/desktop/src/components/titlebar/controls/CaptionControlsWindows11.tsx+++ b/apps/desktop/src/components/titlebar/controls/CaptionControlsWindows11.tsx@@ -12,7 +12,7 @@ import { getCurrentWindow } from "@tauri-apps/api/window";import titlebarState from "~/utils/titlebar-state";import { cx } from "cva";-export default function (props: ComponentProps<"div">) {+export default function (props: ComponentProps<"div"> & { maximizable?: boolean }) {const [local, otherProps] = splitProps(props, ["class"]);const currentWindow = getCurrentWindow();const [focused, setFocus] = createSignal(true);@@ -28,7 +28,7 @@ export default function (props: ComponentProps<"div">) {return (<divclass={cx(- "h-full align-baseline cursor-default rounded-none select-none *:outline-none *:transition-all *:duration-200",+ "flex flex-row items-stretch h-full align-baseline cursor-default rounded-none select-none *:outline-none *:transition-all *:duration-200",local.class,focused()? "*:text-black-transparent-80"@@ -47,9 +47,9 @@ export default function (props: ComponentProps<"div">) {><icons.minimizeWin /></ControlButton>- <Show when={titlebarState.maximizable || !titlebarState.hideMaximize}>+ <Show when={titlebarState.maximizable || !titlebarState.hideMaximize || props.maximizable}><ControlButton- disabled={!titlebarState.maximizable}+ disabled={!titlebarState.maximizable || props.maximizable === false}onClick={titlebarState.maximizable? titlebarState.maximizeddiff --git a/apps/desktop/src/routes/(window-chrome).tsx b/apps/desktop/src/routes/(window-chrome).tsxindex 98775c937..0d02f77e0 100644--- a/apps/desktop/src/routes/(window-chrome).tsx+++ b/apps/desktop/src/routes/(window-chrome).tsx@@ -1,10 +1,18 @@import type { RouteSectionProps } from "@solidjs/router";import { UnlistenFn } from "@tauri-apps/api/event";import { getCurrentWindow } from "@tauri-apps/api/window";+import { type as ostype } from "@tauri-apps/plugin-os";+import { cx } from "cva";import { onCleanup, onMount, ParentProps, Suspense } from "solid-js";+import { AbsoluteInsetLoader } from "~/components/Loader";-import Titlebar from "~/components/titlebar/Titlebar";import { initializeTitlebar } from "~/utils/titlebar-state";+import {+ useWindowChromeContext,+ WindowChromeContext,+} from "./(window-chrome)/Context";+import { WindowControls } from "~/components/titlebar/Titlebar";+import CaptionControlsWindows11 from "~/components/titlebar/controls/CaptionControlsWindows11";export const route = {info: {@@ -26,39 +34,62 @@ export default function (props: RouteSectionProps) {});return (- <div class="bg-gray-100 border-gray-200 w-screen h-screen max-h-screen flex flex-col overflow-hidden transition-[border-radius] duration-200">- <Titlebar />- {/* breaks sometimes */}- {/* <Transition+ <WindowChromeContext>+ <div class="bg-gray-100 border-gray-200 w-screen h-screen max-h-screen flex flex-col overflow-hidden transition-[border-radius] duration-200">+ <Header />++ {/* breaks sometimes */}+ {/* <Transitionmode="outin"enterActiveClass="transition-opacity duration-100"exitActiveClass="transition-opacity duration-100"enterClass="opacity-0"exitToClass="opacity-0"> */}- <Suspense- fallback={- (() => {- console.log("Outer window chrome suspense fallback");- return <AbsoluteInsetLoader />;- }) as any- }- >- <Inner>- {/* prevents flicker idk */}- <Suspense- fallback={- (() => {- console.log("Inner window chrome suspense fallback");- }) as any- }- >- {props.children}- </Suspense>- </Inner>- </Suspense>- {/* </Transition> */}- </div>+ <Suspense+ fallback={+ (() => {+ console.log("Outer window chrome suspense fallback");+ return <AbsoluteInsetLoader />;+ }) as any+ }+ >+ <Inner>+ {/* prevents flicker idk */}+ <Suspense+ fallback={+ (() => {+ console.log("Inner window chrome suspense fallback");+ }) as any+ }+ >+ {props.children}+ </Suspense>+ </Inner>+ </Suspense>+ {/* </Transition> */}+ </div>+ </WindowChromeContext>+ );+}++function Header() {+ const ctx = useWindowChromeContext()!;++ const isWindows = ostype() === "windows";++ return (+ <header+ class={cx(+ "flex items-center select-none space-x-1 shrink-0 border-gray-50 bg-gray-100",+ "border-b border-b-black-transparent-5 h-9",+ isWindows ? "flex-row" : "pl-[5rem] flex-row-reverse"+ )}+ data-tauri-drag-region+ >+ {ctx.state()?.items}+ {isWindows && <CaptionControlsWindows11 class="!ml-auto" />}+ </header>);}diff --git a/apps/desktop/src/routes/(window-chrome)/(main).tsx b/apps/desktop/src/routes/(window-chrome)/(main).tsxindex 34335e018..2f83d6fb9 100644--- a/apps/desktop/src/routes/(window-chrome)/(main).tsx+++ b/apps/desktop/src/routes/(window-chrome)/(main).tsx@@ -103,7 +103,7 @@ export default function () {const currentWindow = getCurrentWindow();const MAIN_WINDOW_SIZE = {width: 300,- height: 290 + (window.FLAGS.systemAudioRecording ? 60 : 0),+ height: 290 + (window.FLAGS.systemAudioRecording ? 50 : 0),};// Set initial size@@ -133,9 +133,13 @@ export default function () {unlistenFocus();unlistenResize();};- setTitlebar("hideMaximize", true);- setTitlebar(- "items",++ return null;+ });++ useWindowChrome({+ hideMaximize: true,+ items: (<divdir={ostype() === "windows" ? "rtl" : "rtl"}class="flex gap-1 items-center mx-2"@@ -207,9 +211,7 @@ export default function () {</button>)}</div>- );-- return null;+ ),});return (@@ -323,8 +325,8 @@ import { type as ostype, platform } from "@tauri-apps/plugin-os";import * as updater from "@tauri-apps/plugin-updater";import { Transition } from "solid-transition-group";-import { setTitlebar } from "~/utils/titlebar-state";import { apiClient } from "~/utils/web-api";+import { useWindowChrome } from "./Context";let hasChecked = false;function createUpdateCheck() {diff --git a/apps/desktop/src/routes/(window-chrome)/Context.tsx b/apps/desktop/src/routes/(window-chrome)/Context.tsxnew file mode 100644index 000000000..e16b87727--- /dev/null+++ b/apps/desktop/src/routes/(window-chrome)/Context.tsx@@ -0,0 +1,27 @@+import { createContextProvider } from "@solid-primitives/context";+import { createSignal, JSX, onCleanup } from "solid-js";++interface WindowChromeState {+ hideMaximize?: boolean;+ items?: JSX.Element;+}++export const [WindowChromeContext, useWindowChromeContext] =+ createContextProvider(() => {+ const [state, setState] = createSignal<WindowChromeState>();++ return { state, setState };+ });++export function useWindowChrome(state: WindowChromeState) {+ const ctx = useWindowChromeContext();+ if (!ctx)+ throw new Error(+ "useWindowChrome must be used within a WindowChromeContext"+ );++ ctx.setState?.(state);+ onCleanup(() => {+ ctx.setState?.();+ });+}diff --git a/apps/desktop/src/routes/(window-chrome)/settings/general.tsx b/apps/desktop/src/routes/(window-chrome)/settings/general.tsxindex 94ac0493a..59c96482a 100644--- a/apps/desktop/src/routes/(window-chrome)/settings/general.tsx+++ b/apps/desktop/src/routes/(window-chrome)/settings/general.tsx@@ -1,13 +1,15 @@import { createResource, For, Show } from "solid-js";import { createStore } from "solid-js/store";-import { generalSettingsStore } from "~/store";-import type { AppTheme, GeneralSettingsStore } from "~/utils/tauri";-// import { themeStore } from "~/store/theme";import {isPermissionGranted,requestPermission,} from "@tauri-apps/plugin-notification";import { type OsType, type } from "@tauri-apps/plugin-os";+import "@total-typescript/ts-reset/filter-boolean";++import { generalSettingsStore } from "~/store";+import type { AppTheme, GeneralSettingsStore } from "~/utils/tauri";+// import { themeStore } from "~/store/theme";import themePreviewAuto from "~/assets/theme-previews/auto.jpg";import themePreviewDark from "~/assets/theme-previews/dark.jpg";import themePreviewLight from "~/assets/theme-previews/light.jpg";@@ -20,54 +22,49 @@ const settingsList: Array<{requiresPermission?: boolean;pro?: boolean;onChange?: (value: boolean) => Promise<void>;-}> = [- // {- // key: "autoCreateShareableLink",- // label: "Automatically generate shareable link after recording",- // description:- // "When enabled, a shareable link will be created automatically after stopping the recording. You'll be redirected to the URL while the upload continues in the background.",- // pro: true,- // },- // {- // key: "uploadIndividualFiles",- // label: "Upload individual recording files when creating shareable link",- // description:- // 'Warning: this will cause shareable link uploads to become significantly slower, since all individual recording files will be uploaded. Shows "Download Assets" button in Share page.',- // },- {- key: "openEditorAfterRecording",- label: "Open editor automatically after recording stops",- description:- "The editor will be shown immediately after you finish recording.",- },- {- key: "hideDockIcon",- label: "Hide dock icon",- platforms: ["macos"],- description:- "The dock icon will be hidden when there are no windows available to close.",- },- {- key: "hapticsEnabled",- label: "Enable Haptics",- platforms: ["macos"],- description: "Use haptics on Force Touch™ trackpads",- },- {- key: "disableAutoOpenLinks",- label: "Disable automatic link opening",- description:- "When enabled, Cap will not automatically open links in your browser (e.g. after creating a shareable link).",- pro: true,- },- {- key: "enableNotifications",- label: "Enable System Notifications",- description:- "Show system notifications for events like copying to clipboard, saving files, and more. You may need to manually allow Cap access via your system's notification settings.",- requiresPermission: true,- },-];+}> = (+ [+ {+ key: "openEditorAfterRecording",+ label: "Open editor automatically after recording stops",+ description:+ "The editor will be shown immediately after you finish recording.",+ },+ {+ key: "hideDockIcon",+ label: "Hide dock icon",+ platforms: ["macos"],+ description:+ "The dock icon will be hidden when there are no windows available to close.",+ },+ {+ key: "hapticsEnabled",+ label: "Enable Haptics",+ platforms: ["macos"],+ description: "Use haptics on Force Touch™ trackpads",+ },+ {+ key: "disableAutoOpenLinks",+ label: "Disable automatic link opening",+ description:+ "When enabled, Cap will not automatically open links in your browser (e.g. after creating a shareable link).",+ pro: true,+ },+ {+ key: "enableNotifications",+ label: "Enable System Notifications",+ description:+ "Show system notifications for events like copying to clipboard, saving files, and more. You may need to manually allow Cap access via your system's notification settings.",+ requiresPermission: true,+ },+ type() === "macos" && {+ key: "windowTransparency",+ label: "Enable Window Transparency",+ description:+ "Make the background of some windows (eg. the Editor) transparent",+ },+ ] as const+).filter(Boolean);export default function GeneralSettings() {const [store] = createResource(() => generalSettingsStore.get());diff --git a/apps/desktop/src/routes/(window-chrome)/setup.tsx b/apps/desktop/src/routes/(window-chrome)/setup.tsxindex 37b7e4e27..179e07e05 100644--- a/apps/desktop/src/routes/(window-chrome)/setup.tsx+++ b/apps/desktop/src/routes/(window-chrome)/setup.tsx@@ -17,7 +17,6 @@ import { getCurrentWindow } from "@tauri-apps/api/window";import { commands, OSPermission, type OSPermissionStatus } from "~/utils/tauri";import { makePersisted } from "@solid-primitives/storage";import { createStore } from "solid-js/store";-import { setTitlebar } from "~/utils/titlebar-state";import ModeSelect from "~/components/ModeSelect";function isPermitted(status?: OSPermissionStatus): boolean {@@ -72,12 +71,6 @@ export default function () {setInitialCheck(false);};- onMount(() => {- setTitlebar("height", "50px");- setTitlebar("transparent", true);- setTitlebar("border", false);- });-const [showStartup, showStartupActions] = createResource(() =>generalSettingsStore.get().then((s) => {if (s === undefined) return true;@@ -194,6 +187,7 @@ import { generalSettingsStore } from "~/store";import { Portal } from "solid-js/web";import { cx } from "cva";import { type as ostype } from "@tauri-apps/plugin-os";+import CaptionControlsWindows11 from "~/components/titlebar/controls/CaptionControlsWindows11";function Startup(props: { onClose: () => void }) {const [audioState, setAudioState] = makePersisted(@@ -298,37 +292,36 @@ function Startup(props: { onClose: () => void }) {audio.muted = audioState.isMuted;};- onMount(() => {- setTitlebar("transparent", true);- setTitlebar("border", false);- setTitlebar("height", "50px");- setTitlebar(- "items",- <div- dir={ostype() === "windows" ? "rtl" : "rtl"}- class="flex mx-4 items-center gap-[0.25rem]"- >- <button- onClick={toggleMute}- class={`text-gray-50 hover:text-gray-200 transition-colors ${- isExiting() ? "opacity-0" : ""- }`}- >- {audioState.isMuted ? (- <IconLucideVolumeX class="w-6 h-6" />- ) : (- <IconLucideVolume2 class="w-6 h-6" />- )}- </button>- </div>- );- });-- onCleanup(() => setTitlebar("items", null));-return (<Portal><div class="absolute inset-0 z-40">+ <header+ class="absolute top-0 inset-x-0 h-12 z-10"+ data-tauri-drag-region+ >+ <div+ class={cx(+ "flex justify-between items-center gap-[0.25rem] w-full h-full z-10",+ ostype() === "windows" ? "flex-row" : "flex-row-reverse"+ )}+ data-tauri-drag-region+ >+ <button+ onClick={toggleMute}+ class={cx(+ "mx-4 text-solid-white hover:text-[#DDD] transition-colors",+ isExiting() && "opacity-0"+ )}+ >+ {audioState.isMuted ? (+ <IconLucideVolumeX class="w-6 h-6" />+ ) : (+ <IconLucideVolume2 class="w-6 h-6" />+ )}+ </button>+ {ostype() === "windows" && <CaptionControlsWindows11 />}+ </div>+ </header><style>{`body {@@ -425,7 +418,7 @@ function Startup(props: { onClose: () => void }) {<divstyle={{ "transition-duration": "600ms" }}class={cx(- "flex flex-col h-screen custom-bg relative overflow-hidden transition-opacity",+ "flex flex-col h-screen custom-bg relative overflow-hidden transition-opacity text-solid-white",isExiting() && "exiting opacity-0")}>@@ -471,7 +464,7 @@ function Startup(props: { onClose: () => void }) {{/* Main content */}<div- class={`content-container flex flex-col items-center justify-center flex-1 relative z-10 px-4 ${+ class={`content-container flex flex-col items-center justify-center flex-1 relative px-4 ${isExiting() ? "exiting" : ""}`}>@@ -485,10 +478,10 @@ function Startup(props: { onClose: () => void }) {${isLogoAnimating() ? "logo-bounce" : ""}`}/></div>- <h1 class="text-5xl md:text-5xl font-bold text-gray-50 mb-4 drop-shadow-[0_0_20px_rgba(0,0,0,0.2)]">+ <h1 class="text-5xl md:text-5xl font-bold mb-4 drop-shadow-[0_0_20px_rgba(0,0,0,0.2)]">Welcome to Cap</h1>- <p class="text-2xl text-gray-50 opacity-80 max-w-md mx-auto drop-shadow-[0_0_20px_rgba(0,0,0,0.2)]">+ <p class="text-2xl opacity-80 max-w-md mx-auto drop-shadow-[0_0_20px_rgba(0,0,0,0.2)]">Beautiful screen recordings, owned by you.</p></div>@@ -520,7 +513,6 @@ function Startup(props: { onClose: () => void }) {</Switch></div></div>- props.onClose()</div></Portal>);diff --git a/apps/desktop/src/routes/editor/ConfigSidebar.tsx b/apps/desktop/src/routes/editor/ConfigSidebar.tsxindex 66662315f..00b8581ee 100644--- a/apps/desktop/src/routes/editor/ConfigSidebar.tsx+++ b/apps/desktop/src/routes/editor/ConfigSidebar.tsx@@ -405,7 +405,7 @@ export function ConfigSidebar() {return (<KTabsvalue={selectedTab()}- class="flex flex-col shrink-0 flex-1 max-w-[26rem] overflow-hidden rounded-xl z-10 bg-gray-100 relative"+ class="flex flex-col shrink-0 flex-1 max-w-[26rem] overflow-hidden rounded-xl z-10 bg-gray-100 relative shadow-sm"><KTabs.List class="flex overflow-hidden relative z-40 flex-row items-center h-16 text-lg border-b border-gray-200 shrink-0"><Fordiff --git a/apps/desktop/src/routes/editor/Editor.tsx b/apps/desktop/src/routes/editor/Editor.tsxindex 75a51c59a..a8bba6f43 100644--- a/apps/desktop/src/routes/editor/Editor.tsx+++ b/apps/desktop/src/routes/editor/Editor.tsx@@ -4,7 +4,6 @@ import { throttle } from "@solid-primitives/scheduled";import { useSearchParams } from "@solidjs/router";import { createMutation } from "@tanstack/solid-query";import { convertFileSrc } from "@tauri-apps/api/core";-import { type as ostype } from "@tauri-apps/plugin-os";import {Match,Show,@@ -76,7 +75,7 @@ export function Editor() {}function Inner() {- const { project, playbackTime, setPlaybackTime, playing, previewTime } =+ const { project, playbackTime, setPlaybackTime, playing } =useEditorContext();onMount(() => {@@ -99,8 +98,8 @@ function Inner() {}, 1000 / FPS);const frameNumberToRender = createMemo(() => {- const preview = previewTime();- if (preview !== undefined) return preview;+ // const preview = previewTime();+ // if (preview !== undefined) return preview;return playbackTime();});@@ -119,19 +118,14 @@ function Inner() {);return (- <div- class={cx(- "flex flex-col w-screen h-screen",- ostype() === "windows" ? "bg-gray-50" : "bg-transparent-window"- )}- >+ <><Header /><div- class="flex overflow-y-hidden flex-col flex-1 gap-4 p-4 w-full leading-5 animate-in fade-in"+ class="flex overflow-y-hidden flex-col flex-1 pb-2 gap-2 w-full leading-5 animate-in fade-in"data-tauri-drag-region><div class="flex overflow-hidden flex-col flex-1">- <div class="flex overflow-y-hidden flex-row flex-1 gap-4">+ <div class="flex overflow-y-hidden flex-row flex-1 gap-2 px-2 pb-0.5"><Player /><ConfigSidebar /></div>@@ -139,7 +133,7 @@ function Inner() {</div><Dialogs /></div>- </div>+ </>);}diff --git a/apps/desktop/src/routes/editor/Header.tsx b/apps/desktop/src/routes/editor/Header.tsxindex 28ea2b8a3..3f158d347 100644--- a/apps/desktop/src/routes/editor/Header.tsx+++ b/apps/desktop/src/routes/editor/Header.tsx@@ -5,21 +5,15 @@ import { remove } from "@tauri-apps/plugin-fs";import { revealItemInDir } from "@tauri-apps/plugin-opener";import { type as ostype } from "@tauri-apps/plugin-os";import { cx } from "cva";-import {- batch,- createEffect,- createSignal,- onCleanup,- onMount,-} from "solid-js";+import { createEffect, createSignal, onCleanup, onMount } from "solid-js";-import Titlebar from "~/components/titlebar/Titlebar";-import { initializeTitlebar, setTitlebar } from "~/utils/titlebar-state";+import { initializeTitlebar } from "~/utils/titlebar-state";import { useEditorContext } from "./context";import ExportButton from "./ExportButton";import PresetsDropdown from "./PresetsDropdown";import ShareButton from "./ShareButton";import { EditorButton } from "./ui";+import CaptionControlsWindows11 from "~/components/titlebar/controls/CaptionControlsWindows11";export type ResolutionOption = {label: string;@@ -65,74 +59,43 @@ export function Header() {});onCleanup(() => unlistenTitlebar?.());- batch(() => {- setTitlebar("height", "60px");- setTitlebar("border", true);- setTitlebar("transparent", true);- setTitlebar(- "items",- <div- data-tauri-drag-region- class={cx(- "flex flex-row justify-end items-center w-full cursor-default pr-5",- ostype() === "windows" ? "pl-[4.3rem]" : "pl-[1.25rem]"- )}- >- <div class="flex relative z-20 flex-row gap-3 items-center font-medium">- <ShareButton- selectedResolution={selectedResolution}- selectedFps={selectedFps}- />- <ExportButton- selectedResolution={selectedResolution()}- selectedFps={selectedFps()}- setSelectedFps={setSelectedFps}- setSelectedResolution={setSelectedResolution}- />- </div>- </div>- );- });-return (- <div data-tauri-drag-region class="relative w-full">+ <div+ data-tauri-drag-region+ class="relative w-full h-14 flex flex-row items-center"+ ><divdata-tauri-drag-region- class={cx(- "flex absolute z-10 gap-4 items-start w-full h-full",- ostype() === "windows" ? "left-4" : "left-[5.5rem]"- )}+ class={cx("flex-1 h-full flex flex-row items-center gap-2 px-4")}>- <div class="flex gap-2 items-center h-full">- <EditorButton- onClick={async () => {- const currentWindow = getCurrentWindow();- if (!editorContext?.editorInstance.path) return;- if (- !(await ask("Are you sure you want to delete this recording?"))- )- return;- await remove(editorContext?.editorInstance.path, {- recursive: true,- });- await currentWindow.close();- }}- tooltipText="Delete recording"- leftIcon={<IconCapTrash class="w-5" />}- />- <EditorButton- onClick={() =>- revealItemInDir(`${editorContext.editorInstance.path}/`)- }- tooltipText="Open recording bundle"- leftIcon={<IconLucideFolder class="w-5" />}- />+ {ostype() === "macos" && <div class="h-full w-[4rem]" />}+ <EditorButton+ onClick={async () => {+ const currentWindow = getCurrentWindow();+ if (!editorContext?.editorInstance.path) return;+ if (!(await ask("Are you sure you want to delete this recording?")))+ return;+ await remove(editorContext?.editorInstance.path, {+ recursive: true,+ });+ await currentWindow.close();+ }}+ tooltipText="Delete recording"+ leftIcon={<IconCapTrash class="w-5" />}+ />+ <EditorButton+ onClick={() =>+ revealItemInDir(`${editorContext.editorInstance.path}/`)+ }+ tooltipText="Open recording bundle"+ leftIcon={<IconLucideFolder class="w-5" />}+ />- <p class="text-sm text-gray-500">- {editorContext.editorInstance.prettyName}- <span class="text-sm text-gray-400">.cap</span>- </p>- {/* <ErrorBoundary fallback={<></>}>+ <p class="text-sm text-gray-500">+ {editorContext.editorInstance.prettyName}+ <span class="text-sm text-gray-400">.cap</span>+ </p>+ {/* <ErrorBoundary fallback={<></>}><Suspense><spanonClick={async () => {@@ -154,23 +117,7 @@ export function Header() {</span></Suspense></ErrorBoundary> */}- </div>- </div>- <TopBar />- <Titlebar />- </div>- );-}--function TopBar() {- const editorContext = useEditorContext();-- return (- <div- data-tauri-drag-region- class="flex absolute inset-x-0 z-10 items-center mx-auto h-full w-fit"- >- <div class="flex gap-4 items-center px-4 h-full">+ <div data-tauri-drag-region class="flex-1 h-full" /><EditorButtontooltipText="Captions"leftIcon={<IconCapCaptions class="w-5" />}@@ -183,11 +130,20 @@ function TopBar() {/></div>- <div class="flex gap-4 items-center px-4 my-2 border-r border-l border-r-black-transparent-10 border-l-black-transparent-10">+ <div+ data-tauri-drag-region+ class="px-4 border-x border-black-transparent-10 flex flex-col justify-center"+ ><PresetsDropdown /></div>- <div class="flex gap-4 items-center px-4 h-full">+ <div+ data-tauri-drag-region+ class={cx(+ "flex-1 h-full flex flex-row items-center gap-2 pl-2",+ ostype() !== "windows" && "pr-2"+ )}+ ><EditorButtononClick={() => editorContext.history.undo()}disabled={!editorContext.history.canUndo()}@@ -200,6 +156,18 @@ function TopBar() {tooltipText="Redo"leftIcon={<IconCapRedo class="w-5" />}/>+ <div data-tauri-drag-region class="flex-1 h-full" />+ <ShareButton+ selectedResolution={selectedResolution}+ selectedFps={selectedFps}+ />+ <ExportButton+ selectedResolution={selectedResolution()}+ selectedFps={selectedFps()}+ setSelectedFps={setSelectedFps}+ setSelectedResolution={setSelectedResolution}+ />+ {ostype() === "windows" && <CaptionControlsWindows11 />}</div></div>);diff --git a/apps/desktop/src/routes/editor/Player.tsx b/apps/desktop/src/routes/editor/Player.tsxindex 7c32304b8..a14ab782a 100644--- a/apps/desktop/src/routes/editor/Player.tsx+++ b/apps/desktop/src/routes/editor/Player.tsx@@ -95,7 +95,7 @@ export function Player() {});return (- <div class="flex flex-col flex-1 bg-gray-100 dark:bg-gray-100 rounded-xl">+ <div class="flex flex-col flex-1 bg-gray-100 dark:bg-gray-100 rounded-xl shadow-sm"><div class="flex gap-3 justify-center p-3"><AspectRatioSelect /><EditorButtondiff --git a/apps/desktop/src/routes/editor/Timeline.tsx b/apps/desktop/src/routes/editor/Timeline.tsxindex 96e595881..9b216a835 100644--- a/apps/desktop/src/routes/editor/Timeline.tsx+++ b/apps/desktop/src/routes/editor/Timeline.tsx@@ -38,6 +38,7 @@ type ZoomSegmentDragState =const MAX_TIMELINE_MARKINGS = 20;const TIMELINE_MARKING_RESOLUTIONS = [0.5, 1, 2.5, 5, 10, 30];+const TIMELINE_PADDING = 8;export function Timeline() {const {@@ -80,8 +81,6 @@ export function Timeline() {}});- const xPadding = 20;-if (!project.timeline?.zoomSegments ||project.timeline.zoomSegments.length < 1@@ -139,10 +138,10 @@ export function Timeline() {timelineBounds={timelineBounds}><div- class="pt-[2rem] relative overflow-hidden"+ class="pt-[2rem] relative overflow-hidden flex flex-col gap-2"style={{- "padding-left": `${xPadding}px`,- "padding-right": `${xPadding}px`,+ "padding-left": `${TIMELINE_PADDING}px`,+ "padding-right": `${TIMELINE_PADDING}px`,}}onMouseDown={(e) => {createRoot((dispose) => {@@ -215,7 +214,7 @@ export function Timeline() {split() ? "text-red-300" : "text-black-transparent-20")}style={{- left: `${xPadding}px`,+ left: `${TIMELINE_PADDING}px`,transform: `translateX(${(time() - state.timelineTransform.position) / secsPerPixel()}px)`,@@ -234,7 +233,7 @@ export function Timeline() {<divclass="absolute bottom-0 top-4 h-full rounded-full z-10 w-px pointer-events-none bg-gradient-to-b to-[120%] from-[rgb(226,64,64)]"style={{- left: `${xPadding}px`,+ left: `${TIMELINE_PADDING}px`,transform: `translateX(${Math.min((playbackTime() - state.timelineTransform.position) /secsPerPixel(),@@ -283,10 +282,10 @@ function TimelineMarkings() {<divclass="absolute bottom-1 left-0 text-center rounded-full w-1 h-1 bg-[--text-tertiary] text-[--text-tertiary]"style={{- left: `${+ transform: `translateX(${(second - state.timelineTransform.position) / secsPerPixel() -1- }px`,+ }px)`,}}><Show when={second % 1 === 0}>@@ -404,9 +403,9 @@ function ClipTrack(props: Pick<ComponentProps<"div">, "ref">) {return (<divstyle={{- left: `${+ translate: `transformX(${(markingTime - segmentStartTime) / secsPerPixel()- }px`,+ }px)`,}}class="absolute z-10 w-px h-12 bg-gradient-to-b from-transparent to-transparent via-white-transparent-40 dark:via-black-transparent-60"/>@@ -489,7 +488,6 @@ function ClipTrack(props: Pick<ComponentProps<"div">, "ref">) {{formatTime(segment.start)}</span></Show>- <div class="absolute inset-0 -top-[120px] dark:bg-gray-500 bg-gray-50 w-[500px] h-[150px] rounded-full mx-auto blur-[50px] mix-blend-overlay opacity-30" />{(() => {const ctx = useSegmentContext();@@ -592,342 +590,334 @@ function ZoomTrack(props: {const [hoveredTime, setHoveredTime] = createSignal<number>();return (- <>- <div class="mt-2 w-full h-2" />+ <TrackRoot+ onMouseMove={(e) => {+ if (hoveringSegment()) {+ setHoveredTime(undefined);+ return;+ }- <TrackRoot- onMouseMove={(e) => {- if (hoveringSegment()) {- setHoveredTime(undefined);- return;- }+ const bounds = e.target.getBoundingClientRect()!;- const bounds = e.target.getBoundingClientRect()!;+ let time =+ (e.clientX - bounds.left) * secsPerPixel() ++ state.timelineTransform.position;- let time =- (e.clientX - bounds.left) * secsPerPixel() +- state.timelineTransform.position;-- const nextSegmentIndex = project.timeline?.zoomSegments?.findIndex(- (s) => time < s.start- );-- if (nextSegmentIndex !== undefined) {- const prevSegmentIndex = nextSegmentIndex - 1;+ const nextSegmentIndex = project.timeline?.zoomSegments?.findIndex(+ (s) => time < s.start+ );- if (prevSegmentIndex === undefined) return;+ if (nextSegmentIndex !== undefined) {+ const prevSegmentIndex = nextSegmentIndex - 1;- const nextSegment =- project.timeline?.zoomSegments?.[nextSegmentIndex];+ if (prevSegmentIndex === undefined) return;- if (prevSegmentIndex !== undefined && nextSegment) {- const prevSegment =- project.timeline?.zoomSegments?.[prevSegmentIndex];+ const nextSegment =+ project.timeline?.zoomSegments?.[nextSegmentIndex];- if (prevSegment) {- const availableTime = nextSegment?.start - prevSegment?.end;+ if (prevSegmentIndex !== undefined && nextSegment) {+ const prevSegment =+ project.timeline?.zoomSegments?.[prevSegmentIndex];- if (availableTime < 1) return;- }- }+ if (prevSegment) {+ const availableTime = nextSegment?.start - prevSegment?.end;- if (nextSegment && nextSegment.start - time < 1) {- time = nextSegment.start - 1;+ if (availableTime < 1) return;}}- setHoveredTime(Math.min(time, duration() - 1));- }}- onMouseLeave={() => setHoveredTime()}- onMouseDown={(e) => {- createRoot((dispose) => {- createEventListener(e.currentTarget, "mouseup", (e) => {- dispose();+ if (nextSegment && nextSegment.start - time < 1) {+ time = nextSegment.start - 1;+ }+ }- const time = hoveredTime();- if (time === undefined) return;+ setHoveredTime(Math.min(time, duration() - 1));+ }}+ onMouseLeave={() => setHoveredTime()}+ onMouseDown={(e) => {+ createRoot((dispose) => {+ createEventListener(e.currentTarget, "mouseup", (e) => {+ dispose();- e.stopPropagation();- batch(() => {- setProject("timeline", "zoomSegments", (v) => v ?? []);- setProject(- "timeline",- "zoomSegments",- produce((zoomSegments) => {- zoomSegments ??= [];+ const time = hoveredTime();+ if (time === undefined) return;- let index = zoomSegments.length;-- for (let i = zoomSegments.length - 1; i >= 0; i--) {- if (zoomSegments[i].start > time) {- index = i;- break;- }+ e.stopPropagation();+ batch(() => {+ setProject("timeline", "zoomSegments", (v) => v ?? []);+ setProject(+ "timeline",+ "zoomSegments",+ produce((zoomSegments) => {+ zoomSegments ??= [];++ let index = zoomSegments.length;++ for (let i = zoomSegments.length - 1; i >= 0; i--) {+ if (zoomSegments[i].start > time) {+ index = i;+ break;}+ }- zoomSegments.splice(index, 0, {- start: time,- end: time + 1,- amount: 1.5,- mode: {- manual: {- x: 0.5,- y: 0.5,- },+ zoomSegments.splice(index, 0, {+ start: time,+ end: time + 1,+ amount: 1.5,+ mode: {+ manual: {+ x: 0.5,+ y: 0.5,},- });- })- );- });+ },+ });+ })+ );});});- }}+ });+ }}+ >+ <Show+ when={!useTrackContext().trackState.draggingSegment && hoveredTime()}>- <Show- when={!useTrackContext().trackState.draggingSegment && hoveredTime()}- >- {(time) => (- <SegmentRoot- class="pointer-events-none"- innerClass="ring-red-300"- segment={{- start: time(),- end: time() + 1,- }}- >- <SegmentContent class="bg-gradient-to-r zoom-gradient-border hover:border duration-300 hover:border-gray-500 from-[#292929] via-[#434343] to-[#292929] transition-colors group shadow-[inset_0_8px_12px_3px_rgba(255,255,255,0.2)]">- <p class="w-full text-center dark:text-gray-500 text-md text-primary text-gray-50">- +- </p>- </SegmentContent>- </SegmentRoot>- )}- </Show>- <For each={project.timeline?.zoomSegments}>- {(segment, i) => {- const { setTrackState } = useTrackContext();+ {(time) => (+ <SegmentRoot+ class="pointer-events-none"+ innerClass="ring-red-300"+ segment={{+ start: time(),+ end: time() + 1,+ }}+ >+ <SegmentContent class="bg-gradient-to-r zoom-gradient-border hover:border duration-300 hover:border-gray-500 from-[#292929] via-[#434343] to-[#292929] transition-colors group shadow-[inset_0_8px_12px_3px_rgba(255,255,255,0.2)]">+ <p class="w-full text-center dark:text-gray-500 text-md text-primary text-gray-50">+ ++ </p>+ </SegmentContent>+ </SegmentRoot>+ )}+ </Show>+ <For each={project.timeline?.zoomSegments}>+ {(segment, i) => {+ const { setTrackState } = useTrackContext();- const zoomPercentage = () => {- const amount = segment.amount;- return `${amount.toFixed(1)}x`;- };+ const zoomPercentage = () => {+ const amount = segment.amount;+ return `${amount.toFixed(1)}x`;+ };- const zoomSegments = () => project.timeline!.zoomSegments!;+ const zoomSegments = () => project.timeline!.zoomSegments!;- function createMouseDownDrag<T>(- setup: () => T,- _update: (e: MouseEvent, v: T, initialMouseX: number) => void- ) {- return function (downEvent: MouseEvent) {- downEvent.stopPropagation();+ function createMouseDownDrag<T>(+ setup: () => T,+ _update: (e: MouseEvent, v: T, initialMouseX: number) => void+ ) {+ return function (downEvent: MouseEvent) {+ downEvent.stopPropagation();- const initial = setup();+ const initial = setup();- let moved = false;- let initialMouseX: null | number = null;+ let moved = false;+ let initialMouseX: null | number = null;- setTrackState("draggingSegment", true);+ setTrackState("draggingSegment", true);- const resumeHistory = history.pause();+ const resumeHistory = history.pause();- props.onDragStateChanged({ type: "movePending" });+ props.onDragStateChanged({ type: "movePending" });- function finish(e: MouseEvent) {- resumeHistory();+ function finish(e: MouseEvent) {+ resumeHistory();+ if (!moved) {+ e.stopPropagation();+ setState("timelineSelection", {+ type: "zoom",+ index: i(),+ });+ props.handleUpdatePlayhead(e);+ }+ props.onDragStateChanged({ type: "idle" });+ setTrackState("draggingSegment", false);+ }++ function update(event: MouseEvent) {+ if (Math.abs(event.clientX - downEvent.clientX) > 2) {if (!moved) {- e.stopPropagation();- setState("timelineSelection", {- type: "zoom",- index: i(),+ moved = true;+ initialMouseX = event.clientX;+ props.onDragStateChanged({+ type: "moving",});- props.handleUpdatePlayhead(e);}- props.onDragStateChanged({ type: "idle" });- setTrackState("draggingSegment", false);}- function update(event: MouseEvent) {- if (Math.abs(event.clientX - downEvent.clientX) > 2) {- if (!moved) {- moved = true;- initialMouseX = event.clientX;- props.onDragStateChanged({- type: "moving",- });- }- }-- if (initialMouseX === null) return;+ if (initialMouseX === null) return;- _update(event, initial, initialMouseX);- }+ _update(event, initial, initialMouseX);+ }- createRoot((dispose) => {- createEventListenerMap(window, {- mousemove: (e) => {- update(e);- },- mouseup: (e) => {- update(e);- finish(e);- dispose();- },- });+ createRoot((dispose) => {+ createEventListenerMap(window, {+ mousemove: (e) => {+ update(e);+ },+ mouseup: (e) => {+ update(e);+ finish(e);+ dispose();+ },});- };- }+ });+ };+ }- return (- <SegmentRoot- class="bg-gradient-to-r zoom-gradient-border hover:border duration-300 hover:border-gray-500 from-[#292929] via-[#434343] to-[#292929] transition-colors group shadow-[inset_0_8px_12px_3px_rgba(255,255,255,0.2)]"- innerClass="ring-red-300"- segment={segment}- onMouseEnter={() => {- setHoveringSegment(true);- }}- onMouseLeave={() => {- setHoveringSegment(false);- }}- >- <SegmentHandle- position="start"- class="absolute group-hover:opacity-100 opacity-0"- onMouseDown={createMouseDownDrag(- () => {- const start = segment.start;-- let minValue = 0;-- let maxValue = segment.end - 1;-- for (let i = zoomSegments().length - 1; i >= 0; i--) {- const segment = zoomSegments()[i]!;- if (segment.end <= start) {- minValue = segment.end;- break;- }- }+ return (+ <SegmentRoot+ class="bg-gradient-to-r zoom-gradient-border hover:border duration-300 hover:border-gray-500 from-[#292929] via-[#434343] to-[#292929] transition-colors group shadow-[inset_0_8px_12px_3px_rgba(255,255,255,0.2)]"+ innerClass="ring-red-300"+ segment={segment}+ onMouseEnter={() => {+ setHoveringSegment(true);+ }}+ onMouseLeave={() => {+ setHoveringSegment(false);+ }}+ >+ <SegmentHandle+ position="start"+ class="absolute group-hover:opacity-100 opacity-0"+ onMouseDown={createMouseDownDrag(+ () => {+ const start = segment.start;- return { start, minValue, maxValue };- },- (e, value, initialMouseX) => {- const newStart =- value.start +- (e.clientX - initialMouseX) * secsPerPixel();-- setProject(- "timeline",- "zoomSegments",- i(),- "start",- Math.min(- value.maxValue,- Math.max(value.minValue, newStart)- )- );- }- )}- />- <SegmentContent- class="flex justify-center items-center cursor-pointer"- onMouseDown={createMouseDownDrag(- () => {- const original = { ...segment };-- const prevSegment = zoomSegments()[i() - 1];- const nextSegment = zoomSegments()[i() + 1];-- const minStart = prevSegment?.end ?? 0;- const maxEnd = nextSegment?.start ?? duration();-- return {- original,- minStart,- maxEnd,- };- },- (e, value, initialMouseX) => {- const rawDelta =- (e.clientX - initialMouseX) * secsPerPixel();+ let minValue = 0;- const newStart = value.original.start + rawDelta;- const newEnd = value.original.end + rawDelta;+ let maxValue = segment.end - 1;- let delta = rawDelta;+ for (let i = zoomSegments().length - 1; i >= 0; i--) {+ const segment = zoomSegments()[i]!;+ if (segment.end <= start) {+ minValue = segment.end;+ break;+ }+ }- if (newStart < value.minStart)- delta = value.minStart - value.original.start;- else if (newEnd > value.maxEnd)- delta = value.maxEnd - value.original.end;+ return { start, minValue, maxValue };+ },+ (e, value, initialMouseX) => {+ const newStart =+ value.start ++ (e.clientX - initialMouseX) * secsPerPixel();- setProject("timeline", "zoomSegments", i(), {- start: value.original.start + delta,- end: value.original.end + delta,- });- }- )}- >- {(() => {- const ctx = useSegmentContext();-- return (- <Show when={ctx.width() > 100}>- <div class="flex flex-col gap-1 justify-center items-center text-xs text-gray-50 dark:text-gray-500 whitespace-nowrap">- <span class="opacity-70">Zoom</span>- <div class="flex gap-1 items-center text-md">- <IconLucideSearch class="size-3.5" />{" "}- {zoomPercentage()}{" "}- </div>- </div>- </Show>+ setProject(+ "timeline",+ "zoomSegments",+ i(),+ "start",+ Math.min(+ value.maxValue,+ Math.max(value.minValue, newStart)+ ));- })()}- </SegmentContent>- <SegmentHandle- position="end"- class="absolute group-hover:opacity-100 opacity-0"- onMouseDown={createMouseDownDrag(- () => {- const end = segment.end;-- const minValue = segment.start + 1;-- let maxValue = duration();-- for (let i = 0; i < zoomSegments().length; i++) {- const segment = zoomSegments()[i]!;- if (segment.start > end) {- maxValue = segment.start;- break;- }- }+ }+ )}+ />+ <SegmentContent+ class="flex justify-center items-center cursor-pointer"+ onMouseDown={createMouseDownDrag(+ () => {+ const original = { ...segment };++ const prevSegment = zoomSegments()[i() - 1];+ const nextSegment = zoomSegments()[i() + 1];++ const minStart = prevSegment?.end ?? 0;+ const maxEnd = nextSegment?.start ?? duration();++ return {+ original,+ minStart,+ maxEnd,+ };+ },+ (e, value, initialMouseX) => {+ const rawDelta =+ (e.clientX - initialMouseX) * secsPerPixel();++ const newStart = value.original.start + rawDelta;+ const newEnd = value.original.end + rawDelta;++ let delta = rawDelta;++ if (newStart < value.minStart)+ delta = value.minStart - value.original.start;+ else if (newEnd > value.maxEnd)+ delta = value.maxEnd - value.original.end;++ setProject("timeline", "zoomSegments", i(), {+ start: value.original.start + delta,+ end: value.original.end + delta,+ });+ }+ )}+ >+ {(() => {+ const ctx = useSegmentContext();- return { end, minValue, maxValue };- },- (e, value, initialMouseX) => {- const newEnd =- value.end +- (e.clientX - initialMouseX) * secsPerPixel();-- setProject(- "timeline",- "zoomSegments",- i(),- "end",- Math.min(- value.maxValue,- Math.max(value.minValue, newEnd)- )- );+ return (+ <Show when={ctx.width() > 100}>+ <div class="flex flex-col gap-1 justify-center items-center text-xs text-gray-50 dark:text-gray-500 whitespace-nowrap">+ <span class="opacity-70">Zoom</span>+ <div class="flex gap-1 items-center text-md">+ <IconLucideSearch class="size-3.5" />{" "}+ {zoomPercentage()}{" "}+ </div>+ </div>+ </Show>+ );+ })()}+ </SegmentContent>+ <SegmentHandle+ position="end"+ class="absolute group-hover:opacity-100 opacity-0"+ onMouseDown={createMouseDownDrag(+ () => {+ const end = segment.end;++ const minValue = segment.start + 1;++ let maxValue = duration();++ for (let i = 0; i < zoomSegments().length; i++) {+ const segment = zoomSegments()[i]!;+ if (segment.start > end) {+ maxValue = segment.start;+ break;+ }}- )}- />- </SegmentRoot>- );- }}- </For>- </TrackRoot>- </>++ return { end, minValue, maxValue };+ },+ (e, value, initialMouseX) => {+ const newEnd =+ value.end + (e.clientX - initialMouseX) * secsPerPixel();++ setProject(+ "timeline",+ "zoomSegments",+ i(),+ "end",+ Math.min(value.maxValue, Math.max(value.minValue, newEnd))+ );+ }+ )}+ />+ </SegmentRoot>+ );+ }}+ </For>+ </TrackRoot>);}diff --git a/apps/desktop/src/routes/editor/index.tsx b/apps/desktop/src/routes/editor/index.tsxindex f4d4a502f..c5f8eddd0 100644--- a/apps/desktop/src/routes/editor/index.tsx+++ b/apps/desktop/src/routes/editor/index.tsx@@ -1,11 +1,36 @@-import { Suspense } from "solid-js";+import { createEffect, Suspense } from "solid-js";+import { type as ostype } from "@tauri-apps/plugin-os";+import { cx } from "cva";+import { Editor } from "./Editor";import { AbsoluteInsetLoader } from "~/components/Loader";+import { generalSettingsStore } from "~/store";+import { commands } from "~/utils/tauri";+import { Effect, getCurrentWindow } from "@tauri-apps/api/window";export default function () {+ const generalSettings = generalSettingsStore.createQuery();++ createEffect(() => {+ const transparent = generalSettings.data?.windowTransparency ?? false;+ commands.setWindowTransparent(transparent);+ getCurrentWindow().setEffects({+ effects: transparent ? [Effect.HudWindow] : [],+ });+ });+return (- <Suspense fallback={<AbsoluteInsetLoader />}>- <Editor />- </Suspense>+ <div+ class={cx(+ "flex flex-col w-screen h-screen",+ ostype() === "windows" || !generalSettings.data?.windowTransparency+ ? "bg-gray-50"+ : "bg-transparent-window"+ )}+ >+ <Suspense fallback={<AbsoluteInsetLoader />}>+ <Editor />+ </Suspense>+ </div>);}diff --git a/apps/desktop/src/styles/theme.css b/apps/desktop/src/styles/theme.cssindex 6f14d5ded..00315dbe4 100644--- a/apps/desktop/src/styles/theme.css+++ b/apps/desktop/src/styles/theme.css@@ -196,7 +196,6 @@animation: svgpathframes 1s ease-in-out forwards;}-/* Tabs container with mask-based fade-out effect */.tabs-mask-content {diff --git a/apps/desktop/src/utils/tauri.ts b/apps/desktop/src/utils/tauri.tsindex be2330dec..aca0599ac 100644--- a/apps/desktop/src/utils/tauri.ts+++ b/apps/desktop/src/utils/tauri.ts@@ -172,6 +172,9 @@ async updateAuthPlan() : Promise<void> {},async reuploadInstantVideo(videoId: string) : Promise<null> {return await TAURI_INVOKE("reupload_instant_video", { videoId });+},+async setWindowTransparent(value: boolean) : Promise<void> {+ await TAURI_INVOKE("set_window_transparent", { value });}}@@ -257,7 +260,7 @@ export type Cursors = { [key in string]: string } | { [key in string]: CursorMetexport type EditorStateChanged = { playhead_position: number }export type ExportEstimates = { duration_seconds: number; estimated_time_seconds: number; estimated_size_mb: number }export type Flags = { recordMouseState: boolean; systemAudioRecording: boolean; split: boolean }-export type GeneralSettingsStore = { instanceId?: string; uploadIndividualFiles?: boolean; openEditorAfterRecording?: boolean; hideDockIcon?: boolean; hapticsEnabled?: boolean; autoCreateShareableLink?: boolean; enableNotifications?: boolean; disableAutoOpenLinks?: boolean; hasCompletedStartup?: boolean; theme?: AppTheme; commercialLicense?: CommercialLicense | null; lastVersion?: string | null }+export type GeneralSettingsStore = { instanceId?: string; uploadIndividualFiles?: boolean; openEditorAfterRecording?: boolean; hideDockIcon?: boolean; hapticsEnabled?: boolean; autoCreateShareableLink?: boolean; enableNotifications?: boolean; disableAutoOpenLinks?: boolean; hasCompletedStartup?: boolean; theme?: AppTheme; commercialLicense?: CommercialLicense | null; lastVersion?: string | null; windowTransparency?: 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 }diff --git a/apps/desktop/src/utils/titlebar-state.ts b/apps/desktop/src/utils/titlebar-state.tsindex a4e2c4962..49b005500 100644--- a/apps/desktop/src/utils/titlebar-state.ts+++ b/apps/desktop/src/utils/titlebar-state.ts@@ -56,5 +56,5 @@ async function initializeTitlebar(): Promise<UnlistenFn | undefined> {});}-export { initializeTitlebar, setState as setTitlebar };+export { initializeTitlebar };export default state;diff --git a/crates/media/src/sources/screen_capture.rs b/crates/media/src/sources/screen_capture.rsindex 1fdbc46fb..0053d8d10 100644--- a/crates/media/src/sources/screen_capture.rs+++ b/crates/media/src/sources/screen_capture.rs@@ -23,10 +23,9 @@ use crate::{MediaError,};-static EXCLUDED_WINDOWS: [&str; 4] = [- "Cap",+static EXCLUDED_WINDOWS: &[&str] = &["Cap Camera",- "Cap Recordings",+ "Cap Recordings Overlay","Cap In Progress Recording",];