mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-03-09 15:40:26 +00:00
Merge branch 'main' of github.com:hydralauncher/hydra into feature/cloud-sync
This commit is contained in:
commit
bef9ec30f9
15 changed files with 269 additions and 39 deletions
5
src/renderer/src/declaration.d.ts
vendored
5
src/renderer/src/declaration.d.ts
vendored
|
@ -114,7 +114,10 @@ declare global {
|
|||
updateUserPreferences: (
|
||||
preferences: Partial<UserPreferences>
|
||||
) => Promise<void>;
|
||||
autoLaunch: (enabled: boolean) => Promise<void>;
|
||||
autoLaunch: (autoLaunchProps: {
|
||||
enabled: boolean;
|
||||
minimized: boolean;
|
||||
}) => Promise<void>;
|
||||
authenticateRealDebrid: (apiToken: string) => Promise<RealDebridUser>;
|
||||
|
||||
/* Download sources */
|
||||
|
|
|
@ -17,6 +17,7 @@ export function SettingsBehavior() {
|
|||
const [form, setForm] = useState({
|
||||
preferQuitInsteadOfHiding: false,
|
||||
runAtStartup: false,
|
||||
startMinimized: false,
|
||||
});
|
||||
|
||||
const { t } = useTranslation("settings");
|
||||
|
@ -26,6 +27,7 @@ export function SettingsBehavior() {
|
|||
setForm({
|
||||
preferQuitInsteadOfHiding: userPreferences.preferQuitInsteadOfHiding,
|
||||
runAtStartup: userPreferences.runAtStartup,
|
||||
startMinimized: userPreferences.startMinimized,
|
||||
});
|
||||
}
|
||||
}, [userPreferences]);
|
||||
|
@ -58,11 +60,32 @@ export function SettingsBehavior() {
|
|||
label={t("launch_with_system")}
|
||||
onChange={() => {
|
||||
handleChange({ runAtStartup: !form.runAtStartup });
|
||||
window.electron.autoLaunch(!form.runAtStartup);
|
||||
window.electron.autoLaunch({
|
||||
enabled: !form.runAtStartup,
|
||||
minimized: form.startMinimized,
|
||||
});
|
||||
}}
|
||||
checked={form.runAtStartup}
|
||||
/>
|
||||
)}
|
||||
|
||||
{showRunAtStartup && (
|
||||
<div style={{ opacity: form.runAtStartup ? 1 : 0.5 }}>
|
||||
<CheckboxField
|
||||
label={t("launch_minimized")}
|
||||
style={{ cursor: form.runAtStartup ? "pointer" : "not-allowed" }}
|
||||
checked={form.runAtStartup && form.startMinimized}
|
||||
disabled={!form.runAtStartup}
|
||||
onChange={() => {
|
||||
handleChange({ startMinimized: !form.startMinimized });
|
||||
window.electron.autoLaunch({
|
||||
minimized: !form.startMinimized,
|
||||
enabled: form.runAtStartup,
|
||||
});
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue