diff --git a/docs/implementation-status.md b/docs/implementation-status.md index 8aa1679..70183e4 100644 --- a/docs/implementation-status.md +++ b/docs/implementation-status.md @@ -40,26 +40,28 @@ - Screenshot capture is implemented: F9 takes a PNG screenshot via bundled FFmpeg into `~/Pictures/ClipForge`, the recording bar has a Screenshot button, and the Library shows recent screenshots with an Open-in-Explorer action. - Storage guardrails are wired: recording refuses to start below 2 GB free and a backend worker stops an active recording and flags `StorageLow` when available disk drops to critical; the recording bar shows free disk space and a low-disk warning. - Panic reporting writes crash reports with stack traces to the logs folder (`library/logs`), prunes old entries, and the Settings screen can open the logs folder. +- Native Windows Graphics Capture now downscales the captured window/monitor to the configured resolution cap (e.g. 720p) with even dimensions while preserving aspect ratio; covered by unit tests. +- Capture quality and storage settings are exposed: the Settings screen can change resolution, FPS, bitrate, buffer storage cap, excluded window titles, and the separate-audio-tracks toggle via the `set_capture_settings` command, and current values are shown in DesktopStatus. +- The configured storage cap is enforced by a backend worker that prunes the oldest rolling buffer segments once the buffer exceeds `storage_limit_gb`. +- SQLite schema uses versioned migrations tracked via `PRAGMA user_version`; legacy databases (missing tables or the `title` column) are repaired and upgraded in place, with migration tests. - Vite TypeScript UI builds and has interactive Library, Recording, Auto Clip, Uploads, and Settings views. - Library search, event/upload filters, and grid/list switching are functional in the UI. - User-visible notices are shown for major actions and failures instead of relying only on console output. ## Not Fully Working Yet -- Native Windows Graphics Capture is wired for rolling replay capture with native audio; resolution downscaling still needs more work. -- Native WASAPI audio is mixed into a single AAC track for MVP clips; separate audio tracks and per-process audio capture are still future work. -- Capture has not yet been manually QA-tested on real NVIDIA/AMD/Intel gaming systems. +- Native Windows Graphics Capture and FFmpeg capture finalization have not yet been manually QA-tested on real NVIDIA/AMD/Intel gaming systems. +- Native WASAPI audio is mixed into a single AAC track for MVP clips; separate audio tracks and per-process audio capture are still future work (the separate-audio-tracks setting is stored but not yet honored by the encoder). - Valve GSI receiver is a lightweight MVP receiver; config templates can be generated from the Auto Clip screen, but richer event mapping per game is still needed. - Auto start/stop is conservative but live: when auto-record is enabled, supported detected games can start recording and stop when the game disappears. -- Hotkeys are still hardcoded; editable hotkey registration is future work. -- Capture source, quality, storage cap, excluded windows, and per-game override UI are still incomplete. +- Per-game capture quality overrides are still incomplete. - Recorder service still runs inside the Tauri process instead of a separate background service process. - Installer onboarding and auto-update are still not implemented. ## Next Engineering Steps -1. Extend native Windows Graphics Capture with resolution downscaling and richer capture-source selection. -2. Add separate audio tracks and optional per-process loopback capture. -3. Expand CS2/Dota GSI event mapping beyond the current MVP event parser. +1. Honor the separate-audio-tracks setting by encoding system and mic audio to distinct tracks, and consider per-process loopback capture. +2. Expand CS2/Dota GSI event mapping beyond the current MVP event parser. +3. Add per-game capture quality overrides. 4. Add installer/onboarding screens for privacy, capture source, storage, and hotkeys. 5. Run manual QA on Windows gaming hardware and tune CPU/GPU overhead. diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index dcbb3b9..28eb5f3 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -122,6 +122,12 @@ struct DesktopStatus { hotkey_toggle_session_recording: String, hotkey_screenshot: String, free_disk_gb: f64, + capture_fps: u32, + capture_bitrate_kbps: u32, + capture_resolution: String, + storage_limit_gb: u64, + excluded_window_titles: Vec, + separate_audio_tracks: bool, } #[derive(Debug, Serialize)] @@ -382,6 +388,37 @@ fn set_auto_clip_event_enabled( Ok(status_from_recorder(&recorder, capture.as_ref())) } +#[tauri::command] +fn set_capture_settings( + width: u32, + height: u32, + fps: u32, + bitrate_kbps: u32, + storage_limit_gb: u64, + excluded_window_titles: Vec, + separate_audio_tracks: bool, + runtime: State<'_, AppRuntime>, +) -> Result { + let mut recorder = runtime.recorder.lock().map_err(|error| error.to_string())?; + let capture = runtime.capture.lock().map_err(|error| error.to_string())?; + recorder.settings.quality.width = even_between(width, 640, 7680); + recorder.settings.quality.height = even_between(height, 360, 4320); + recorder.settings.quality.fps = fps.clamp(15, 240); + recorder.settings.quality.bitrate_kbps = bitrate_kbps.clamp(500, 50_000); + recorder.settings.storage_limit_gb = storage_limit_gb.clamp(5, 5000); + recorder.settings.privacy.excluded_window_titles = + excluded_window_titles.iter().map(|title| title.trim().to_string()).filter(|title| !title.is_empty()).collect(); + recorder.settings.privacy.separate_audio_tracks = separate_audio_tracks; + save_settings(&runtime.library_root, &recorder.settings) + .map_err(|error| format!("Could not save capture settings: {error}"))?; + Ok(status_from_recorder(&recorder, capture.as_ref())) +} + +fn even_between(value: u32, min: u32, max: u32) -> u32 { + let value = value.clamp(min, max); + value - (value % 2) +} + #[tauri::command] fn write_gsi_configs(runtime: State<'_, AppRuntime>) -> Result, String> { write_gsi_config_templates(&runtime.library_root) @@ -1455,6 +1492,7 @@ fn main() { set_auto_record_enabled, set_upload_settings, set_auto_clip_event_enabled, + set_capture_settings, write_gsi_configs, poll_auto_clip_events, save_manual_clip, @@ -1620,6 +1658,7 @@ fn start_backend_workers(app: tauri::AppHandle) { let _ = refresh_detected_game_inner(runtime.inner()); let _ = poll_auto_clip_events_inner(runtime.inner()); let _ = stop_capture_on_critical_storage(runtime.inner()); + let _ = enforce_storage_cap(runtime.inner()); thread::sleep(Duration::from_secs(2)); }) .expect("could not start ClipForge backend workers"); @@ -1651,6 +1690,28 @@ fn stop_capture_on_critical_storage(runtime: &AppRuntime) -> Result<(), String> Ok(()) } +fn enforce_storage_cap(runtime: &AppRuntime) -> Result<(), String> { + let (buffer_root, limit_gb) = { + let recorder = runtime.recorder.lock().map_err(|error| error.to_string())?; + (recorder.paths.buffer_root.clone(), recorder.settings.storage_limit_gb) + }; + if limit_gb == 0 { + return Ok(()); + } + let max_bytes = limit_gb.saturating_mul(1024 * 1024 * 1024); + let report = + clipforge::storage::cleanup_oldest_files_until_under_limit(&buffer_root, max_bytes) + .map_err(|error| format!("Could not enforce storage cap: {error}"))?; + if report.deleted_files > 0 { + eprintln!( + "ClipForge storage cap: removed {} file(s) ({} MB) from the buffer.", + report.deleted_files, + report.deleted_bytes / (1024 * 1024) + ); + } + Ok(()) +} + fn status_from_recorder(recorder: &RecorderService, capture: Option<&ActiveCapture>) -> DesktopStatus { DesktopStatus { recording_state: recording_status_name(&recorder.state.status).to_string(), @@ -1694,6 +1755,15 @@ fn status_from_recorder(recorder: &RecorderService, capture: Option<&ActiveCaptu hotkey_toggle_session_recording: recorder.settings.hotkeys.toggle_session_recording.clone(), hotkey_screenshot: recorder.settings.hotkeys.screenshot.clone(), free_disk_gb: clipforge::storage::check_storage_space(&recorder.paths.buffer_root).free_gb(), + capture_fps: recorder.settings.quality.fps, + capture_bitrate_kbps: recorder.settings.quality.bitrate_kbps, + capture_resolution: format!( + "{}x{}", + recorder.settings.quality.width, recorder.settings.quality.height + ), + storage_limit_gb: recorder.settings.storage_limit_gb, + excluded_window_titles: recorder.settings.privacy.excluded_window_titles.clone(), + separate_audio_tracks: recorder.settings.privacy.separate_audio_tracks, } } diff --git a/src/database.rs b/src/database.rs index a334d89..9584c3f 100644 --- a/src/database.rs +++ b/src/database.rs @@ -3,6 +3,44 @@ use rusqlite::{params, Connection}; use std::path::{Path, PathBuf}; use std::time::{Duration, SystemTime, UNIX_EPOCH}; +const CURRENT_SCHEMA_VERSION: u32 = MIGRATIONS.len() as u32; + +const MIGRATIONS: &[&str] = &[ + // v1: initial clips table (also used to repair databases predating versioned migrations). + " + CREATE TABLE IF NOT EXISTS clips ( + id TEXT PRIMARY KEY NOT NULL, + title TEXT, + session_id TEXT NOT NULL, + game_id TEXT NOT NULL, + path TEXT NOT NULL, + thumbnail_path TEXT, + created_at_ms INTEGER NOT NULL, + duration_ms INTEGER NOT NULL, + source TEXT NOT NULL, + event_type TEXT, + tags_json TEXT NOT NULL, + upload_url TEXT, + upload_provider TEXT + ); + CREATE INDEX IF NOT EXISTS clips_created_at_idx ON clips(created_at_ms DESC); + CREATE INDEX IF NOT EXISTS clips_game_id_idx ON clips(game_id); + ", + // v2: upload history bookkeeping. + " + CREATE TABLE IF NOT EXISTS upload_history ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + clip_id TEXT NOT NULL, + provider TEXT NOT NULL, + status TEXT NOT NULL, + url TEXT, + error TEXT, + attempted_at_ms INTEGER NOT NULL + ); + CREATE INDEX IF NOT EXISTS upload_history_clip_id_idx ON upload_history(clip_id); + ", +]; + #[derive(Debug)] pub struct ClipDatabase { connection: Connection, @@ -22,42 +60,32 @@ impl ClipDatabase { } pub fn init(&self) -> rusqlite::Result<()> { - self.connection.execute_batch( - " - CREATE TABLE IF NOT EXISTS clips ( - id TEXT PRIMARY KEY NOT NULL, - title TEXT, - session_id TEXT NOT NULL, - game_id TEXT NOT NULL, - path TEXT NOT NULL, - thumbnail_path TEXT, - created_at_ms INTEGER NOT NULL, - duration_ms INTEGER NOT NULL, - source TEXT NOT NULL, - event_type TEXT, - tags_json TEXT NOT NULL, - upload_url TEXT, - upload_provider TEXT - ); - CREATE INDEX IF NOT EXISTS clips_created_at_idx ON clips(created_at_ms DESC); - CREATE INDEX IF NOT EXISTS clips_game_id_idx ON clips(game_id); - CREATE TABLE IF NOT EXISTS upload_history ( - id INTEGER PRIMARY KEY AUTOINCREMENT, - clip_id TEXT NOT NULL, - provider TEXT NOT NULL, - status TEXT NOT NULL, - url TEXT, - error TEXT, - attempted_at_ms INTEGER NOT NULL - ); - CREATE INDEX IF NOT EXISTS upload_history_clip_id_idx ON upload_history(clip_id); - ", - )?; + self.migrate()?; if !self.column_exists("clips", "title")? { self.connection .execute("ALTER TABLE clips ADD COLUMN title TEXT", [])?; } - self.connection.pragma_update(None, "user_version", 2) + if self.user_version()? != CURRENT_SCHEMA_VERSION { + self.connection + .pragma_update(None, "user_version", CURRENT_SCHEMA_VERSION)?; + } + Ok(()) + } + + fn migrate(&self) -> rusqlite::Result<()> { + let mut version = self.user_version()?; + while (version as usize) < MIGRATIONS.len() { + self.connection.execute_batch(MIGRATIONS[version as usize])?; + version += 1; + self.connection + .pragma_update(None, "user_version", version)?; + } + Ok(()) + } + + fn user_version(&self) -> rusqlite::Result { + self.connection + .query_row("PRAGMA user_version", [], |row| row.get(0)) } pub fn load_clips(&self) -> rusqlite::Result> { @@ -281,12 +309,89 @@ fn millis_to_system_time(millis: i64) -> SystemTime { mod tests { use super::*; - #[test] - fn round_trips_clip_records() { - let db_path = std::env::temp_dir().join(format!( - "clipforge-db-{}.sqlite", + fn temp_database_path(name: &str) -> PathBuf { + let path = std::env::temp_dir().join(format!( + "clipforge-db-{name}-{}.sqlite", system_time_to_millis(SystemTime::now()) )); + let _ = std::fs::remove_file(&path); + path + } + + #[test] + fn fresh_database_walks_to_current_version() { + let db_path = temp_database_path("fresh"); + let database = ClipDatabase::open(&db_path).expect("database"); + assert_eq!(database.user_version().expect("version"), CURRENT_SCHEMA_VERSION); + database.connection.execute("SELECT 1 FROM upload_history", []).expect("v2 table exists"); + let _ = std::fs::remove_file(db_path); + } + + #[test] + fn opening_is_idempotent_and_does_not_downgrade() { + let db_path = temp_database_path("idempotent"); + let first = ClipDatabase::open(&db_path).expect("database"); + let second = ClipDatabase::open(&db_path).expect("database re-open"); + assert_eq!( + first.user_version().expect("version"), + CURRENT_SCHEMA_VERSION + ); + assert_eq!( + second.user_version().expect("version"), + CURRENT_SCHEMA_VERSION + ); + let _ = std::fs::remove_file(db_path); + } + + #[test] + fn legacy_database_is_repaired_and_upgraded() { + let db_path = temp_database_path("legacy"); + { + let connection = Connection::open(&db_path).expect("raw connection"); + connection + .execute_batch( + " + CREATE TABLE clips ( + id TEXT PRIMARY KEY NOT NULL, + session_id TEXT NOT NULL, + game_id TEXT NOT NULL, + path TEXT NOT NULL, + thumbnail_path TEXT, + created_at_ms INTEGER NOT NULL, + duration_ms INTEGER NOT NULL, + source TEXT NOT NULL, + event_type TEXT, + tags_json TEXT NOT NULL, + upload_url TEXT, + upload_provider TEXT + ); + ", + ) + .expect("legacy clips table"); + connection + .pragma_update(None, "user_version", 0) + .expect("version 0"); + } + let database = ClipDatabase::open(&db_path).expect("open with repair"); + assert_eq!(database.user_version().expect("version"), CURRENT_SCHEMA_VERSION); + assert!(database.column_exists("clips", "title").expect("column lookup")); + assert!(database.column_exists("clips", "id").expect("column lookup")); + database + .insert_upload_history( + "clip-old", + "catbox", + "uploaded", + Some("https://example.test/old.mp4"), + None, + SystemTime::now(), + ) + .expect("v2 table usable"); + let _ = std::fs::remove_file(db_path); + } + + #[test] + fn round_trips_clip_records() { + let db_path = temp_database_path("roundtrip"); let database = ClipDatabase::open(&db_path).expect("database"); let clip = Clip { id: "clip-1".to_string(), diff --git a/src/native_wgc.rs b/src/native_wgc.rs index ece47e5..e98998e 100644 --- a/src/native_wgc.rs +++ b/src/native_wgc.rs @@ -1,6 +1,33 @@ use crate::capture::{CaptureBackend, CaptureConfig, CaptureError}; use std::path::PathBuf; +pub(crate) fn downscale_to_cap( + width: u32, + height: u32, + cap_width: u32, + cap_height: u32, +) -> (u32, u32) { + if width == 0 || height == 0 || cap_width == 0 || cap_height == 0 { + return (even_capped_dimension(width, cap_width), even_capped_dimension(height, cap_height)); + } + let scale = (cap_width as f32 / width as f32).min(cap_height as f32 / height as f32); + if scale >= 1.0 { + return ( + even_capped_dimension(width, cap_width), + even_capped_dimension(height, cap_height), + ); + } + ( + even_capped_dimension((width as f32 * scale).round() as u32, cap_width), + even_capped_dimension((height as f32 * scale).round() as u32, cap_height), + ) +} + +fn even_capped_dimension(value: u32, cap: u32) -> u32 { + let value = value.min(cap).max(2); + value - (value % 2) +} + #[cfg(target_os = "windows")] mod windows_impl { use super::*; @@ -488,10 +515,6 @@ mod windows_impl { } } - fn even_dimension(value: u32) -> u32 { - value.saturating_sub(value % 2).max(2) - } - fn find_window_for_source( source: &crate::capture::CaptureSource, ) -> Result, HandlerError> { @@ -526,25 +549,24 @@ mod windows_impl { Ok(None) } - fn window_size(window: Window, fallback_width: u32, fallback_height: u32) -> (u32, u32) { + fn window_size(window: Window, cap_width: u32, cap_height: u32) -> (u32, u32) { let width = window .width() .ok() .and_then(|value| u32::try_from(value.max(0)).ok()) - .unwrap_or(fallback_width); + .unwrap_or(cap_width); let height = window .height() .ok() .and_then(|value| u32::try_from(value.max(0)).ok()) - .unwrap_or(fallback_height); - (even_dimension(width), even_dimension(height)) + .unwrap_or(cap_height); + downscale_to_cap(width, height, cap_width, cap_height) } - fn monitor_size(monitor: Monitor, fallback_width: u32, fallback_height: u32) -> (u32, u32) { - ( - even_dimension(monitor.width().unwrap_or(fallback_width)), - even_dimension(monitor.height().unwrap_or(fallback_height)), - ) + fn monitor_size(monitor: Monitor, cap_width: u32, cap_height: u32) -> (u32, u32) { + let width = monitor.width().unwrap_or(cap_width); + let height = monitor.height().unwrap_or(cap_height); + downscale_to_cap(width, height, cap_width, cap_height) } fn recording_settings + Send + 'static>( @@ -669,6 +691,34 @@ impl CaptureBackend for NativeWgcReplayCaptureBackend { } } +#[cfg(test)] +mod downscale_tests { + use super::downscale_to_cap; + + #[test] + fn keeps_resolution_at_or_below_the_cap() { + assert_eq!(downscale_to_cap(2560, 1440, 1280, 720), (1280, 720)); + assert_eq!(downscale_to_cap(1920, 1080, 1280, 720), (1280, 720)); + assert_eq!(downscale_to_cap(3840, 2160, 1920, 1080), (1920, 1080)); + } + + #[test] + fn leaves_smaller_sources_unchanged() { + assert_eq!(downscale_to_cap(800, 600, 1280, 720), (800, 600)); + assert_eq!(downscale_to_cap(1280, 720, 1280, 720), (1280, 720)); + } + + #[test] + fn preserves_aspect_ratio_and_even_dimensions_when_downscaling() { + let (width, height) = downscale_to_cap(2000, 1000, 1000, 600); + assert_eq!(width % 2, 0); + assert_eq!(height % 2, 0); + assert!(width <= 1000); + assert!(height <= 600); + assert_eq!(width as f32 / height as f32, 2000.0 / 1000.0); + } +} + #[cfg(all(test, target_os = "windows"))] mod tests { use super::*; diff --git a/ui/src/main.ts b/ui/src/main.ts index 0509c18..a3bef16 100644 --- a/ui/src/main.ts +++ b/ui/src/main.ts @@ -75,6 +75,12 @@ type DesktopStatus = { hotkey_toggle_session_recording: string; hotkey_screenshot: string; free_disk_gb: number; + capture_fps: number; + capture_bitrate_kbps: number; + capture_resolution: string; + storage_limit_gb: number; + excluded_window_titles: string[]; + separate_audio_tracks: boolean; }; type ClipDto = { @@ -152,6 +158,13 @@ type AppState = { hotkeyToggleRecording: string; hotkeyScreenshot: string; freeDiskGb: number; + captureFps: number; + captureBitrateKbps: number; + captureResolution: string; + storageLimitGb: number; + excludedWindowTitles: string[]; + excludedWindowText: string; + separateAudioTracks: boolean; }; type TauriGlobal = { @@ -228,6 +241,13 @@ const state: AppState = { hotkeyToggleRecording: "Alt+F7", hotkeyScreenshot: "F9", freeDiskGb: 0, + captureFps: 30, + captureBitrateKbps: 6000, + captureResolution: "1280x720", + storageLimitGb: 50, + excludedWindowTitles: [], + excludedWindowText: "", + separateAudioTracks: false, }; const root = document.querySelector("#app"); @@ -627,6 +647,14 @@ function renderUploadHistoryRow(entry: UploadHistoryEntry) { } function renderSettingsView() { + const resolutionPresets = ["1280x720", "1920x1080", "2560x1440", "3840x2160"]; + const resolutionOptions = resolutionPresets.includes(state.captureResolution) + ? resolutionPresets + : [state.captureResolution, ...resolutionPresets]; + const fpsPresets = [30, 60, 120, 144]; + const fpsOptions = fpsPresets.includes(state.captureFps) + ? fpsPresets + : [state.captureFps, ...fpsPresets]; return `
@@ -635,10 +663,34 @@ function renderSettingsView() {
+
+

Capture

+

Quality & rights

+

Current: ${escapeHtml(state.captureResolution)} @ ${state.captureFps} fps (${state.captureBitrateKbps.toLocaleString()} kbps). New settings apply the next time capture starts.

+
+ + +
+ + + + + +

Storage

-

50 GB cap

-

Old temporary buffer segments are removed automatically; saved clips are kept.

+

${state.storageLimitGb} GB buffer cap

+

Old temporary buffer segments are removed automatically once the buffer reaches the cap; saved clips are kept.

Support

@@ -836,6 +888,34 @@ function bindEvents() { void saveHotkeys(); }); + appRoot.querySelector("[data-action='capture-resolution']")?.addEventListener("change", (event) => { + state.captureResolution = (event.target as HTMLSelectElement).value; + }); + + appRoot.querySelector("[data-action='capture-fps']")?.addEventListener("change", (event) => { + state.captureFps = Number((event.target as HTMLSelectElement).value); + }); + + appRoot.querySelector("[data-action='capture-bitrate']")?.addEventListener("input", (event) => { + state.captureBitrateKbps = Number((event.target as HTMLInputElement).value); + }); + + appRoot.querySelector("[data-action='capture-storage-gb']")?.addEventListener("input", (event) => { + state.storageLimitGb = Number((event.target as HTMLInputElement).value); + }); + + appRoot.querySelector("[data-action='excluded-windows']")?.addEventListener("input", (event) => { + state.excludedWindowText = (event.target as HTMLTextAreaElement).value; + }); + + appRoot.querySelector("[data-action='toggle-separate-audio']")?.addEventListener("change", (event) => { + state.separateAudioTracks = (event.target as HTMLInputElement).checked; + }); + + appRoot.querySelector("[data-action='save-capture-settings']")?.addEventListener("click", () => { + void saveCaptureSettings(); + }); + appRoot.querySelector("[data-action='reveal-crash-logs']")?.addEventListener("click", () => { void revealCrashLogs(); }); @@ -1118,6 +1198,13 @@ function applyDesktopStatus(status: DesktopStatus) { state.hotkeyToggleRecording = status.hotkey_toggle_session_recording; state.hotkeyScreenshot = status.hotkey_screenshot; state.freeDiskGb = status.free_disk_gb; + state.captureFps = status.capture_fps; + state.captureBitrateKbps = status.capture_bitrate_kbps; + state.captureResolution = status.capture_resolution; + state.storageLimitGb = status.storage_limit_gb; + state.excludedWindowTitles = status.excluded_window_titles ?? []; + state.excludedWindowText = (status.excluded_window_titles ?? []).join(", "); + state.separateAudioTracks = status.separate_audio_tracks ?? false; } async function trimSelectedClip() { @@ -1479,6 +1566,44 @@ async function saveHotkeys() { } } +async function saveCaptureSettings() { + if (!tauriInvoke) { + return; + } + + const [width, height] = parseResolution(state.captureResolution); + const excludedWindowTitles = state.excludedWindowText + .split(",") + .map((title) => title.trim()) + .filter((title) => title.length > 0); + + try { + const status = await tauriInvoke("set_capture_settings", { + width, + height, + fps: state.captureFps, + bitrateKbps: state.captureBitrateKbps, + storageLimitGb: state.storageLimitGb, + excludedWindowTitles, + separateAudioTracks: state.separateAudioTracks, + }); + applyDesktopStatus(status); + showNotice("Capture settings saved. They will apply the next time capture starts."); + render(); + } catch (error) { + console.warn("Could not save capture settings", error); + showNotice(`Could not save capture settings: ${String(error)}`); + } +} + +function parseResolution(value: string): [number, number] { + const [width, height] = value.split("x").map((part) => Number(part)); + return [ + Number.isFinite(width) ? width : 1280, + Number.isFinite(height) ? height : 720, + ]; +} + async function takeScreenshot() { if (!tauriInvoke) { return; diff --git a/ui/styles.css b/ui/styles.css index 0dc69d7..fbb1046 100644 --- a/ui/styles.css +++ b/ui/styles.css @@ -432,6 +432,19 @@ textarea { color: #f5f7fb; } +.field-row { + display: flex; + gap: 12px; + margin-top: 12px; +} + +.field-row label { + flex: 1; + display: flex; + flex-direction: column; + gap: 6px; +} + .toggle { display: flex; align-items: center;