Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
777d54ba5b |
No files matched your search
@@ -54,6 +54,9 @@
|
||||
- The default clip library root is `~/Documents/ClipForge` (rather than the process working directory), and a first-run migration moves any legacy `clipforge-library` folder found in the CWD into the new location while rewriting stored clip paths in the SQLite database.
|
||||
- Capture capabilities (bundled FFmpeg discovery, WASAPI/ddagrab support) are detected once at startup and cached, so background workers (`refresh_detected_game` every 2s, UI status poll every 3s) never spawn FFmpeg; all FFmpeg/console subprocesses are launched with a hidden console window on Windows, preventing the app from freezing and flashing a terminal repeatedly.
|
||||
- Vite TypeScript UI builds and has interactive Library, Recording, Auto Clip, Uploads, and Settings views.
|
||||
- Tauri's asset protocol is enabled and scoped to `$DOCUMENT/ClipForge/**` and `$PICTURE/ClipForge/**`, so `convertFileSrc` URLs load for clip thumbnails, video previews, and screenshot images (previously returned blocked asset responses).
|
||||
- Screenshot thumbnails use `object-fit: contain` so the full screenshot is shown without cropping.
|
||||
- An opt-in "Minimize to tray" setting keeps ClipForge running in the system tray when the main window is closed; closing the window hides it, and the tray menu offers "Open ClipForge" to restore it or "Quit ClipForge" to exit fully. The toggle is under Settings > Tray and defaults to off.
|
||||
- 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.
|
||||
|
||||
|
||||
Generated
+7
@@ -1463,6 +1463,12 @@ dependencies = [
|
||||
"pin-project-lite",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "http-range"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "21dec9db110f5f872ed9699c3ecf50cf16f423502706ba5c72462e28d3157573"
|
||||
|
||||
[[package]]
|
||||
name = "httparse"
|
||||
version = "1.10.1"
|
||||
@@ -3591,6 +3597,7 @@ dependencies = [
|
||||
"gtk",
|
||||
"heck 0.5.0",
|
||||
"http",
|
||||
"http-range",
|
||||
"jni",
|
||||
"libc",
|
||||
"log",
|
||||
|
||||
@@ -11,7 +11,7 @@ tauri-build = { version = "2.5.3", features = [] }
|
||||
[dependencies]
|
||||
clipforge = { path = ".." }
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
tauri = { version = "2.9.5", features = [] }
|
||||
tauri = { version = "2.9.5", features = ["protocol-asset", "tray-icon"] }
|
||||
tauri-plugin-global-shortcut = "2"
|
||||
|
||||
[profile.release]
|
||||
|
||||
+64
-1
@@ -39,9 +39,12 @@ use std::io::{Read, Write};
|
||||
use std::net::TcpListener;
|
||||
use std::path::PathBuf;
|
||||
use std::process::Command;
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
use std::sync::{Mutex, OnceLock};
|
||||
use std::thread;
|
||||
use std::time::{Duration, SystemTime, UNIX_EPOCH};
|
||||
use tauri::menu::{Menu, MenuItem};
|
||||
use tauri::tray::TrayIconBuilder;
|
||||
use tauri::{Manager, State};
|
||||
|
||||
struct AppRuntime {
|
||||
@@ -54,6 +57,7 @@ struct AppRuntime {
|
||||
hotkey_shortcuts: Mutex<Option<HotkeyShortcuts>>,
|
||||
app_handle: Mutex<Option<tauri::AppHandle>>,
|
||||
capture_capabilities: OnceLock<CaptureCapabilities>,
|
||||
quitting: AtomicBool,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
@@ -167,6 +171,7 @@ struct DesktopStatus {
|
||||
effective_quality_applied: bool,
|
||||
app_version: String,
|
||||
onboarding_complete: bool,
|
||||
minimize_to_tray: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
@@ -379,6 +384,19 @@ fn set_auto_record_enabled(
|
||||
Ok(status_from_recorder(&recorder, capture.as_ref(), &runtime.capture_capabilities))
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
fn set_minimize_to_tray_enabled(
|
||||
enabled: bool,
|
||||
runtime: State<'_, AppRuntime>,
|
||||
) -> Result<DesktopStatus, String> {
|
||||
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.minimize_to_tray_enabled = enabled;
|
||||
save_settings(&runtime.library_root, &recorder.settings)
|
||||
.map_err(|error| format!("Could not save settings: {error}"))?;
|
||||
Ok(status_from_recorder(&recorder, capture.as_ref(), &runtime.capture_capabilities))
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
fn set_upload_settings(
|
||||
auto_upload_enabled: bool,
|
||||
@@ -1609,8 +1627,24 @@ fn main() {
|
||||
hotkey_shortcuts: Mutex::new(None),
|
||||
app_handle: Mutex::new(None),
|
||||
capture_capabilities: OnceLock::new(),
|
||||
quitting: AtomicBool::new(false),
|
||||
})
|
||||
.setup(|app| {
|
||||
.on_window_event(|window, event| {
|
||||
if let tauri::WindowEvent::CloseRequested { api, .. } = event {
|
||||
let app = window.app_handle();
|
||||
let runtime = app.state::<AppRuntime>();
|
||||
let minimize_to_tray = runtime
|
||||
.recorder
|
||||
.lock()
|
||||
.map(|recorder| recorder.settings.minimize_to_tray_enabled)
|
||||
.unwrap_or(false);
|
||||
if minimize_to_tray && !runtime.quitting.load(Ordering::SeqCst) {
|
||||
api.prevent_close();
|
||||
let _ = window.hide();
|
||||
}
|
||||
}
|
||||
})
|
||||
.setup(|app| {
|
||||
let handle = app.handle().clone();
|
||||
|
||||
// Store app handle for hotkey re-registration
|
||||
@@ -1625,6 +1659,33 @@ fn main() {
|
||||
*guard = Some(handle.clone());
|
||||
});
|
||||
}
|
||||
|
||||
if let Some(icon) = app.default_window_icon().cloned() {
|
||||
let show_item = MenuItem::with_id(app, "show", "Open ClipForge", true, None::<&str>)?;
|
||||
let quit_item = MenuItem::with_id(app, "quit", "Quit ClipForge", true, None::<&str>)?;
|
||||
let menu = Menu::with_items(app, &[&show_item, &quit_item])?;
|
||||
TrayIconBuilder::new()
|
||||
.icon(icon)
|
||||
.tooltip("ClipForge")
|
||||
.menu(&menu)
|
||||
.show_menu_on_left_click(false)
|
||||
.on_menu_event(|app, event| match event.id.as_ref() {
|
||||
"show" => {
|
||||
if let Some(window) = app.get_webview_window("main") {
|
||||
let _ = window.unminimize();
|
||||
let _ = window.show();
|
||||
let _ = window.set_focus();
|
||||
}
|
||||
}
|
||||
"quit" => {
|
||||
let runtime = app.state::<AppRuntime>();
|
||||
runtime.quitting.store(true, Ordering::SeqCst);
|
||||
app.exit(0);
|
||||
}
|
||||
_ => {}
|
||||
})
|
||||
.build(app)?;
|
||||
}
|
||||
|
||||
start_valve_gsi_receiver(handle.clone());
|
||||
start_backend_workers(handle.clone());
|
||||
@@ -1648,6 +1709,7 @@ fn main() {
|
||||
list_audio_devices,
|
||||
set_mic_device,
|
||||
set_auto_record_enabled,
|
||||
set_minimize_to_tray_enabled,
|
||||
set_upload_settings,
|
||||
set_auto_clip_event_enabled,
|
||||
set_capture_settings,
|
||||
@@ -1963,6 +2025,7 @@ fn status_from_recorder(
|
||||
effective_quality_applied: game_override_is_active(&recorder.settings, &game_id),
|
||||
app_version: env!("CARGO_PKG_VERSION").to_string(),
|
||||
onboarding_complete: recorder.settings.onboarding_complete,
|
||||
minimize_to_tray: recorder.settings.minimize_to_tray_enabled,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,15 @@
|
||||
],
|
||||
"withGlobalTauri": true,
|
||||
"security": {
|
||||
"csp": null
|
||||
"csp": null,
|
||||
"assetProtocol": {
|
||||
"enable": true,
|
||||
"scope": [
|
||||
"$DOCUMENT/ClipForge/**",
|
||||
"$PICTURE/ClipForge/**",
|
||||
"$HOME/.clipforge/**"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"bundle": {
|
||||
|
||||
@@ -93,6 +93,8 @@ pub struct AppSettings {
|
||||
pub quality_overrides_by_game: BTreeMap<String, QualityPreset>,
|
||||
#[serde(default)]
|
||||
pub onboarding_complete: bool,
|
||||
#[serde(default)]
|
||||
pub minimize_to_tray_enabled: bool,
|
||||
}
|
||||
|
||||
impl AppSettings {
|
||||
@@ -140,6 +142,7 @@ impl AppSettings {
|
||||
upload: UploadSettings::default(),
|
||||
quality_overrides_by_game: BTreeMap::new(),
|
||||
onboarding_complete: false,
|
||||
minimize_to_tray_enabled: false,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -85,6 +85,7 @@ type DesktopStatus = {
|
||||
effective_quality_applied: boolean;
|
||||
app_version: string;
|
||||
onboarding_complete: boolean;
|
||||
minimize_to_tray: boolean;
|
||||
};
|
||||
|
||||
type ClipDto = {
|
||||
@@ -190,6 +191,7 @@ type AppState = {
|
||||
separateAudioTracks: boolean;
|
||||
appVersion: string;
|
||||
onboardingComplete: boolean;
|
||||
minimizeToTray: boolean;
|
||||
onboardingStep: number;
|
||||
gameQualityOverrides: GameQualityOverrideDto[];
|
||||
effectiveQualityApplied: boolean;
|
||||
@@ -279,6 +281,7 @@ const state: AppState = {
|
||||
separateAudioTracks: false,
|
||||
appVersion: "0.1.0",
|
||||
onboardingComplete: true,
|
||||
minimizeToTray: false,
|
||||
onboardingStep: 0,
|
||||
gameQualityOverrides: [],
|
||||
effectiveQualityApplied: false,
|
||||
@@ -868,6 +871,12 @@ function renderSettingsView() {
|
||||
<h2>${state.storageLimitGb} GB buffer cap</h2>
|
||||
<p class="muted">Old temporary buffer segments are removed automatically once the buffer reaches the cap; saved clips are kept.</p>
|
||||
</article>
|
||||
<article class="settings-panel">
|
||||
<p class="eyebrow">Tray</p>
|
||||
<h2>Close behavior</h2>
|
||||
<label class="toggle"><input type="checkbox" ${state.minimizeToTray ? "checked" : ""} data-action="toggle-minimize-to-tray" /> Keep running in the system tray when I close the window</label>
|
||||
<p class="muted">When enabled, closing the ClipForge window hides it to the tray and it keeps recording. Use "Quit ClipForge" from the tray icon to exit fully.</p>
|
||||
</article>
|
||||
<article class="settings-panel">
|
||||
<p class="eyebrow">About & support</p>
|
||||
<h2>ClipForge ${escapeHtml(state.appVersion)}</h2>
|
||||
@@ -1004,6 +1013,12 @@ function bindEvents() {
|
||||
void saveAutoRecordSetting(state.autoRecordEnabled);
|
||||
});
|
||||
|
||||
appRoot.querySelector<HTMLInputElement>("[data-action='toggle-minimize-to-tray']")?.addEventListener("change", (event) => {
|
||||
state.minimizeToTray = (event.target as HTMLInputElement).checked;
|
||||
render();
|
||||
void saveMinimizeToTraySetting(state.minimizeToTray);
|
||||
});
|
||||
|
||||
appRoot.querySelectorAll<HTMLButtonElement>("[data-upload-provider]").forEach((button) => {
|
||||
button.addEventListener("click", () => {
|
||||
state.uploadProvider = button.dataset.uploadProvider as UploadProvider;
|
||||
@@ -1426,6 +1441,9 @@ state.separateAudioTracks = status.separate_audio_tracks ?? false;
|
||||
if (typeof status.onboarding_complete === "boolean") {
|
||||
state.onboardingComplete = status.onboarding_complete;
|
||||
}
|
||||
if (typeof status.minimize_to_tray === "boolean") {
|
||||
state.minimizeToTray = status.minimize_to_tray;
|
||||
}
|
||||
}
|
||||
|
||||
async function trimSelectedClip() {
|
||||
@@ -1672,6 +1690,20 @@ async function saveAutoRecordSetting(enabled: boolean) {
|
||||
}
|
||||
}
|
||||
|
||||
async function saveMinimizeToTraySetting(enabled: boolean) {
|
||||
if (!tauriInvoke) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const status = await tauriInvoke<DesktopStatus>("set_minimize_to_tray_enabled", { enabled });
|
||||
applyDesktopStatus(status);
|
||||
render();
|
||||
} catch (error) {
|
||||
console.warn("Could not save minimize-to-tray setting", error);
|
||||
}
|
||||
}
|
||||
|
||||
async function refreshStatus() {
|
||||
if (!tauriInvoke || !state.onboardingComplete) {
|
||||
return;
|
||||
|
||||
@@ -327,6 +327,11 @@ h3 {
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.screenshot-thumb img {
|
||||
object-fit: contain;
|
||||
background: #000;
|
||||
}
|
||||
|
||||
.thumb.kill {
|
||||
background: linear-gradient(135deg, #1f2937, #7f1d1d);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user