feat: Minimiert starten + kein Fenster-Popup bei .cloud Oeffnung
- .cloud Doppelklick oeffnet Datei im Hintergrund ohne das Client- Fenster aufzupoppen (war nervig) - Neue Einstellung "Minimiert starten (direkt im System-Tray)" als Checkbox im Einstellungen-Bereich - Wird in config.json gespeichert, bleibt bei Updates erhalten - Bei aktiviertem Haken: Client startet unsichtbar im Tray, Sync laeuft im Hintergrund, Fenster nur per Tray-Doppelklick Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -104,6 +104,19 @@ async fn auto_login(state: State<'_, AppState>) -> Result<serde_json::Value, Str
|
||||
}))
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
fn set_start_minimized(minimized: bool) -> Result<String, String> {
|
||||
let mut config = AppConfig::load();
|
||||
config.start_minimized = minimized;
|
||||
config.save()?;
|
||||
Ok(format!("Minimiert starten: {}", minimized))
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
fn get_start_minimized() -> bool {
|
||||
AppConfig::load().start_minimized
|
||||
}
|
||||
|
||||
// --- Sync Paths ---
|
||||
|
||||
#[tauri::command]
|
||||
@@ -741,11 +754,7 @@ pub fn run() {
|
||||
let path = path.trim().to_string();
|
||||
if !path.is_empty() {
|
||||
let _ = app_req.emit("open-cloud-file", path);
|
||||
// Show the window
|
||||
if let Some(w) = app_req.get_webview_window("main") {
|
||||
let _ = w.show();
|
||||
let _ = w.set_focus();
|
||||
}
|
||||
// Don't show window - user opens it via tray when needed
|
||||
}
|
||||
}
|
||||
std::fs::remove_file(&request_file).ok();
|
||||
@@ -753,6 +762,14 @@ pub fn run() {
|
||||
}
|
||||
});
|
||||
|
||||
// Start minimized if configured
|
||||
let config = AppConfig::load();
|
||||
if config.start_minimized {
|
||||
if let Some(w) = app.get_webview_window("main") {
|
||||
let _ = w.hide();
|
||||
}
|
||||
}
|
||||
|
||||
// Handle .cloud file opened via file association (double-click)
|
||||
let args: Vec<String> = std::env::args().collect();
|
||||
if args.len() > 1 {
|
||||
@@ -803,6 +820,8 @@ pub fn run() {
|
||||
load_saved_config,
|
||||
auto_login,
|
||||
login,
|
||||
set_start_minimized,
|
||||
get_start_minimized,
|
||||
add_sync_path,
|
||||
remove_sync_path,
|
||||
get_sync_paths,
|
||||
|
||||
Reference in New Issue
Block a user