import { useEffect, useState } from "react"; import { invoke } from "@tauri-apps/api/core"; import { Card } from "@/components/ui/card"; import { useI18n } from "@/i18n"; import { asUiError } from "@/lib/api"; export function WindowSettings() { const { t } = useI18n(); const [enabled, setEnabled] = useState(null); const [busy, setBusy] = useState(false); const [error, setError] = useState(null); useEffect(() => { void invoke("close_to_tray").then(setEnabled).catch(e => setError(asUiError(e).technical)); }, []); async function change(next: boolean) { setBusy(true); setError(null); try { await invoke("set_close_to_tray", { enabled: next }); setEnabled(next); } catch (e) { setError(asUiError(e).technical); } finally { setBusy(false); } } return

{t("settings.closeToTrayHint")}

{error &&

{error}

}
; }