Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
Implement list view in the new recording flow (#1104)
Richie McIlroyf1717f267217
diff --git a/.claude/settings.local.json b/.claude/settings.local.jsonnew file mode 100644index 000000000..083ec9bd4--- /dev/null+++ b/.claude/settings.local.json@@ -0,0 +1,11 @@+{+ "permissions": {+ "allow": [+ "Bash(pnpm typecheck:*)",+ "Bash(pnpm lint:*)",+ "Bash(pnpm build:*)"+ ],+ "deny": [],+ "ask": []+ }+}diff --git a/Cargo.lock b/Cargo.lockindex 6f7390457..7f9753127 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -1188,6 +1188,8 @@ dependencies = ["reqwest","rodio","scap",+ "scap-direct3d",+ "scap-screencapturekit","scap-targets","sentry","serde",diff --git a/apps/desktop/package.json b/apps/desktop/package.jsonindex 4f11767ca..23aee2c67 100644--- a/apps/desktop/package.json+++ b/apps/desktop/package.json@@ -59,6 +59,7 @@"posthog-js": "^1.215.3","solid-js": "^1.9.3","solid-markdown": "^2.0.13",+ "solid-motionone": "^1.0.4","solid-presence": "^0.1.8","solid-toast": "^0.5.0","solid-transition-group": "^0.2.3",diff --git a/apps/desktop/src-tauri/Cargo.toml b/apps/desktop/src-tauri/Cargo.tomlindex 2b53cdb32..85046ece2 100644--- a/apps/desktop/src-tauri/Cargo.toml+++ b/apps/desktop/src-tauri/Cargo.toml@@ -89,6 +89,8 @@ cap-flags = { path = "../../../crates/flags" }cap-recording = { path = "../../../crates/recording" }cap-export = { path = "../../../crates/export" }scap-targets = { path = "../../../crates/scap-targets" }+scap-screencapturekit = { path = "../../../crates/scap-screencapturekit" }+scap-direct3d = { path = "../../../crates/scap-direct3d" }flume.workspace = truetracing-subscriber = "0.3.19"diff --git a/apps/desktop/src-tauri/src/lib.rs b/apps/desktop/src-tauri/src/lib.rsindex 9b3936ca8..701242654 100644--- a/apps/desktop/src-tauri/src/lib.rs+++ b/apps/desktop/src-tauri/src/lib.rs@@ -1856,6 +1856,8 @@ pub async fn run(recording_logging_handle: LoggingHandle) {recording::list_cameras,recording::list_capture_windows,recording::list_capture_displays,+ recording::list_displays_with_thumbnails,+ recording::list_windows_with_thumbnails,take_screenshot,list_audio_devices,close_recordings_overlay_window,@@ -1922,6 +1924,7 @@ pub async fn run(recording_logging_handle: LoggingHandle) {target_select_overlay::close_target_select_overlays,target_select_overlay::display_information,target_select_overlay::get_window_icon,+ target_select_overlay::focus_window,editor_delete_project]).events(tauri_specta::collect_events![diff --git a/apps/desktop/src-tauri/src/recording.rs b/apps/desktop/src-tauri/src/recording.rsindex 217f14e08..7738e4afc 100644--- a/apps/desktop/src-tauri/src/recording.rs+++ b/apps/desktop/src-tauri/src/recording.rs@@ -13,13 +13,13 @@ use cap_recording::{};use cap_rendering::ProjectRecordingsMeta;use cap_utils::{ensure_dir, spawn_actor};-use serde::Deserialize;+use serde::{Deserialize, Serialize};use specta::Type;use std::{path::PathBuf, str::FromStr, sync::Arc, time::Duration};use tauri::{AppHandle, Manager};use tauri_plugin_dialog::{DialogExt, MessageDialogBuilder};use tauri_specta::Event;-use tracing::{debug, error, info};+use tracing::{debug, error, info, warn};use crate::{App, CurrentRecordingChanged, MutableState, NewStudioRecordingAdded, RecordingState,@@ -184,6 +184,825 @@ pub fn list_cameras() -> Vec<cap_camera::CameraInfo> {cap_camera::list_cameras().collect()}+#[derive(Debug, Clone, Serialize, Deserialize, Type)]+pub struct CaptureDisplayWithThumbnail {+ pub id: scap_targets::DisplayId,+ pub name: String,+ pub refresh_rate: u32,+ pub thumbnail: Option<String>,+}++#[derive(Debug, Clone, Serialize, Deserialize, Type)]+pub struct CaptureWindowWithThumbnail {+ pub id: scap_targets::WindowId,+ pub owner_name: String,+ pub name: String,+ pub bounds: scap_targets::bounds::LogicalBounds,+ pub refresh_rate: u32,+ pub thumbnail: Option<String>,+ pub app_icon: Option<String>,+}++#[cfg(any(target_os = "macos", windows))]+const THUMBNAIL_WIDTH: u32 = 320;+#[cfg(any(target_os = "macos", windows))]+const THUMBNAIL_HEIGHT: u32 = 180;++#[cfg(any(target_os = "macos", windows))]+fn normalize_thumbnail_dimensions(image: &image::RgbaImage) -> image::RgbaImage {+ let width = image.width();+ let height = image.height();++ if width == THUMBNAIL_WIDTH && height == THUMBNAIL_HEIGHT {+ return image.clone();+ }++ if width == 0 || height == 0 {+ return image::RgbaImage::from_pixel(+ THUMBNAIL_WIDTH,+ THUMBNAIL_HEIGHT,+ image::Rgba([0, 0, 0, 0]),+ );+ }++ let scale = (THUMBNAIL_WIDTH as f32 / width as f32)+ .min(THUMBNAIL_HEIGHT as f32 / height as f32)+ .max(f32::MIN_POSITIVE);++ let scaled_width = (width as f32 * scale)+ .round()+ .clamp(1.0, THUMBNAIL_WIDTH as f32) as u32;+ let scaled_height = (height as f32 * scale)+ .round()+ .clamp(1.0, THUMBNAIL_HEIGHT as f32) as u32;++ let resized = image::imageops::resize(+ image,+ scaled_width.max(1),+ scaled_height.max(1),+ image::imageops::FilterType::Lanczos3,+ );++ let mut canvas =+ image::RgbaImage::from_pixel(THUMBNAIL_WIDTH, THUMBNAIL_HEIGHT, image::Rgba([0, 0, 0, 0]));++ let offset_x = (THUMBNAIL_WIDTH - scaled_width) / 2;+ let offset_y = (THUMBNAIL_HEIGHT - scaled_height) / 2;++ image::imageops::overlay(&mut canvas, &resized, offset_x as i64, offset_y as i64);++ canvas+}++#[cfg(target_os = "macos")]+async fn capture_thumbnail_from_filter(filter: &cidre::sc::ContentFilter) -> Option<String> {+ use cidre::{cv, sc};+ use image::{ImageEncoder, RgbaImage, codecs::png::PngEncoder};+ use std::{io::Cursor, slice};++ let mut config = sc::StreamCfg::new();+ config.set_width(THUMBNAIL_WIDTH as usize);+ config.set_height(THUMBNAIL_HEIGHT as usize);+ config.set_shows_cursor(false);++ let sample_buf =+ match unsafe { sc::ScreenshotManager::capture_sample_buf(filter, &config) }.await {+ Ok(buf) => buf,+ Err(err) => {+ warn!(error = ?err, "Failed to capture sample buffer for thumbnail");+ return None;+ }+ };++ let Some(image_buf) = sample_buf.image_buf() else {+ warn!("Sample buffer missing image data");+ return None;+ };+ let mut image_buf = image_buf.retained();++ let width = image_buf.width();+ let height = image_buf.height();+ if width == 0 || height == 0 {+ warn!(+ width = width,+ height = height,+ "Captured thumbnail had empty dimensions"+ );+ return None;+ }++ let pixel_format = image_buf.pixel_format();++ let lock =+ match PixelBufferLock::new(image_buf.as_mut(), cv::pixel_buffer::LockFlags::READ_ONLY) {+ Ok(lock) => lock,+ Err(err) => {+ warn!(error = ?err, "Failed to lock pixel buffer for thumbnail");+ return None;+ }+ };++ let rgba_data = match pixel_format {+ cv::PixelFormat::_32_BGRA+ | cv::PixelFormat::_32_RGBA+ | cv::PixelFormat::_32_ARGB+ | cv::PixelFormat::_32_ABGR => {+ convert_32bit_pixel_buffer(&lock, width, height, pixel_format)?+ }+ cv::PixelFormat::_420V => {+ convert_nv12_pixel_buffer(&lock, width, height, Nv12Range::Video)?+ }+ other => {+ warn!(?other, "Unsupported pixel format for thumbnail capture");+ return None;+ }+ };++ let Some(img) = RgbaImage::from_raw(width as u32, height as u32, rgba_data) else {+ warn!("Failed to construct RGBA image for thumbnail");+ return None;+ };+ let thumbnail = normalize_thumbnail_dimensions(&img);+ let mut png_data = Cursor::new(Vec::new());+ let encoder = PngEncoder::new(&mut png_data);+ if let Err(err) = encoder.write_image(+ thumbnail.as_raw(),+ thumbnail.width(),+ thumbnail.height(),+ image::ColorType::Rgba8.into(),+ ) {+ warn!(error = ?err, "Failed to encode thumbnail as PNG");+ return None;+ }++ Some(base64::Engine::encode(+ &base64::engine::general_purpose::STANDARD,+ png_data.into_inner(),+ ))+}++#[cfg(target_os = "macos")]+fn convert_32bit_pixel_buffer(+ lock: &PixelBufferLock<'_>,+ width: usize,+ height: usize,+ pixel_format: cidre::cv::PixelFormat,+) -> Option<Vec<u8>> {+ let base_ptr = lock.base_address();+ if base_ptr.is_null() {+ warn!("Pixel buffer base address was null");+ return None;+ }++ let bytes_per_row = lock.bytes_per_row();+ let total_len = bytes_per_row.checked_mul(height)?;+ let raw_data = unsafe { std::slice::from_raw_parts(base_ptr, total_len) };++ let mut rgba_data = Vec::with_capacity(width * height * 4);+ for y in 0..height {+ let row_start = y * bytes_per_row;+ let row_end = row_start + width * 4;+ if row_end > raw_data.len() {+ warn!(+ row_start = row_start,+ row_end = row_end,+ raw_len = raw_data.len(),+ "Row bounds exceeded raw data length during thumbnail capture",+ );+ return None;+ }++ let row = &raw_data[row_start..row_end];+ for chunk in row.chunks_exact(4) {+ match pixel_format {+ cidre::cv::PixelFormat::_32_BGRA => {+ rgba_data.extend_from_slice(&[chunk[2], chunk[1], chunk[0], chunk[3]])+ }+ cidre::cv::PixelFormat::_32_RGBA => rgba_data.extend_from_slice(chunk),+ cidre::cv::PixelFormat::_32_ARGB => {+ rgba_data.extend_from_slice(&[chunk[1], chunk[2], chunk[3], chunk[0]])+ }+ cidre::cv::PixelFormat::_32_ABGR => {+ rgba_data.extend_from_slice(&[chunk[3], chunk[2], chunk[1], chunk[0]])+ }+ _ => unreachable!(),+ }+ }+ }++ Some(rgba_data)+}++#[cfg(target_os = "macos")]+#[derive(Copy, Clone)]+enum Nv12Range {+ Video,+ Full,+}++#[cfg(target_os = "macos")]+fn convert_nv12_pixel_buffer(+ lock: &PixelBufferLock<'_>,+ width: usize,+ height: usize,+ range: Nv12Range,+) -> Option<Vec<u8>> {+ let y_base = lock.base_address_of_plane(0);+ let uv_base = lock.base_address_of_plane(1);+ if y_base.is_null() || uv_base.is_null() {+ warn!("NV12 plane base address was null");+ return None;+ }++ let y_stride = lock.bytes_per_row_of_plane(0);+ let uv_stride = lock.bytes_per_row_of_plane(1);+ if y_stride == 0 || uv_stride == 0 {+ warn!(y_stride, uv_stride, "NV12 plane bytes per row was zero");+ return None;+ }++ let y_plane_height = lock.height_of_plane(0);+ let uv_plane_height = lock.height_of_plane(1);+ if y_plane_height < height || uv_plane_height < (height + 1) / 2 {+ warn!(+ y_plane_height,+ uv_plane_height,+ expected_y = height,+ expected_uv = (height + 1) / 2,+ "NV12 plane height smaller than expected",+ );+ return None;+ }++ let y_plane = unsafe { std::slice::from_raw_parts(y_base, y_stride * y_plane_height) };+ let uv_plane = unsafe { std::slice::from_raw_parts(uv_base, uv_stride * uv_plane_height) };++ let mut rgba_data = vec![0u8; width * height * 4];++ for y_idx in 0..height {+ let y_row_start = y_idx * y_stride;+ if y_row_start + width > y_plane.len() {+ warn!(+ y_row_start,+ width,+ y_plane_len = y_plane.len(),+ "Y row exceeded plane length during conversion",+ );+ return None;+ }+ let y_row = &y_plane[y_row_start..y_row_start + width];++ let uv_row_start = (y_idx / 2) * uv_stride;+ if uv_row_start + width > uv_plane.len() {+ warn!(+ uv_row_start,+ width,+ uv_plane_len = uv_plane.len(),+ "UV row exceeded plane length during conversion",+ );+ return None;+ }+ let uv_row = &uv_plane[uv_row_start..uv_row_start + width];++ for x in 0..width {+ let uv_index = (x / 2) * 2;+ if uv_index + 1 >= uv_row.len() {+ warn!(+ uv_index,+ uv_row_len = uv_row.len(),+ "UV index out of bounds during conversion",+ );+ return None;+ }++ let y_val = y_row[x];+ let cb = uv_row[uv_index];+ let cr = uv_row[uv_index + 1];+ let (r, g, b) = ycbcr_to_rgb(y_val, cb, cr, range);+ let out = (y_idx * width + x) * 4;+ rgba_data[out] = r;+ rgba_data[out + 1] = g;+ rgba_data[out + 2] = b;+ rgba_data[out + 3] = 255;+ }+ }++ Some(rgba_data)+}++#[cfg(target_os = "macos")]+fn ycbcr_to_rgb(y: u8, cb: u8, cr: u8, range: Nv12Range) -> (u8, u8, u8) {+ let y = y as f32;+ let cb = cb as f32 - 128.0;+ let cr = cr as f32 - 128.0;++ let (y_value, scale) = match range {+ Nv12Range::Video => ((y - 16.0).max(0.0), 1.164383_f32),+ Nv12Range::Full => (y, 1.0_f32),+ };++ let r = scale * y_value + 1.596027_f32 * cr;+ let g = scale * y_value - 0.391762_f32 * cb - 0.812968_f32 * cr;+ let b = scale * y_value + 2.017232_f32 * cb;++ (clamp_channel(r), clamp_channel(g), clamp_channel(b))+}++#[cfg(target_os = "macos")]+fn clamp_channel(value: f32) -> u8 {+ value.max(0.0).min(255.0) as u8+}++#[cfg(target_os = "macos")]+struct PixelBufferLock<'a> {+ buffer: &'a mut cidre::cv::PixelBuf,+ flags: cidre::cv::pixel_buffer::LockFlags,+}++#[cfg(target_os = "macos")]+impl<'a> PixelBufferLock<'a> {+ fn new(+ buffer: &'a mut cidre::cv::PixelBuf,+ flags: cidre::cv::pixel_buffer::LockFlags,+ ) -> cidre::os::Result<Self> {+ unsafe { buffer.lock_base_addr(flags) }.result()?;+ Ok(Self { buffer, flags })+ }++ fn base_address(&self) -> *const u8 {+ unsafe { cv_pixel_buffer_get_base_address(self.buffer) as *const u8 }+ }++ fn bytes_per_row(&self) -> usize {+ unsafe { cv_pixel_buffer_get_bytes_per_row(self.buffer) }+ }++ fn base_address_of_plane(&self, plane_index: usize) -> *const u8 {+ unsafe { cv_pixel_buffer_get_base_address_of_plane(self.buffer, plane_index) as *const u8 }+ }++ fn bytes_per_row_of_plane(&self, plane_index: usize) -> usize {+ unsafe { cv_pixel_buffer_get_bytes_per_row_of_plane(self.buffer, plane_index) }+ }++ fn height_of_plane(&self, plane_index: usize) -> usize {+ unsafe { cv_pixel_buffer_get_height_of_plane(self.buffer, plane_index) }+ }+}++#[cfg(target_os = "macos")]+impl Drop for PixelBufferLock<'_> {+ fn drop(&mut self) {+ unsafe {+ let _ = self.buffer.unlock_lock_base_addr(self.flags);+ }+ }+}++#[cfg(target_os = "macos")]+unsafe fn cv_pixel_buffer_get_base_address(buffer: &cidre::cv::PixelBuf) -> *mut std::ffi::c_void {+ unsafe extern "C" {+ fn CVPixelBufferGetBaseAddress(pixel_buffer: &cidre::cv::PixelBuf)+ -> *mut std::ffi::c_void;+ }++ unsafe { CVPixelBufferGetBaseAddress(buffer) }+}++#[cfg(target_os = "macos")]+unsafe fn cv_pixel_buffer_get_bytes_per_row(buffer: &cidre::cv::PixelBuf) -> usize {+ unsafe extern "C" {+ fn CVPixelBufferGetBytesPerRow(pixel_buffer: &cidre::cv::PixelBuf) -> usize;+ }++ unsafe { CVPixelBufferGetBytesPerRow(buffer) }+}++#[cfg(target_os = "macos")]+unsafe fn cv_pixel_buffer_get_base_address_of_plane(+ buffer: &cidre::cv::PixelBuf,+ plane_index: usize,+) -> *mut std::ffi::c_void {+ unsafe extern "C" {+ fn CVPixelBufferGetBaseAddressOfPlane(+ pixel_buffer: &cidre::cv::PixelBuf,+ plane_index: usize,+ ) -> *mut std::ffi::c_void;+ }++ unsafe { CVPixelBufferGetBaseAddressOfPlane(buffer, plane_index) }+}++#[cfg(target_os = "macos")]+unsafe fn cv_pixel_buffer_get_bytes_per_row_of_plane(+ buffer: &cidre::cv::PixelBuf,+ plane_index: usize,+) -> usize {+ unsafe extern "C" {+ fn CVPixelBufferGetBytesPerRowOfPlane(+ pixel_buffer: &cidre::cv::PixelBuf,+ plane_index: usize,+ ) -> usize;+ }++ unsafe { CVPixelBufferGetBytesPerRowOfPlane(buffer, plane_index) }+}++#[cfg(target_os = "macos")]+unsafe fn cv_pixel_buffer_get_height_of_plane(+ buffer: &cidre::cv::PixelBuf,+ plane_index: usize,+) -> usize {+ unsafe extern "C" {+ fn CVPixelBufferGetHeightOfPlane(+ pixel_buffer: &cidre::cv::PixelBuf,+ plane_index: usize,+ ) -> usize;+ }++ unsafe { CVPixelBufferGetHeightOfPlane(buffer, plane_index) }+}++#[cfg(target_os = "macos")]+async fn capture_display_thumbnail(display: &scap_targets::Display) -> Option<String> {+ let filter = display.raw_handle().as_content_filter().await?;+ capture_thumbnail_from_filter(filter.as_ref()).await+}++#[cfg(windows)]+async fn capture_display_thumbnail(display: &scap_targets::Display) -> Option<String> {+ use image::{ColorType, ImageEncoder, codecs::png::PngEncoder};+ use scap_direct3d::{Capturer, Settings};+ use std::io::Cursor;++ let item = display.raw_handle().try_as_capture_item().ok()?;++ let (tx, rx) = std::sync::mpsc::channel();++ let settings = Settings {+ is_cursor_capture_enabled: Some(false),+ pixel_format: scap_direct3d::PixelFormat::R8G8B8A8Unorm,+ ..Default::default()+ };++ let mut capturer = Capturer::new(+ item,+ settings.clone(),+ move |frame| {+ let _ = tx.send(frame);+ Ok(())+ },+ || Ok(()),+ None,+ )+ .ok()?;++ capturer.start().ok()?;++ let frame = rx.recv_timeout(std::time::Duration::from_secs(2)).ok()?;+ let _ = capturer.stop();++ let width = frame.width();+ let height = frame.height();++ if width == 0 || height == 0 {+ return None;+ }++ let frame_buffer = frame.as_buffer().ok()?;+ let data = frame_buffer.data();+ let stride = frame_buffer.stride() as usize;++ let width_usize = width as usize;+ let height_usize = height as usize;++ let Some(row_bytes) = width_usize.checked_mul(4) else {+ warn!(+ frame_width = width,+ "Windows display thumbnail row size overflowed"+ );+ return None;+ };++ if stride < row_bytes {+ warn!(+ frame_width = width,+ frame_height = height,+ stride,+ expected_row_bytes = row_bytes,+ "Windows display thumbnail stride smaller than row size"+ );+ return None;+ }++ let rows_before_last = height_usize.saturating_sub(1);+ let Some(last_row_start) = rows_before_last.checked_mul(stride) else {+ warn!(+ frame_width = width,+ frame_height = height,+ stride,+ "Windows display thumbnail row offset overflowed"+ );+ return None;+ };++ let Some(required_len) = last_row_start.checked_add(row_bytes) else {+ warn!(+ frame_width = width,+ frame_height = height,+ stride,+ required_row_bytes = row_bytes,+ "Windows display thumbnail required length overflowed"+ );+ return None;+ };++ if data.len() < required_len {+ warn!(+ frame_width = width,+ frame_height = height,+ stride,+ frame_data_len = data.len(),+ expected_len = required_len,+ "Windows display thumbnail frame buffer missing pixel data"+ );+ return None;+ }++ let Some(rgba_capacity) = height_usize.checked_mul(row_bytes) else {+ warn!(+ frame_width = width,+ frame_height = height,+ total_row_bytes = row_bytes,+ "Windows display thumbnail RGBA capacity overflowed"+ );+ return None;+ };++ let mut rgba_data = Vec::with_capacity(rgba_capacity);+ for y in 0..height_usize {+ let row_start = y * stride;+ let row_end = row_start + row_bytes;+ rgba_data.extend_from_slice(&data[row_start..row_end]);+ }++ let Some(img) = image::RgbaImage::from_raw(width, height, rgba_data) else {+ warn!("Windows display thumbnail failed to construct RGBA image");+ return None;+ };+ let thumbnail = normalize_thumbnail_dimensions(&img);++ let mut png_data = Cursor::new(Vec::new());+ let encoder = PngEncoder::new(&mut png_data);+ encoder+ .write_image(+ thumbnail.as_raw(),+ thumbnail.width(),+ thumbnail.height(),+ ColorType::Rgba8.into(),+ )+ .ok()?;++ Some(base64::Engine::encode(+ &base64::engine::general_purpose::STANDARD,+ png_data.into_inner(),+ ))+}++#[cfg(target_os = "macos")]+async fn capture_window_thumbnail(window: &scap_targets::Window) -> Option<String> {+ let sc_window = window.raw_handle().as_sc().await?;+ let filter = cidre::sc::ContentFilter::with_desktop_independent_window(&sc_window);+ capture_thumbnail_from_filter(filter.as_ref()).await+}++#[cfg(windows)]+async fn capture_window_thumbnail(window: &scap_targets::Window) -> Option<String> {+ use image::{ColorType, ImageEncoder, codecs::png::PngEncoder};+ use scap_direct3d::{Capturer, Settings};+ use std::io::Cursor;++ let item = window.raw_handle().try_as_capture_item().ok()?;++ let (tx, rx) = std::sync::mpsc::channel();++ let settings = Settings {+ is_cursor_capture_enabled: Some(false),+ pixel_format: scap_direct3d::PixelFormat::R8G8B8A8Unorm,+ ..Default::default()+ };++ let mut capturer = Capturer::new(+ item,+ settings.clone(),+ move |frame| {+ let _ = tx.send(frame);+ Ok(())+ },+ || Ok(()),+ None,+ )+ .ok()?;++ capturer.start().ok()?;++ let frame = rx.recv_timeout(std::time::Duration::from_secs(2)).ok()?;+ let _ = capturer.stop();++ let width = frame.width();+ let height = frame.height();++ if width == 0 || height == 0 {+ return None;+ }++ let frame_buffer = frame.as_buffer().ok()?;+ let data = frame_buffer.data();+ let stride = frame_buffer.stride() as usize;++ let width_usize = width as usize;+ let height_usize = height as usize;++ let Some(row_bytes) = width_usize.checked_mul(4) else {+ warn!(+ frame_width = width,+ "Windows window thumbnail row size overflowed"+ );+ return None;+ };++ if stride < row_bytes {+ warn!(+ frame_width = width,+ frame_height = height,+ stride,+ expected_row_bytes = row_bytes,+ "Windows window thumbnail stride smaller than row size"+ );+ return None;+ }++ let rows_before_last = height_usize.saturating_sub(1);+ let Some(last_row_start) = rows_before_last.checked_mul(stride) else {+ warn!(+ frame_width = width,+ frame_height = height,+ stride,+ "Windows window thumbnail row offset overflowed"+ );+ return None;+ };++ let Some(required_len) = last_row_start.checked_add(row_bytes) else {+ warn!(+ frame_width = width,+ frame_height = height,+ stride,+ required_row_bytes = row_bytes,+ "Windows window thumbnail required length overflowed"+ );+ return None;+ };++ if data.len() < required_len {+ warn!(+ frame_width = width,+ frame_height = height,+ stride,+ frame_data_len = data.len(),+ expected_len = required_len,+ "Windows window thumbnail frame buffer missing pixel data"+ );+ return None;+ }++ let Some(rgba_capacity) = height_usize.checked_mul(row_bytes) else {+ warn!(+ frame_width = width,+ frame_height = height,+ total_row_bytes = row_bytes,+ "Windows window thumbnail RGBA capacity overflowed"+ );+ return None;+ };++ let mut rgba_data = Vec::with_capacity(rgba_capacity);+ for y in 0..height_usize {+ let row_start = y * stride;+ let row_end = row_start + row_bytes;+ rgba_data.extend_from_slice(&data[row_start..row_end]);+ }++ let Some(img) = image::RgbaImage::from_raw(width, height, rgba_data) else {+ warn!("Windows window thumbnail failed to construct RGBA image");+ return None;+ };+ let thumbnail = normalize_thumbnail_dimensions(&img);++ let mut png_data = Cursor::new(Vec::new());+ let encoder = PngEncoder::new(&mut png_data);+ encoder+ .write_image(+ thumbnail.as_raw(),+ thumbnail.width(),+ thumbnail.height(),+ ColorType::Rgba8.into(),+ )+ .ok()?;++ Some(base64::Engine::encode(+ &base64::engine::general_purpose::STANDARD,+ png_data.into_inner(),+ ))+}++#[tauri::command(async)]+#[specta::specta]+pub async fn list_displays_with_thumbnails() -> Result<Vec<CaptureDisplayWithThumbnail>, String> {+ tokio::task::spawn_blocking(|| collect_displays_with_thumbnails())+ .await+ .map_err(|err| err.to_string())?+}++#[tauri::command(async)]+#[specta::specta]+pub async fn list_windows_with_thumbnails() -> Result<Vec<CaptureWindowWithThumbnail>, String> {+ tokio::task::spawn_blocking(|| collect_windows_with_thumbnails())+ .await+ .map_err(|err| err.to_string())?+}++fn collect_displays_with_thumbnails() -> Result<Vec<CaptureDisplayWithThumbnail>, String> {+ tauri::async_runtime::block_on(async move {+ let displays = screen_capture::list_displays();++ let mut results = Vec::new();+ for (capture_display, display) in displays {+ let thumbnail = capture_display_thumbnail(&display).await;+ results.push(CaptureDisplayWithThumbnail {+ id: capture_display.id,+ name: capture_display.name,+ refresh_rate: capture_display.refresh_rate,+ thumbnail,+ });+ }++ Ok(results)+ })+}++fn collect_windows_with_thumbnails() -> Result<Vec<CaptureWindowWithThumbnail>, String> {+ tauri::async_runtime::block_on(async move {+ let windows = screen_capture::list_windows();++ debug!(window_count = windows.len(), "Collecting window thumbnails");+ let mut results = Vec::new();+ for (capture_window, window) in windows {+ let thumbnail = capture_window_thumbnail(&window).await;+ let app_icon = window.app_icon().and_then(|bytes| {+ if bytes.is_empty() {+ None+ } else {+ Some(base64::Engine::encode(+ &base64::engine::general_purpose::STANDARD,+ bytes,+ ))+ }+ });++ if thumbnail.is_none() {+ warn!(+ window_id = ?capture_window.id,+ window_name = %capture_window.name,+ owner_name = %capture_window.owner_name,+ "Window thumbnail capture returned None",+ );+ } else {+ debug!(+ window_id = ?capture_window.id,+ window_name = %capture_window.name,+ owner_name = %capture_window.owner_name,+ "Captured window thumbnail",+ );+ }++ results.push(CaptureWindowWithThumbnail {+ id: capture_window.id,+ name: capture_window.name,+ owner_name: capture_window.owner_name,+ bounds: capture_window.bounds,+ refresh_rate: capture_window.refresh_rate,+ thumbnail,+ app_icon,+ });+ }++ info!(windows = results.len(), "Collected window thumbnail data");++ Ok(results)+ })+}+#[derive(Deserialize, Type, Clone, Debug)]pub struct StartRecordingInputs {pub capture_target: ScreenCaptureTarget,diff --git a/apps/desktop/src-tauri/src/target_select_overlay.rs b/apps/desktop/src-tauri/src/target_select_overlay.rsindex 5cec11210..c218bc528 100644--- a/apps/desktop/src-tauri/src/target_select_overlay.rs+++ b/apps/desktop/src-tauri/src/target_select_overlay.rs@@ -140,6 +140,46 @@ pub async fn display_information(display_id: &str) -> Result<DisplayInformation,})}+#[specta::specta]+#[tauri::command]+pub async fn focus_window(window_id: WindowId) -> Result<(), String> {+ let window = Window::from_id(&window_id).ok_or("Window not found")?;++ #[cfg(target_os = "macos")]+ {+ use objc2_app_kit::{NSApplicationActivationOptions, NSRunningApplication};++ let pid = window+ .raw_handle()+ .owner_pid()+ .ok_or("Could not get window owner PID")?;++ if let Some(app) =+ unsafe { NSRunningApplication::runningApplicationWithProcessIdentifier(pid) }+ {+ unsafe {+ app.activateWithOptions(NSApplicationActivationOptions::ActivateIgnoringOtherApps);+ }+ }+ }++ #[cfg(target_os = "windows")]+ {+ use windows::Win32::UI::WindowsAndMessaging::{+ SW_RESTORE, SetForegroundWindow, ShowWindow,+ };++ let hwnd = window.raw_handle().inner();++ unsafe {+ ShowWindow(hwnd, SW_RESTORE);+ SetForegroundWindow(hwnd);+ }+ }++ Ok(())+}+// Windows doesn't have a proper concept of window z-index's so we implement them in userspace :(#[derive(Default)]pub struct WindowFocusManager {diff --git a/apps/desktop/src-tauri/src/windows.rs b/apps/desktop/src-tauri/src/windows.rsindex b673c62ff..7393305c2 100644--- a/apps/desktop/src-tauri/src/windows.rs+++ b/apps/desktop/src-tauri/src/windows.rs@@ -257,7 +257,7 @@ impl ShowCapWindow {.minimizable(false).always_on_top(true).visible_on_all_workspaces(true)- .content_protected(true)+ .content_protected(false).center().initialization_script(format!("diff --git a/apps/desktop/src/routes/(window-chrome)/(main).tsx b/apps/desktop/src/routes/(window-chrome)/(main).tsxindex 7f0401487..22c667683 100644--- a/apps/desktop/src/routes/(window-chrome)/(main).tsx+++ b/apps/desktop/src/routes/(window-chrome)/(main).tsx@@ -345,7 +345,7 @@ function Page() {}}}class={cx(- "text-[0.6rem] rounded-lg px-1 py-0.5",+ "text-[0.6rem] ml-2 rounded-lg px-1 py-0.5",license.data?.type === "pro"? "bg-[--blue-400] text-gray-1 dark:text-gray-12": "bg-gray-3 cursor-pointer hover:bg-gray-5",diff --git a/apps/desktop/src/routes/(window-chrome)/new-main/TargetCard.tsx b/apps/desktop/src/routes/(window-chrome)/new-main/TargetCard.tsxnew file mode 100644index 000000000..e794b2165--- /dev/null+++ b/apps/desktop/src/routes/(window-chrome)/new-main/TargetCard.tsx@@ -0,0 +1,218 @@+import { cx } from "cva";+import type { ComponentProps } from "solid-js";+import { createMemo, Show, splitProps } from "solid-js";+import type {+ CaptureDisplayWithThumbnail,+ CaptureWindowWithThumbnail,+} from "~/utils/tauri";+import IconLucideAppWindowMac from "~icons/lucide/app-window-mac";+import IconMdiMonitor from "~icons/mdi/monitor";++function formatResolution(width?: number, height?: number) {+ if (!width || !height) return undefined;++ const roundedWidth = Math.round(width);+ const roundedHeight = Math.round(height);++ if (roundedWidth <= 0 || roundedHeight <= 0) return undefined;++ return `${roundedWidth}×${roundedHeight}`;+}++function formatRefreshRate(refreshRate?: number) {+ if (!refreshRate) return undefined;++ return `${refreshRate} Hz`;+}++type TargetCardProps = (+ | {+ variant: "display";+ target: CaptureDisplayWithThumbnail;+ }+ | {+ variant: "window";+ target: CaptureWindowWithThumbnail;+ }+) &+ Omit<ComponentProps<"button">, "children"> & {+ highlightQuery?: string;+ };++export default function TargetCard(props: TargetCardProps) {+ const [local, rest] = splitProps(props, [+ "variant",+ "target",+ "class",+ "disabled",+ "highlightQuery",+ ]);++ const displayTarget = createMemo(() => {+ if (local.variant !== "display") return undefined;+ return local.target as CaptureDisplayWithThumbnail;+ });++ const windowTarget = createMemo(() => {+ if (local.variant !== "window") return undefined;+ return local.target as CaptureWindowWithThumbnail;+ });++ const renderIcon = (className: string) =>+ local.variant === "display" ? (+ <IconMdiMonitor class={className} />+ ) : (+ <IconLucideAppWindowMac class={className} />+ );++ const label = createMemo(() => {+ const display = displayTarget();+ if (display) return display.name;+ const target = windowTarget();+ return target?.name || target?.owner_name;+ });++ const subtitle = createMemo(() => windowTarget()?.owner_name);++ const metadata = createMemo(() => {+ if (local.variant === "window") {+ const target = windowTarget();+ if (!target) return undefined;+ const bounds = target.bounds;+ const resolution = formatResolution(+ bounds?.size.width,+ bounds?.size.height,+ );+ const refreshRate = formatRefreshRate(target.refresh_rate);++ if (resolution && refreshRate) return `${resolution} @ ${refreshRate}`;+ return resolution ?? refreshRate ?? undefined;+ }++ const target = displayTarget();+ return target ? formatRefreshRate(target.refresh_rate) : undefined;+ });++ const thumbnailSrc = createMemo(() => {+ const target = displayTarget() ?? windowTarget();+ if (!target?.thumbnail) return undefined;+ return `data:image/png;base64,${target.thumbnail}`;+ });++ const appIconSrc = createMemo(() => {+ const target = windowTarget();+ if (!target?.app_icon) return undefined;+ return `data:image/png;base64,${target.app_icon}`;+ });++ const normalizedQuery = createMemo(() => local.highlightQuery?.trim() ?? "");++ const highlight = (text?: string | null) => {+ if (!text) return text;+ const query = normalizedQuery();+ if (!query) return text;++ const regex = new RegExp(`(${escapeRegExp(query)})`, "ig");+ const parts = text.split(regex);+ if (parts.length === 1) return text;++ const lowercaseQuery = query.toLowerCase();++ return parts.map((part) => {+ if (part.toLowerCase() === lowercaseQuery) {+ return (+ <span class="rounded bg-blue-9/20 px-[1px] text-gray-12">{part}</span>+ );+ }+ return part;+ });+ };++ return (+ <button+ type="button"+ {...rest}+ disabled={local.disabled}+ data-variant={local.variant}+ class={cx(+ "group flex flex-col overflow-hidden rounded-lg border border-transparent bg-gray-3 text-left outline-none transition-colors duration-100 hover:bg-gray-4 focus-visible:ring-2 focus-visible:ring-blue-9 focus-visible:ring-offset-2 focus-visible:ring-offset-gray-1",+ local.disabled && "pointer-events-none opacity-60",+ local.class,+ )}+ >+ <div class="relative h-[4.75rem] w-full overflow-hidden bg-gray-4/40">+ <Show+ when={thumbnailSrc()}+ fallback={+ <div class="flex justify-center items-center w-full h-full bg-gray-4">+ {renderIcon("size-6 text-gray-9 opacity-70")}+ </div>+ }+ >+ <img+ src={thumbnailSrc()!}+ alt={`${+ local.variant === "display" ? "Display" : "Window"+ } preview for ${label()}`}+ class="object-cover w-full h-full"+ loading="lazy"+ draggable={false}+ />+ </Show>+ <Show when={appIconSrc()}>+ <div class="flex absolute inset-0 justify-center items-center pointer-events-none bg-black/45">+ <img+ src={appIconSrc()!}+ alt={`${label()} icon`}+ class="h-16 w-16 max-h-[55%] max-w-[55%] rounded-lg border border-black/20 object-contain shadow-lg shadow-black/30"+ draggable={false}+ />+ </div>+ </Show>+ <div class="absolute inset-0 border opacity-60 pointer-events-none border-black/5" />+ <div class="absolute inset-x-0 bottom-0 h-10 bg-gradient-to-t to-transparent pointer-events-none from-black/40" />+ </div>+ <div class="flex flex-row items-start gap-2 px-2 py-1.5">+ <div class="flex-1 min-w-0">+ <p class="truncate text-[11px] font-medium text-gray-12">+ {highlight(label())}+ </p>+ <Show when={subtitle()}>+ <p class="truncate text-[11px] text-gray-11">+ {highlight(subtitle())}+ </p>+ </Show>+ <Show when={metadata()}>+ <p class="truncate text-[11px] text-gray-10">+ {highlight(metadata())}+ </p>+ </Show>+ </div>+ </div>+ </button>+ );+}++function escapeRegExp(value: string) {+ return value.replace(/[\^$*+?.()|[\]{}-]/g, "\\$&");+}++export function TargetCardSkeleton(props: { class?: string }) {+ return (+ <div+ class={cx(+ "flex flex-col overflow-hidden rounded-lg bg-gray-3",+ props.class,+ )}+ >+ <div class="h-[4.75rem] w-full animate-pulse bg-gray-4" />+ <div class="flex flex-row items-start gap-2 px-2 py-1.5">+ <div class="flex-1 space-y-1">+ <div class="w-3/4 h-3 rounded bg-gray-4" />+ <div class="h-2.5 w-1/2 rounded bg-gray-4" />+ <div class="h-2.5 w-2/5 rounded bg-gray-4" />+ </div>+ </div>+ </div>+ );+}diff --git a/apps/desktop/src/routes/(window-chrome)/new-main/TargetDropdownButton.tsx b/apps/desktop/src/routes/(window-chrome)/new-main/TargetDropdownButton.tsxnew file mode 100644index 000000000..a14601d68--- /dev/null+++ b/apps/desktop/src/routes/(window-chrome)/new-main/TargetDropdownButton.tsx@@ -0,0 +1,44 @@+import type { PolymorphicProps } from "@kobalte/core/polymorphic";+import { Polymorphic } from "@kobalte/core/polymorphic";+import { cx } from "cva";+import { splitProps, type ValidComponent } from "solid-js";+import IconCapChevronDown from "~icons/cap/chevron-down";++type TargetDropdownButtonProps<T extends ValidComponent> = PolymorphicProps<+ T,+ {+ class?: string;+ disabled?: boolean;+ expanded?: boolean;+ }+>;++export default function TargetDropdownButton<+ T extends ValidComponent = "button",+>(props: TargetDropdownButtonProps<T>) {+ const [local, rest] = splitProps(props, ["class", "expanded", "disabled"]);++ return (+ <Polymorphic+ as="button"+ type="button"+ {...rest}+ disabled={local.disabled}+ aria-expanded={local.expanded ? "true" : "false"}+ data-expanded={local.expanded ? "true" : "false"}+ class={cx(+ "flex h-[3.75rem] w-5 shrink-0 items-center justify-center rounded-lg bg-gray-4 text-gray-12 transition-colors duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-9 focus-visible:ring-offset-2 focus-visible:ring-offset-gray-1 hover:bg-gray-5",+ local.expanded && "bg-gray-5",+ local.disabled && "pointer-events-none opacity-60",+ local.class,+ )}+ >+ <IconCapChevronDown+ class={cx(+ "size-4 text-gray-11 transition-transform duration-150",+ local.expanded && "rotate-180 text-gray-12",+ )}+ />+ </Polymorphic>+ );+}diff --git a/apps/desktop/src/routes/(window-chrome)/new-main/TargetMenuGrid.tsx b/apps/desktop/src/routes/(window-chrome)/new-main/TargetMenuGrid.tsxnew file mode 100644index 000000000..34cd22912--- /dev/null+++ b/apps/desktop/src/routes/(window-chrome)/new-main/TargetMenuGrid.tsx@@ -0,0 +1,192 @@+import { cx } from "cva";+import { createMemo, For, Match, Switch } from "solid-js";+import { Motion } from "solid-motionone";+import type {+ CaptureDisplayWithThumbnail,+ CaptureWindowWithThumbnail,+} from "~/utils/tauri";+import TargetCard, { TargetCardSkeleton } from "./TargetCard";++const DEFAULT_SKELETON_COUNT = 6;++type BaseProps<T> = {+ targets?: T[];+ onSelect?: (target: T) => void;+ isLoading?: boolean;+ errorMessage?: string;+ emptyMessage?: string;+ disabled?: boolean;+ skeletonCount?: number;+ class?: string;+ highlightQuery?: string;+};++type DisplayGridProps = BaseProps<CaptureDisplayWithThumbnail> & {+ variant: "display";+};++type WindowGridProps = BaseProps<CaptureWindowWithThumbnail> & {+ variant: "window";+};++type TargetMenuGridProps = DisplayGridProps | WindowGridProps;++export default function TargetMenuGrid(props: TargetMenuGridProps) {+ const items = createMemo(() => props.targets ?? []);+ const skeletonItems = createMemo(() =>+ Array.from({ length: props.skeletonCount ?? DEFAULT_SKELETON_COUNT }),+ );+ const isEmpty = createMemo(+ () => !props.isLoading && items().length === 0 && !props.errorMessage,+ );++ let containerRef: HTMLDivElement | undefined;++ const handleKeyDown = (event: KeyboardEvent) => {+ const container = containerRef;+ if (!container) return;++ const buttons = Array.from(+ container.querySelectorAll<HTMLButtonElement>(+ "button[data-target-menu-card]:not(:disabled)",+ ),+ );+ if (!buttons.length) return;++ const currentTarget = event.currentTarget as HTMLButtonElement | null;+ if (!currentTarget) return;++ const currentIndex = buttons.indexOf(currentTarget);+ if (currentIndex === -1) return;++ const totalItems = buttons.length;+ const columns = 2;+ let nextIndex = currentIndex;++ switch (event.key) {+ case "ArrowRight":+ nextIndex = (currentIndex + 1) % totalItems;+ event.preventDefault();+ break;+ case "ArrowLeft":+ nextIndex = (currentIndex - 1 + totalItems) % totalItems;+ event.preventDefault();+ break;+ case "ArrowDown":+ nextIndex = Math.min(currentIndex + columns, totalItems - 1);+ event.preventDefault();+ break;+ case "ArrowUp":+ nextIndex = Math.max(currentIndex - columns, 0);+ event.preventDefault();+ break;+ case "Home":+ nextIndex = 0;+ event.preventDefault();+ break;+ case "End":+ nextIndex = totalItems - 1;+ event.preventDefault();+ break;+ default:+ return;+ }++ const target = buttons[nextIndex];+ target?.focus();+ };++ const defaultEmptyMessage = () =>+ props.variant === "display" ? "No displays found" : "No windows found";++ return (+ <div+ data-variant={props.variant}+ class={cx(+ "grid w-full grid-cols-2 content-start items-start justify-items-stretch gap-2",+ props.class,+ )}+ ref={(node) => {+ containerRef = node ?? undefined;+ }}+ >+ <Switch>+ <Match when={props.errorMessage}>+ <div class="flex flex-col col-span-2 gap-2 justify-center items-center py-6 text-sm text-center text-gray-11">+ <p>{props.errorMessage}</p>+ </div>+ </Match>+ <Match when={props.isLoading}>+ <For each={skeletonItems()}>+ {() => <TargetCardSkeleton class="w-full" />}+ </For>+ </Match>+ <Match when={isEmpty()}>+ <div class="col-span-2 py-6 text-sm text-center text-gray-11">+ {props.emptyMessage ?? defaultEmptyMessage()}+ </div>+ </Match>+ <Match when={items().length > 0}>+ <Switch>+ <Match when={props.variant === "display"}>+ {(() => {+ const displayProps = props as DisplayGridProps;+ return (+ <For each={items() as CaptureDisplayWithThumbnail[]}>+ {(item, index) => (+ <Motion.div+ initial={{ scale: 0.95, opacity: 0 }}+ animate={{ scale: 1, opacity: 1 }}+ exit={{ scale: 0.95 }}+ transition={{ duration: 0.2, delay: index() * 0.1 }}+ >+ <TargetCard+ variant="display"+ target={item}+ onClick={() => displayProps.onSelect?.(item)}+ disabled={displayProps.disabled}+ onKeyDown={handleKeyDown}+ class="w-full"+ data-target-menu-card="true"+ highlightQuery={displayProps.highlightQuery}+ />+ </Motion.div>+ )}+ </For>+ );+ })()}+ </Match>+ <Match when={props.variant === "window"}>+ {(() => {+ const windowProps = props as WindowGridProps;+ return (+ <For each={items() as CaptureWindowWithThumbnail[]}>+ {(item, index) => (+ <Motion.div+ initial={{ scale: 0.95, opacity: 0 }}+ animate={{ scale: 1, opacity: 1 }}+ exit={{ scale: 0.95 }}+ transition={{ duration: 0.2, delay: index() * 0.1 }}+ >+ <TargetCard+ variant="window"+ target={item}+ onClick={() => windowProps.onSelect?.(item)}+ disabled={windowProps.disabled}+ onKeyDown={handleKeyDown}+ class="w-full"+ data-target-menu-card="true"+ highlightQuery={windowProps.highlightQuery}+ />+ </Motion.div>+ )}+ </For>+ );+ })()}+ </Match>+ </Switch>+ </Match>+ </Switch>+ </div>+ );+}diff --git a/apps/desktop/src/routes/(window-chrome)/new-main/TargetTypeButton.tsx b/apps/desktop/src/routes/(window-chrome)/new-main/TargetTypeButton.tsxindex 28b2be5bb..6664e1e40 100644--- a/apps/desktop/src/routes/(window-chrome)/new-main/TargetTypeButton.tsx+++ b/apps/desktop/src/routes/(window-chrome)/new-main/TargetTypeButton.tsx@@ -1,33 +1,43 @@import { cx } from "cva";-import type { Component, ComponentProps } from "solid-js";+import { type Component, type ComponentProps, splitProps } from "solid-js";++type TargetTypeButtonProps = {+ selected: boolean;+ Component: Component<ComponentProps<"svg">>;+ name: string;+ disabled?: boolean;+} & ComponentProps<"button">;++function TargetTypeButton(props: TargetTypeButtonProps) {+ const [local, rest] = splitProps(props, [+ "selected",+ "Component",+ "name",+ "disabled",+ "class",+ ]);-function TargetTypeButton(- props: {- selected: boolean;- Component: Component<ComponentProps<"svg">>;- name: string;- disabled?: boolean;- } & ComponentProps<"div">,-) {return (- <div- {...props}+ <button+ {...rest}+ type="button"+ disabled={local.disabled}+ aria-pressed={local.selected ? "true" : "false"}class={cx(- "flex-1 text-center hover:bg-gray-4 bg-gray-3 flex flex-col ring-offset-gray-1 ring-offset-2 items-center justify-end gap-2 py-1.5 rounded-lg transition-all",- props.selected- ? "bg-gray-3 text-white ring-blue-9 ring-1"- : "ring-transparent ring-0",- props.disabled ? "opacity-70 pointer-events-none" : "",+ "flex flex-1 flex-col items-center justify-end gap-2 rounded-lg bg-gray-3 py-1.5 text-center transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-9 focus-visible:ring-offset-2 focus-visible:ring-offset-gray-1",+ local.selected ? "text-gray-12" : "text-gray-12 hover:bg-gray-4",+ local.disabled && "pointer-events-none opacity-60",+ local.class,)}>- <props.Component+ <local.Componentclass={cx("size-6 transition-colors",- props.selected ? "text-gray-12" : "text-gray-9",+ local.selected ? "text-gray-12" : "text-gray-9",)}/>- <p class="text-xs text-gray-12">{props.name}</p>- </div>+ <p class="text-xs">{local.name}</p>+ </button>);}diff --git a/apps/desktop/src/routes/(window-chrome)/new-main/index.tsx b/apps/desktop/src/routes/(window-chrome)/new-main/index.tsxindex 5208708b2..8bc8e2f0b 100644--- a/apps/desktop/src/routes/(window-chrome)/new-main/index.tsx+++ b/apps/desktop/src/routes/(window-chrome)/new-main/index.tsx@@ -18,6 +18,8 @@ import * as updater from "@tauri-apps/plugin-updater";import { cx } from "cva";import {createEffect,+ createMemo,+ createSignal,ErrorBoundary,onCleanup,onMount,@@ -25,7 +27,10 @@ import {Suspense,} from "solid-js";import { reconcile } from "solid-js/store";+import { Motion, Presence } from "solid-motionone";+import { Transition } from "solid-transition-group";import Tooltip from "~/components/Tooltip";+import { Input } from "~/routes/editor/ui";import { generalSettingsStore } from "~/store";import { createSignInMutation } from "~/utils/auth";import {@@ -33,16 +38,27 @@ import {createCurrentRecordingQuery,createLicenseQuery,listAudioDevices,+ listDisplaysWithThumbnails,listScreens,listVideoDevices,listWindows,+ listWindowsWithThumbnails,} from "~/utils/queries";import {type CameraInfo,+ type CaptureDisplay,+ type CaptureDisplayWithThumbnail,+ type CaptureWindow,+ type CaptureWindowWithThumbnail,commands,type DeviceOrModelID,type ScreenCaptureTarget,} from "~/utils/tauri";+import IconLucideAppWindowMac from "~icons/lucide/app-window-mac";+import IconLucideArrowLeft from "~icons/lucide/arrow-left";+import IconLucideSearch from "~icons/lucide/search";+import IconMaterialSymbolsScreenshotFrame2Rounded from "~icons/material-symbols/screenshot-frame-2-rounded";+import IconMdiMonitor from "~icons/mdi/monitor";import { WindowChromeHeader } from "../Context";import {RecordingOptionsProvider,@@ -52,6 +68,8 @@ import CameraSelect from "./CameraSelect";import ChangelogButton from "./ChangeLogButton";import MicrophoneSelect from "./MicrophoneSelect";import SystemAudio from "./SystemAudio";+import TargetDropdownButton from "./TargetDropdownButton";+import TargetMenuGrid from "./TargetMenuGrid";import TargetTypeButton from "./TargetTypeButton";function getWindowSize() {@@ -70,10 +88,179 @@ const findCamera = (cameras: CameraInfo[], id: DeviceOrModelID) => {});};+type WindowListItem = Pick<+ CaptureWindow,+ "id" | "owner_name" | "name" | "bounds" | "refresh_rate"+>;++const createWindowSignature = (+ list?: readonly WindowListItem[],+): string | undefined => {+ if (!list) return undefined;++ return list+ .map((item) => {+ const { position, size } = item.bounds;+ return [+ item.id,+ item.owner_name,+ item.name,+ position.x,+ position.y,+ size.width,+ size.height,+ item.refresh_rate,+ ].join(":");+ })+ .join("|");+};++type DisplayListItem = Pick<CaptureDisplay, "id" | "name" | "refresh_rate">;++const createDisplaySignature = (+ list?: readonly DisplayListItem[],+): string | undefined => {+ if (!list) return undefined;++ return list+ .map((item) => [item.id, item.name, item.refresh_rate].join(":"))+ .join("|");+};++type TargetMenuPanelProps =+ | {+ variant: "display";+ targets?: CaptureDisplayWithThumbnail[];+ onSelect: (target: CaptureDisplayWithThumbnail) => void;+ }+ | {+ variant: "window";+ targets?: CaptureWindowWithThumbnail[];+ onSelect: (target: CaptureWindowWithThumbnail) => void;+ };++type SharedTargetMenuProps = {+ isLoading: boolean;+ errorMessage?: string;+ disabled: boolean;+ onBack: () => void;+};++function TargetMenuPanel(props: TargetMenuPanelProps & SharedTargetMenuProps) {+ const [search, setSearch] = createSignal("");+ const trimmedSearch = createMemo(() => search().trim());+ const normalizedQuery = createMemo(() => trimmedSearch().toLowerCase());+ const placeholder =+ props.variant === "display" ? "Search displays" : "Search windows";+ const noResultsMessage =+ props.variant === "display"+ ? "No matching displays"+ : "No matching windows";++ const filteredDisplayTargets = createMemo<CaptureDisplayWithThumbnail[]>(+ () => {+ if (props.variant !== "display") return [];+ const query = normalizedQuery();+ const targets = props.targets ?? [];+ if (!query) return targets;++ const matchesQuery = (value?: string | null) =>+ !!value && value.toLowerCase().includes(query);++ return targets.filter(+ (target) => matchesQuery(target.name) || matchesQuery(target.id),+ );+ },+ );++ const filteredWindowTargets = createMemo<CaptureWindowWithThumbnail[]>(() => {+ if (props.variant !== "window") return [];+ const query = normalizedQuery();+ const targets = props.targets ?? [];+ if (!query) return targets;++ const matchesQuery = (value?: string | null) =>+ !!value && value.toLowerCase().includes(query);++ return targets.filter(+ (target) =>+ matchesQuery(target.name) ||+ matchesQuery(target.owner_name) ||+ matchesQuery(target.id),+ );+ });++ return (+ <div class="flex flex-col w-full">+ <div class="flex gap-3 justify-between items-center mt-3">+ <div+ onClick={() => props.onBack()}+ class="flex gap-1 items-center rounded-md px-1.5 text-xs+ text-gray-11 transition-opacity hover:opacity-70 hover:text-gray-12+ focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-9 focus-visible:ring-offset-2 focus-visible:ring-offset-gray-1"+ >+ <IconLucideArrowLeft class="size-3 text-gray-11" />+ <span class="font-medium text-gray-12">Back</span>+ </div>+ <div class="relative flex-1 min-w-0 h-[36px] flex items-center">+ <IconLucideSearch class="absolute left-2 top-[48%] -translate-y-1/2 pointer-events-none size-3 text-gray-10" />+ <Input+ type="search"+ class="py-2 pl-6 h-full"+ value={search()}+ onInput={(event) => setSearch(event.currentTarget.value)}+ onKeyDown={(event) => {+ if (event.key === "Escape" && search()) {+ event.preventDefault();+ setSearch("");+ }+ }}+ placeholder={placeholder}+ autoCapitalize="off"+ autocorrect="off"+ autocomplete="off"+ spellcheck={false}+ aria-label={placeholder}+ />+ </div>+ </div>+ <div class="pt-4">+ <div+ class="px-2 custom-scroll"+ style="max-height: calc(256px - 100px - 1rem)"+ >+ {props.variant === "display" ? (+ <TargetMenuGrid+ variant="display"+ targets={filteredDisplayTargets()}+ isLoading={props.isLoading}+ errorMessage={props.errorMessage}+ onSelect={props.onSelect}+ disabled={props.disabled}+ highlightQuery={trimmedSearch()}+ emptyMessage={trimmedSearch() ? noResultsMessage : undefined}+ />+ ) : (+ <TargetMenuGrid+ variant="window"+ targets={filteredWindowTargets()}+ isLoading={props.isLoading}+ errorMessage={props.errorMessage}+ onSelect={props.onSelect}+ disabled={props.disabled}+ highlightQuery={trimmedSearch()}+ emptyMessage={trimmedSearch() ? noResultsMessage : undefined}+ />+ )}+ </div>+ </div>+ </div>+ );+}+export default function () {const generalSettings = generalSettingsStore.createQuery();- // We do this on focus so the window doesn't get revealed when toggling the settingconst navigate = useNavigate();createEventListener(window, "focus", () => {if (generalSettings.data?.enableNewRecordingFlow === false) navigate("/");@@ -116,21 +303,103 @@ function Page() {const currentRecording = createCurrentRecordingQuery();const isRecording = () => !!currentRecording.data;+ const [displayMenuOpen, setDisplayMenuOpen] = createSignal(false);+ const [windowMenuOpen, setWindowMenuOpen] = createSignal(false);+ const activeMenu = createMemo<"display" | "window" | null>(() => {+ if (displayMenuOpen()) return "display";+ if (windowMenuOpen()) return "window";+ return null;+ });+ const [hasOpenedDisplayMenu, setHasOpenedDisplayMenu] = createSignal(false);+ const [hasOpenedWindowMenu, setHasOpenedWindowMenu] = createSignal(false);++ let displayTriggerRef: HTMLButtonElement | undefined;+ let windowTriggerRef: HTMLButtonElement | undefined;++ const displayTargets = useQuery(() => ({+ ...listDisplaysWithThumbnails,+ enabled: hasOpenedDisplayMenu(),+ refetchInterval: false,+ }));++ const windowTargets = useQuery(() => ({+ ...listWindowsWithThumbnails,+ enabled: hasOpenedWindowMenu(),+ refetchInterval: false,+ }));++ const hasDisplayTargetsData = () => displayTargets.status === "success";+ const hasWindowTargetsData = () => windowTargets.status === "success";++ const displayTargetsData = createMemo(() =>+ hasDisplayTargetsData() ? displayTargets.data : undefined,+ );++ const windowTargetsData = createMemo(() =>+ hasWindowTargetsData() ? windowTargets.data : undefined,+ );++ const displayMenuLoading = () =>+ !hasDisplayTargetsData() &&+ (displayTargets.status === "pending" ||+ displayTargets.fetchStatus === "fetching");+ const windowMenuLoading = () =>+ !hasWindowTargetsData() &&+ (windowTargets.status === "pending" ||+ windowTargets.fetchStatus === "fetching");++ const displayErrorMessage = () => {+ if (!displayTargets.error) return undefined;+ return "Unable to load displays. Try using the Display button.";+ };++ const windowErrorMessage = () => {+ if (!windowTargets.error) return undefined;+ return "Unable to load windows. Try using the Window button.";+ };++ const selectDisplayTarget = (target: CaptureDisplayWithThumbnail) => {+ setOptions(+ "captureTarget",+ reconcile({ variant: "display", id: target.id }),+ );+ setOptions("targetMode", "display");+ setDisplayMenuOpen(false);+ displayTriggerRef?.focus();+ };++ const selectWindowTarget = async (target: CaptureWindowWithThumbnail) => {+ setOptions(+ "captureTarget",+ reconcile({ variant: "window", id: target.id }),+ );+ setOptions("targetMode", "window");+ setWindowMenuOpen(false);+ windowTriggerRef?.focus();++ try {+ await commands.focusWindow(target.id);+ } catch (error) {+ console.error("Failed to focus window:", error);+ }+ };++ createEffect(() => {+ if (!isRecording()) return;+ setDisplayMenuOpen(false);+ setWindowMenuOpen(false);+ });+createUpdateCheck();onMount(async () => {- // We don't want the target select overlay on launchsetOptions({ targetMode: (window as any).__CAP__.initialTargetMode });- // Enforce window size with multiple safeguardsconst currentWindow = getCurrentWindow();- // We resize the window on mount as the user could be switching to the new recording flow- // which has a differently sized window.const size = getWindowSize();currentWindow.setSize(new LogicalSize(size.width, size.height));- // Check size when app regains focusconst unlistenFocus = currentWindow.onFocusChanged(({ payload: focused }) => {if (focused) {@@ -141,7 +410,6 @@ function Page() {},);- // Listen for resize eventsconst unlistenResize = currentWindow.onResized(() => {const size = getWindowSize();@@ -167,6 +435,48 @@ function Page() {const cameras = useQuery(() => listVideoDevices);const mics = useQuery(() => listAudioDevices);+ const windowListSignature = createMemo(() =>+ createWindowSignature(windows.data),+ );+ const displayListSignature = createMemo(() =>+ createDisplaySignature(screens.data),+ );+ const [windowThumbnailsSignature, setWindowThumbnailsSignature] =+ createSignal<string | undefined>();+ const [displayThumbnailsSignature, setDisplayThumbnailsSignature] =+ createSignal<string | undefined>();++ createEffect(() => {+ if (windowTargets.status !== "success") return;+ const signature = createWindowSignature(windowTargets.data);+ if (signature !== undefined) setWindowThumbnailsSignature(signature);+ });++ createEffect(() => {+ if (displayTargets.status !== "success") return;+ const signature = createDisplaySignature(displayTargets.data);+ if (signature !== undefined) setDisplayThumbnailsSignature(signature);+ });++ // Refetch thumbnails only when the cheaper lists detect a change.+ createEffect(() => {+ if (!hasOpenedWindowMenu()) return;+ const signature = windowListSignature();+ if (signature === undefined) return;+ if (windowTargets.fetchStatus !== "idle") return;+ if (windowThumbnailsSignature() === signature) return;+ void windowTargets.refetch();+ });++ createEffect(() => {+ if (!hasOpenedDisplayMenu()) return;+ const signature = displayListSignature();+ if (signature === undefined) return;+ if (displayTargets.fetchStatus !== "idle") return;+ if (displayThumbnailsSignature() === signature) return;+ void displayTargets.refetch();+ });+cameras.promise.then((cameras) => {if (rawOptions.cameraID && findCamera(cameras, rawOptions.cameraID)) {setOptions("cameraLabel", null);@@ -179,8 +489,6 @@ function Page() {}});- // these options take the raw config values and combine them with the available options,- // allowing us to define fallbacks if the selected options aren't actually availableconst options = {screen: () => {let screen;@@ -237,7 +545,6 @@ function Page() {},};- // if target is window and no windows are available, switch to screen capturecreateEffect(() => {const target = options.target();if (!target) return;@@ -273,6 +580,138 @@ function Page() {const signIn = createSignInMutation();+ const BaseControls = () => (+ <div class="space-y-2">+ <CameraSelect+ disabled={cameras.isPending}+ options={cameras.data ?? []}+ value={options.camera() ?? null}+ onChange={(c) => {+ if (!c) setCamera.mutate(null);+ else if (c.model_id) setCamera.mutate({ ModelID: c.model_id });+ else setCamera.mutate({ DeviceID: c.device_id });+ }}+ />+ <MicrophoneSelect+ disabled={mics.isPending}+ options={mics.isPending ? [] : (mics.data ?? [])}+ value={+ mics.isPending ? rawOptions.micName : (options.micName() ?? null)+ }+ onChange={(v) => setMicInput.mutate(v)}+ />+ <SystemAudio />+ </div>+ );++ const TargetSelectionHome = () => (+ <Motion.div+ initial={{ scale: 0.95 }}+ animate={{ scale: 1 }}+ exit={{ scale: 0.95 }}+ transition={{ duration: 0.2 }}+ class="flex flex-col gap-2 w-full"+ >+ <div class="flex flex-row gap-2 items-stretch w-full text-xs text-gray-11">+ <div+ class={cx(+ "flex flex-1 overflow-hidden rounded-lg bg-gray-3 ring-1 ring-transparent ring-offset-2 ring-offset-gray-1 transition focus-within:ring-blue-9 focus-within:ring-offset-2 focus-within:ring-offset-gray-1",+ (rawOptions.targetMode === "display" || displayMenuOpen()) &&+ "ring-blue-9",+ )}+ >+ <TargetTypeButton+ selected={rawOptions.targetMode === "display"}+ Component={IconMdiMonitor}+ disabled={isRecording()}+ onClick={() => {+ if (isRecording()) return;+ setOptions("targetMode", (v) =>+ v === "display" ? null : "display",+ );+ }}+ name="Display"+ class="flex-1 rounded-none focus-visible:ring-0 focus-visible:ring-offset-0"+ />+ <TargetDropdownButton+ class={cx(+ "rounded-none border-l border-gray-6 focus-visible:ring-0 focus-visible:ring-offset-0",+ displayMenuOpen() && "bg-gray-5",+ )}+ ref={(el) => (displayTriggerRef = el)}+ disabled={isRecording()}+ expanded={displayMenuOpen()}+ onClick={() => {+ setDisplayMenuOpen((prev) => {+ const next = !prev;+ if (next) {+ setWindowMenuOpen(false);+ setHasOpenedDisplayMenu(true);+ }+ return next;+ });+ }}+ aria-haspopup="menu"+ aria-label="Choose display"+ />+ </div>+ <div+ class={cx(+ "flex flex-1 overflow-hidden rounded-lg bg-gray-3 ring-1 ring-transparent ring-offset-2 ring-offset-gray-1 transition focus-within:ring-blue-9 focus-within:ring-offset-2 focus-within:ring-offset-gray-1",+ (rawOptions.targetMode === "window" || windowMenuOpen()) &&+ "ring-blue-9",+ )}+ >+ <TargetTypeButton+ selected={rawOptions.targetMode === "window"}+ Component={IconLucideAppWindowMac}+ disabled={isRecording()}+ onClick={() => {+ if (isRecording()) return;+ setOptions("targetMode", (v) =>+ v === "window" ? null : "window",+ );+ }}+ name="Window"+ class="flex-1 rounded-none focus-visible:ring-0 focus-visible:ring-offset-0"+ />+ <TargetDropdownButton+ class={cx(+ "rounded-none border-l border-gray-6 focus-visible:ring-0 focus-visible:ring-offset-0",+ windowMenuOpen() && "bg-gray-5",+ )}+ ref={(el) => (windowTriggerRef = el)}+ disabled={isRecording()}+ expanded={windowMenuOpen()}+ onClick={() => {+ setWindowMenuOpen((prev) => {+ const next = !prev;+ if (next) {+ setDisplayMenuOpen(false);+ setHasOpenedWindowMenu(true);+ }+ return next;+ });+ }}+ aria-haspopup="menu"+ aria-label="Choose window"+ />+ </div>+ <TargetTypeButton+ selected={rawOptions.targetMode === "area"}+ Component={IconMaterialSymbolsScreenshotFrame2Rounded}+ disabled={isRecording()}+ onClick={() => {+ if (isRecording()) return;+ setOptions("targetMode", (v) => (v === "area" ? null : "area"));+ }}+ name="Area"+ />+ </div>+ <BaseControls />+ </Motion.div>+ );+const startSignInCleanup = listen("start-sign-in", async () => {const abort = new AbortController();for (const win of await getAllWebviewWindows()) {@@ -292,7 +731,11 @@ function Page() {onCleanup(() => startSignInCleanup.then((cb) => cb()));return (- <div class="flex relative justify-center flex-col px-3 gap-2 h-full text-[--text-primary]">+ <div+ class={`flex relative ${+ displayMenuOpen() || windowMenuOpen() ? "" : "justify-center"+ } flex-col px-3 gap-2 h-full text-[--text-primary]`}+ ><WindowChromeHeader hideMaximize><divclass={cx(@@ -353,7 +796,7 @@ function Page() {}}}class={cx(- "text-[0.6rem] rounded-full px-1.5 py-0.5",+ "text-[0.6rem] ml-2 rounded-full px-1.5 py-0.5",license.data?.type === "pro"? "bg-[--blue-300] text-gray-1 dark:text-gray-12": "bg-gray-4 cursor-pointer hover:bg-gray-5",@@ -388,64 +831,38 @@ function Page() {</div></div></Show>- <div class="flex flex-row gap-2 items-stretch w-full text-xs text-gray-11">- <TargetTypeButton- selected={rawOptions.targetMode === "display"}- Component={IconMdiMonitor}- disabled={isRecording()}- onClick={() => {- //if recording early return- if (isRecording()) return;- setOptions("targetMode", (v) =>- v === "display" ? null : "display",- );- }}- name="Display"- />- <TargetTypeButton- selected={rawOptions.targetMode === "window"}- Component={IconLucideAppWindowMac}- disabled={isRecording()}- onClick={() => {- if (isRecording()) return;- setOptions("targetMode", (v) => (v === "window" ? null : "window"));- }}- name="Window"- />- <TargetTypeButton- selected={rawOptions.targetMode === "area"}- Component={IconMaterialSymbolsScreenshotFrame2Rounded}- disabled={isRecording()}- onClick={() => {- if (isRecording()) return;- setOptions("targetMode", (v) => (v === "area" ? null : "area"));- }}- name="Area"- />- </div><Show when={!signIn.isPending}>- <div class="space-y-2">- <CameraSelect- disabled={cameras.isPending}- options={cameras.data ?? []}- value={options.camera() ?? null}- onChange={(c) => {- if (!c) setCamera.mutate(null);- else if (c.model_id) setCamera.mutate({ ModelID: c.model_id });- else setCamera.mutate({ DeviceID: c.device_id });- }}- />- <MicrophoneSelect- disabled={mics.isPending}- options={mics.isPending ? [] : (mics.data ?? [])}- // this prevents options.micName() from suspending on initial load- value={- mics.isPending ? rawOptions.micName : (options.micName() ?? null)- }- onChange={(v) => setMicInput.mutate(v)}- />- <SystemAudio />- </div>+ <Show when={activeMenu()} keyed fallback={<TargetSelectionHome />}>+ {(variant) =>+ variant === "display" ? (+ <TargetMenuPanel+ variant="display"+ targets={displayTargetsData()}+ isLoading={displayMenuLoading()}+ errorMessage={displayErrorMessage()}+ onSelect={selectDisplayTarget}+ disabled={isRecording()}+ onBack={() => {+ setDisplayMenuOpen(false);+ displayTriggerRef?.focus();+ }}+ />+ ) : (+ <TargetMenuPanel+ variant="window"+ targets={windowTargetsData()}+ isLoading={windowMenuLoading()}+ errorMessage={windowErrorMessage()}+ onSelect={selectWindowTarget}+ disabled={isRecording()}+ onBack={() => {+ setWindowMenuOpen(false);+ windowTriggerRef?.focus();+ }}+ />+ )+ }+ </Show></Show></div>);diff --git a/apps/desktop/src/routes/editor/ui.tsx b/apps/desktop/src/routes/editor/ui.tsxindex 88d988a09..83d8b4caf 100644--- a/apps/desktop/src/routes/editor/ui.tsx+++ b/apps/desktop/src/routes/editor/ui.tsx@@ -151,8 +151,8 @@ export function Input(props: ComponentProps<"input">) {<TextInput{...props}class={cx(- "rounded-[0.5rem] bg-gray-2 hover:ring-1 py-[18px] hover:ring-gray-5 h-[2rem] font-normal placeholder:text-black-transparent-40 text-xs caret-gray-500 transition-shadow duration-200 focus:ring-offset-1 focus:bg-gray-3 focus:ring-offset-gray-100 focus:ring-1 focus:ring-gray-10 px-[0.5rem] w-full text-[0.875rem] outline-none text-gray-12",props.class,+ "rounded-[0.5rem] bg-gray-2 hover:ring-1 py-[18px] hover:ring-gray-5 h-[2rem] font-normal placeholder:text-black-transparent-40 text-xs caret-gray-500 transition-shadow duration-200 focus:ring-offset-1 focus:bg-gray-3 focus:ring-offset-gray-100 focus:ring-1 focus:ring-gray-10 px-[0.5rem] w-full text-[0.875rem] outline-none text-gray-12",)}/>);diff --git a/apps/desktop/src/routes/target-select-overlay.tsx b/apps/desktop/src/routes/target-select-overlay.tsxindex 2be2bd1aa..71c510e1a 100644--- a/apps/desktop/src/routes/target-select-overlay.tsx+++ b/apps/desktop/src/routes/target-select-overlay.tsx@@ -64,16 +64,48 @@ function Inner() {});onCleanup(() => unsubTargetUnderCursor.then((unsub) => unsub()));+ const selectedWindow = createQuery(() => ({+ queryKey: ["selectedWindow", rawOptions.captureTarget],+ queryFn: async () => {+ if (rawOptions.captureTarget.variant !== "window") return null;+ const windowId = rawOptions.captureTarget.id;++ const windows = await commands.listCaptureWindows();+ const window = windows.find((w) => w.id === windowId);++ if (!window) return null;++ return {+ id: window.id,+ app_name: window.owner_name || window.name || "Unknown",+ bounds: window.bounds,+ };+ },+ enabled:+ rawOptions.captureTarget.variant === "window" &&+ rawOptions.targetMode === "window",+ staleTime: 5 * 1000,+ }));++ const windowToShow = () => {+ const hoveredWindow = targetUnderCursor.window;+ if (hoveredWindow) return hoveredWindow;+ if (rawOptions.captureTarget.variant === "window") {+ const selected = selectedWindow.data;+ if (selected) return selected;+ }+ return hoveredWindow;+ };+const windowIcon = createQuery(() => ({- queryKey: ["windowIcon", targetUnderCursor.window?.id],+ queryKey: ["windowIcon", windowToShow()?.id],queryFn: async () => {- if (!targetUnderCursor.window?.id) return null;- return await commands.getWindowIcon(- targetUnderCursor.window.id.toString(),- );+ const window = windowToShow();+ if (!window?.id) return null;+ return await commands.getWindowIcon(window.id.toString());},- enabled: !!targetUnderCursor.window?.id,- staleTime: 5 * 60 * 1000, // Cache for 5 minutes+ enabled: !!windowToShow()?.id,+ staleTime: 5 * 60 * 1000,}));const displayInformation = createQuery(() => ({@@ -184,10 +216,12 @@ function Inner() {<Matchwhen={rawOptions.targetMode === "window" &&- targetUnderCursor.display_id === params.displayId+ (targetUnderCursor.display_id === params.displayId ||+ (rawOptions.captureTarget.variant === "window" &&+ selectedWindow.data))}>- <Show when={targetUnderCursor.window} keyed>+ <Show when={windowToShow()} keyed>{(windowUnderCursor) => (<divdata-over={targetUnderCursor.display_id === params.displayId}diff --git a/apps/desktop/src/utils/queries.ts b/apps/desktop/src/utils/queries.tsindex b9d11131d..93ad12177 100644--- a/apps/desktop/src/utils/queries.ts+++ b/apps/desktop/src/utils/queries.ts@@ -39,7 +39,7 @@ export const listWindows = queryOptions({return w;},reconcile: "id",- refetchInterval: 1000,+ refetchInterval: false,});export const listScreens = queryOptions({@@ -49,6 +49,30 @@ export const listScreens = queryOptions({refetchInterval: 1000,});+export const listWindowsWithThumbnails = queryOptions({+ queryKey: ["capture", "windows-thumbnails"] as const,+ queryFn: async () => {+ const w = await commands.listWindowsWithThumbnails();++ w.sort(+ (a, b) =>+ a.owner_name.localeCompare(b.owner_name) ||+ a.name.localeCompare(b.name),+ );++ return w;+ },+ reconcile: "id",+ refetchInterval: false,+});++export const listDisplaysWithThumbnails = queryOptions({+ queryKey: ["capture", "displays-thumbnails"] as const,+ queryFn: () => commands.listDisplaysWithThumbnails(),+ reconcile: "id",+ refetchInterval: 1000,+});+const getCurrentRecording = queryOptions({queryKey: ["currentRecording"] as const,queryFn: () => commands.getCurrentRecording().then((d) => d[0]),diff --git a/apps/desktop/src/utils/tauri.ts b/apps/desktop/src/utils/tauri.tsindex 967c40dbc..64aa541a2 100644--- a/apps/desktop/src/utils/tauri.ts+++ b/apps/desktop/src/utils/tauri.ts@@ -38,6 +38,12 @@ async listCaptureWindows() : Promise<CaptureWindow[]> {async listCaptureDisplays() : Promise<CaptureDisplay[]> {return await TAURI_INVOKE("list_capture_displays");},+async listDisplaysWithThumbnails() : Promise<CaptureDisplayWithThumbnail[]> {+ return await TAURI_INVOKE("list_displays_with_thumbnails");+},+async listWindowsWithThumbnails() : Promise<CaptureWindowWithThumbnail[]> {+ return await TAURI_INVOKE("list_windows_with_thumbnails");+},async takeScreenshot() : Promise<null> {return await TAURI_INVOKE("take_screenshot");},@@ -263,6 +269,9 @@ async displayInformation(displayId: string) : Promise<DisplayInformation> {async getWindowIcon(windowId: string) : Promise<string | null> {return await TAURI_INVOKE("get_window_icon", { windowId });},+async focusWindow(windowId: WindowId) : Promise<null> {+ return await TAURI_INVOKE("focus_window", { windowId });+},async editorDeleteProject() : Promise<null> {return await TAURI_INVOKE("editor_delete_project");}@@ -351,7 +360,9 @@ export type CaptionSegment = { id: string; start: number; end: number; text: strexport type CaptionSettings = { enabled: boolean; font: string; size: number; color: string; backgroundColor: string; backgroundOpacity: number; position: string; bold: boolean; italic: boolean; outline: boolean; outlineColor: string; exportWithSubtitles: boolean }export type CaptionsData = { segments: CaptionSegment[]; settings: CaptionSettings }export type CaptureDisplay = { id: DisplayId; name: string; refresh_rate: number }+export type CaptureDisplayWithThumbnail = { id: DisplayId; name: string; refresh_rate: number; thumbnail: string | null }export type CaptureWindow = { id: WindowId; owner_name: string; name: string; bounds: LogicalBounds; refresh_rate: number }+export type CaptureWindowWithThumbnail = { id: WindowId; owner_name: string; name: string; bounds: LogicalBounds; refresh_rate: number; thumbnail: string | null; app_icon: string | null }export type ClipConfiguration = { index: number; offsets: ClipOffsets }export type ClipOffsets = { camera?: number; mic?: number; system_audio?: number }export type CommercialLicense = { licenseKey: string; expiryDate: number | null; refresh: number; activatedOn: number }diff --git a/crates/scap-targets/src/platform/macos.rs b/crates/scap-targets/src/platform/macos.rsindex 8aee9123a..a04e4c75c 100644--- a/crates/scap-targets/src/platform/macos.rs+++ b/crates/scap-targets/src/platform/macos.rs@@ -2,7 +2,12 @@ use std::{ffi::c_void, str::FromStr};use cidre::{arc, ns, sc};use cocoa::appkit::NSScreen;-use core_foundation::{array::CFArray, base::FromVoid, number::CFNumber, string::CFString};+use core_foundation::{+ array::CFArray,+ base::{FromVoid, TCFType},+ number::CFNumber,+ string::CFString,+};use core_graphics::{display::{CFDictionary, CGDirectDisplayID, CGDisplay, CGDisplayBounds, CGDisplayCopyDisplayMode,@@ -317,6 +322,22 @@ impl WindowImpl {}}+ pub fn owner_pid(&self) -> Option<i32> {+ let windows =+ core_graphics::window::copy_window_info(kCGWindowListOptionIncludingWindow, self.0)?;++ let window_dict =+ unsafe { CFDictionary::<CFString, *const c_void>::from_void(*windows.get(0)?) };++ let key = CFString::from_static_string("kCGWindowOwnerPID");++ unsafe {+ window_dict+ .find(key.as_concrete_TypeRef())+ .and_then(|v| CFNumber::from_void(*v).to_i32())+ }+ }+pub fn name(&self) -> Option<String> {let windows =core_graphics::window::copy_window_info(kCGWindowListOptionIncludingWindow, self.0)?;diff --git a/crates/scap-targets/src/platform/win.rs b/crates/scap-targets/src/platform/win.rsindex 967711038..817a230dd 100644--- a/crates/scap-targets/src/platform/win.rs+++ b/crates/scap-targets/src/platform/win.rs@@ -1145,6 +1145,11 @@ impl WindowImpl {true}++ pub fn try_as_capture_item(&self) -> windows::core::Result<GraphicsCaptureItem> {+ let interop = windows::core::factory::<GraphicsCaptureItem, IGraphicsCaptureItemInterop>()?;+ unsafe { interop.CreateForWindow(self.0) }+ }}fn is_window_valid_for_enumeration(hwnd: HWND, current_process_id: u32) -> bool {diff --git a/packages/ui-solid/src/auto-imports.d.ts b/packages/ui-solid/src/auto-imports.d.tsindex 2dad1b502..22674b3e1 100644--- a/packages/ui-solid/src/auto-imports.d.ts+++ b/packages/ui-solid/src/auto-imports.d.ts@@ -6,6 +6,7 @@// biome-ignore lint: disableexport {}declare global {+ const IconCapArrowLeft: typeof import('~icons/cap/arrow-left.jsx')['default']const IconCapArrows: typeof import('~icons/cap/arrows.jsx')['default']const IconCapAudioOn: typeof import('~icons/cap/audio-on.jsx')['default']const IconCapBgBlur: typeof import('~icons/cap/bg-blur.jsx')['default']diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 02c721ab6..79a8921fc 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -179,6 +179,9 @@ importers:solid-markdown:specifier: ^2.0.13version: 2.0.14([email protected])+ solid-motionone:+ specifier: ^1.0.4+ version: 1.0.4([email protected])solid-presence:specifier: ^0.1.8version: 0.1.8([email protected])@@ -689,7 +692,7 @@ importers:version: 15.5.4(@babel/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected])next-auth:specifier: ^4.24.5- version: 4.24.11([email protected](@opentelemetry/[email protected])([email protected]([email protected]))([email protected]))([email protected])([email protected]([email protected]))([email protected])+ version: 4.24.11([email protected](@babel/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected]))([email protected])([email protected]([email protected]))([email protected])next-contentlayer2:specifier: ^0.5.3version: 0.5.8([email protected])([email protected]([email protected])([email protected]))([email protected])([email protected](@babel/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected]))([email protected]([email protected]))([email protected])@@ -991,7 +994,7 @@ importers:version: 15.5.4(@babel/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected])next-auth:specifier: ^4.24.5- version: 4.24.11([email protected](@opentelemetry/[email protected])([email protected]([email protected]))([email protected]))([email protected])([email protected]([email protected]))([email protected])+ version: 4.24.11([email protected](@babel/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected]))([email protected])([email protected]([email protected]))([email protected])react-email:specifier: ^4.0.16version: 4.0.16(@opentelemetry/[email protected])([email protected]([email protected]))([email protected])@@ -3745,6 +3748,24 @@ packages:resolution: {integrity: sha512-oxzMzYCkZHMntzuyerehK3fV6A2Kwh5BD6CGEJSVDU2QNEhfLOptf2X7esQgaHZXHZY0oHmMsOtIDLP71UJXgA==}engines: {node: '>=18'}+ '@motionone/[email protected]':+ resolution: {integrity: sha512-9z2p5GFGCm0gBsZbi8rVMOAJCtw1WqBTIPw3ozk06gDvZInBPIsQcHgYogEJ4yuHJ+akuW8g1SEIOpTOvYs8hw==}++ '@motionone/[email protected]':+ resolution: {integrity: sha512-bKLP7E0eyO4B2UaHBBN55tnppwRnaE3KFfh3Ps9HhnAkar3Cb69kUCJY9as8LrccVYKgHA+JY5dOQqJLOPhF5A==}++ '@motionone/[email protected]':+ resolution: {integrity: sha512-VcjByo7XpdLS4o9T8t99JtgxkdMcNWD3yHU/n6CLEz3bkmKDRZyYQ/wmSf6daum8ZXqfUAgFeCZSpJZIMxaCzg==}++ '@motionone/[email protected]':+ resolution: {integrity: sha512-+qfkC2DtkDj4tHPu+AFKVfR/C30O1vYdvsGYaR13W/1cczPrrcjdvYCj0VLFuRMN+lP1xvpNZHCRNM4fBzn1jg==}++ '@motionone/[email protected]':+ resolution: {integrity: sha512-KaC4kgiODDz8hswCrS0btrVrzyU2CSQKO7Ps90ibBVSQmjkrt2teqta6/sOG59v7+dPnKMAg13jyqtMKV2yJ7A==}++ '@motionone/[email protected]':+ resolution: {integrity: sha512-3XVF7sgyTSI2KWvTf6uLlBJ5iAgRgmvp3bpuOiQJvInd4nZ19ET8lX5unn30SlmRH7hXbBbH+Gxd0m0klJ3Xtw==}+'@msgpackr-extract/[email protected]':resolution: {integrity: sha512-QZHtlVgbAdy2zAqNA9Gu1UpIuI8Xvsd1v8ic6B2pZmeFnFcMWiPLfWXh7TVw4eGEZ/C9TH281KwhVoeQUKbyjw==}cpu: [arm64]@@ -5971,10 +5992,10 @@ packages:react-dom:optional: true- '@storybook/[email protected]':- resolution: {integrity: sha512-Bo7HKAuwSVfz3VRmlAPRwT7us7LPeXj2aJ5Mh4qmTHYpctEXDJufoXAAtXV1oMS/I512k/S2XlX6djbNpoFSlw==}+ '@storybook/[email protected]':+ resolution: {integrity: sha512-KlIdcmvjbB9WgrjSml9vmCDKqnLu6s88K9V/BsTklfKr71Nh0LEiltpiIsVabXmk8FcxWsVbvecoui0NcawWtA==}peerDependencies:- storybook: ^10.0.0-beta.7+ storybook: ^10.0.0-beta.8vite: ^5.0.0 || ^6.0.0 || ^7.0.0'@storybook/[email protected]':@@ -5985,12 +6006,12 @@ packages:prettier:optional: true- '@storybook/[email protected]':- resolution: {integrity: sha512-1nkH+vriwFbwqeCItJE2mUfw3vYECgDrwBWlSpKenVrgTNjU6KnbHLrYlLUmSivabtXAhl/3NH3XlxNjaCpFfA==}+ '@storybook/[email protected]':+ resolution: {integrity: sha512-nwMQ51ZTI8bPy15iar49frYByW9Fwq+UM6RkF0ExoPaDqV32VPZW46ChhTGVaKH6mHmZR7sNAXdboxulXGTP0Q==}peerDependencies:esbuild: '*'rollup: '*'- storybook: ^10.0.0-beta.7+ storybook: ^10.0.0-beta.8vite: '*'webpack: '*'peerDependenciesMeta:@@ -9611,6 +9632,9 @@ packages:resolution: {integrity: sha512-ZRiwvN089JfMXokizgqEPXsl2Guk094yExfoDXR0cBYWxtBbaSww/w+vT4WEJsBW2iTUi1GgZ6swmoug3Oy4Xw==}engines: {node: '>=16.0.0'}+ resolution: {integrity: sha512-COpmrF2NOg4TBWUJ5UVyaCU2A88wEMkUPK4hNqyCkqHbxT92BbvfjoSozkAIIm6XhicGlJHhFdullInrdhwU8Q==}+resolution: {integrity: sha512-25A7+m6qqp6UVkuzUQ//VVh2EEOPYlOBg32ypr34bcPO7liBMOkKFvbjbCBfiPAOTA/7BSx1Dujft3Th57WyFg==}@@ -12553,6 +12577,11 @@ packages:peerDependencies:solid-js: ^1.6.0+ resolution: {integrity: sha512-aqEjgecoO9raDFznu/dEci7ORSmA26Kjj9J4Cn1Gyr0GZuOVdvsNxdxClTL9J40Aq/uYFx4GLwC8n70fMLHiuA==}+ peerDependencies:+ solid-js: ^1.8.0+resolution: {integrity: sha512-pWGtXUFWYYUZNbg5YpG5vkQJyOtzn2KXhxYaMx/4I+lylTLYkITOLevaCwMRN+liCVk0pqB6EayLWojNqBFECA==}peerDependencies:@@ -16897,6 +16926,41 @@ snapshots:transitivePeerDependencies:- supports-color+ '@motionone/[email protected]':+ dependencies:+ '@motionone/easing': 10.18.0+ '@motionone/types': 10.17.1+ '@motionone/utils': 10.18.0+ tslib: 2.8.1++ '@motionone/[email protected]':+ dependencies:+ '@motionone/animation': 10.18.0+ '@motionone/generators': 10.18.0+ '@motionone/types': 10.17.1+ '@motionone/utils': 10.18.0+ hey-listen: 1.0.8+ tslib: 2.8.1++ '@motionone/[email protected]':+ dependencies:+ '@motionone/utils': 10.18.0+ tslib: 2.8.1++ '@motionone/[email protected]':+ dependencies:+ '@motionone/types': 10.17.1+ '@motionone/utils': 10.18.0+ tslib: 2.8.1++ '@motionone/[email protected]': {}++ '@motionone/[email protected]':+ dependencies:+ '@motionone/types': 10.17.1+ hey-listen: 1.0.8+ tslib: 2.8.1+'@msgpackr-extract/[email protected]':optional: true@@ -19490,9 +19554,9 @@ snapshots:react: 19.1.1react-dom: 19.1.1([email protected])- '@storybook/[email protected]([email protected])([email protected])([email protected]([email protected]))([email protected](@types/[email protected])([email protected])([email protected])([email protected]))([email protected]([email protected]))':+ '@storybook/[email protected]([email protected])([email protected])([email protected]([email protected]))([email protected](@types/[email protected])([email protected])([email protected])([email protected]))([email protected]([email protected]))':dependencies:- '@storybook/csf-plugin': 10.0.0-beta.7([email protected])([email protected])([email protected]([email protected]))([email protected](@types/[email protected])([email protected])([email protected])([email protected]))([email protected]([email protected]))+ '@storybook/csf-plugin': 10.0.0-beta.8([email protected])([email protected])([email protected]([email protected]))([email protected](@types/[email protected])([email protected])([email protected])([email protected]))([email protected]([email protected]))storybook: 8.6.12([email protected])ts-dedent: 2.2.0@@ -19522,7 +19586,7 @@ snapshots:- supports-color- utf-8-validate- '@storybook/[email protected]([email protected])([email protected])([email protected]([email protected]))([email protected](@types/[email protected])([email protected])([email protected])([email protected]))([email protected]([email protected]))':+ '@storybook/[email protected]([email protected])([email protected])([email protected]([email protected]))([email protected](@types/[email protected])([email protected])([email protected])([email protected]))([email protected]([email protected]))':dependencies:storybook: 8.6.12([email protected])unplugin: 2.3.10@@ -22759,8 +22823,8 @@ snapshots:eslint: 9.30.1([email protected])eslint-import-resolver-node: 0.3.9- eslint-import-resolver-typescript: 3.10.1([email protected](@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))([email protected]([email protected])))([email protected]([email protected]))- eslint-plugin-import: 2.31.0(@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))([email protected]([email protected](@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))([email protected]([email protected])))([email protected]([email protected])))([email protected]([email protected]))+ eslint-import-resolver-typescript: 3.10.1([email protected])([email protected]([email protected]))+ eslint-plugin-import: 2.31.0(@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))([email protected])([email protected]([email protected]))eslint-plugin-jsx-a11y: 6.10.2([email protected]([email protected]))eslint-plugin-react: 7.37.5([email protected]([email protected]))eslint-plugin-react-hooks: 5.2.0([email protected]([email protected]))@@ -22788,33 +22852,33 @@ snapshots:transitivePeerDependencies:- supports-color- [email protected]([email protected](@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))([email protected]([email protected])))([email protected]([email protected])):dependencies:'@nolyfill/is-core-module': 1.0.39debug: 4.4.0([email protected])- eslint: 9.30.1([email protected])+ eslint: 8.57.1get-tsconfig: 4.10.0is-bun-module: 2.0.0stable-hash: 0.0.5tinyglobby: 0.2.13unrs-resolver: 1.7.2optionalDependencies:- eslint-plugin-import: 2.31.0(@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))([email protected]([email protected](@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))([email protected]([email protected])))([email protected]([email protected])))([email protected]([email protected]))+ eslint-plugin-import: 2.31.0(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected])transitivePeerDependencies:- supports-colordependencies:'@nolyfill/is-core-module': 1.0.39debug: 4.4.0([email protected])- eslint: 8.57.1+ eslint: 9.30.1([email protected])get-tsconfig: 4.10.0is-bun-module: 2.0.0stable-hash: 0.0.5tinyglobby: 0.2.13unrs-resolver: 1.7.2optionalDependencies:- eslint-plugin-import: 2.31.0(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected])+ eslint-plugin-import: 2.31.0(@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))([email protected])([email protected]([email protected]))transitivePeerDependencies:- supports-color@@ -22840,14 +22904,14 @@ snapshots:transitivePeerDependencies:- supports-color- [email protected](@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))([email protected])([email protected]([email protected](@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))([email protected]([email protected])))([email protected]([email protected])))([email protected]([email protected])):+ [email protected](@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))([email protected])([email protected])([email protected]([email protected])):dependencies:debug: 3.2.7optionalDependencies:eslint: 9.30.1([email protected])eslint-import-resolver-node: 0.3.9- eslint-import-resolver-typescript: 3.10.1([email protected](@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))([email protected]([email protected])))([email protected]([email protected]))+ eslint-import-resolver-typescript: 3.10.1([email protected])([email protected]([email protected]))transitivePeerDependencies:- supports-color@@ -22909,7 +22973,7 @@ snapshots:- eslint-import-resolver-webpack- supports-color- [email protected](@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))([email protected]([email protected](@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))([email protected]([email protected])))([email protected]([email protected])))([email protected]([email protected])):+ [email protected](@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))([email protected])([email protected]([email protected])):dependencies:'@rtsao/scc': 1.1.0array-includes: 3.1.8@@ -22920,7 +22984,7 @@ snapshots:doctrine: 2.1.0eslint: 9.30.1([email protected])eslint-import-resolver-node: 0.3.9- eslint-module-utils: 2.12.0(@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))([email protected])([email protected]([email protected](@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))([email protected]([email protected])))([email protected]([email protected])))([email protected]([email protected]))+ eslint-module-utils: 2.12.0(@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))([email protected])([email protected])([email protected]([email protected]))hasown: 2.0.2is-core-module: 2.16.1is-glob: 4.0.3@@ -24051,6 +24115,8 @@ snapshots:+ [email protected]: {}+dependencies:eventemitter3: 4.0.7@@ -25880,7 +25946,7 @@ snapshots:p-wait-for: 5.0.2qs: 6.14.0- [email protected]([email protected](@opentelemetry/[email protected])([email protected]([email protected]))([email protected]))([email protected])([email protected]([email protected]))([email protected]):+ [email protected]([email protected](@babel/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected]))([email protected])([email protected]([email protected]))([email protected]):dependencies:'@babel/runtime': 7.27.1'@panva/hkdf': 1.2.1@@ -27774,6 +27840,16 @@ snapshots:transitivePeerDependencies:- supports-color+ dependencies:+ '@motionone/dom': 10.18.0+ '@motionone/utils': 10.18.0+ '@solid-primitives/props': 3.2.1([email protected])+ '@solid-primitives/refs': 1.1.1([email protected])+ '@solid-primitives/transition-group': 1.1.1([email protected])+ csstype: 3.1.3+ solid-js: 1.9.6+dependencies:'@corvu/utils': 0.4.2([email protected])@@ -27926,7 +28002,7 @@ snapshots:[email protected](@storybook/[email protected]([email protected]([email protected])))([email protected])([email protected])([email protected])([email protected]([email protected]))([email protected](@testing-library/[email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])))([email protected](@types/[email protected])([email protected])([email protected])([email protected]))([email protected]([email protected])):dependencies:- '@storybook/builder-vite': 10.0.0-beta.7([email protected])([email protected])([email protected]([email protected]))([email protected](@types/[email protected])([email protected])([email protected])([email protected]))([email protected]([email protected]))+ '@storybook/builder-vite': 10.0.0-beta.8([email protected])([email protected])([email protected]([email protected]))([email protected](@types/[email protected])([email protected])([email protected])([email protected]))([email protected]([email protected]))'@storybook/types': 9.0.0-alpha.1([email protected]([email protected]))magic-string: 0.30.17solid-js: 1.9.6