mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-01-23 21:44:55 +03:00
feat: implement launch minimized option
This commit is contained in:
parent
7af56cd7cc
commit
9e020652c9
@ -16,15 +16,16 @@ const windowsStartupPath = path.join(
|
||||
|
||||
const autoLaunch = async (
|
||||
_event: Electron.IpcMainInvokeEvent,
|
||||
enabled: boolean
|
||||
autoLaunchProps: { enabled: boolean; minimized: boolean }
|
||||
) => {
|
||||
if (!app.isPackaged) return;
|
||||
|
||||
const appLauncher = new AutoLaunch({
|
||||
name: app.getName(),
|
||||
isHidden: autoLaunchProps.minimized,
|
||||
});
|
||||
|
||||
if (enabled) {
|
||||
if (autoLaunchProps.enabled) {
|
||||
appLauncher.enable().catch((err) => {
|
||||
logger.error(err);
|
||||
});
|
||||
|
@ -101,7 +101,8 @@ contextBridge.exposeInMainWorld("electron", {
|
||||
getUserPreferences: () => ipcRenderer.invoke("getUserPreferences"),
|
||||
updateUserPreferences: (preferences: UserPreferences) =>
|
||||
ipcRenderer.invoke("updateUserPreferences", preferences),
|
||||
autoLaunch: (enabled: boolean) => ipcRenderer.invoke("autoLaunch", enabled),
|
||||
autoLaunch: (autoLaunchProps: { enabled: boolean; minimized: boolean }) =>
|
||||
ipcRenderer.invoke("autoLaunch", autoLaunchProps),
|
||||
authenticateRealDebrid: (apiToken: string) =>
|
||||
ipcRenderer.invoke("authenticateRealDebrid", apiToken),
|
||||
|
||||
|
4
src/renderer/src/declaration.d.ts
vendored
4
src/renderer/src/declaration.d.ts
vendored
@ -114,7 +114,9 @@ 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 */
|
||||
|
@ -62,7 +62,7 @@ export function SettingsBehavior() {
|
||||
label={t("launch_with_system")}
|
||||
onChange={() => {
|
||||
handleChange({ runAtStartup: !form.runAtStartup });
|
||||
window.electron.autoLaunch(!form.runAtStartup);
|
||||
window.electron.autoLaunch({ enabled: !form.runAtStartup });
|
||||
}}
|
||||
checked={form.runAtStartup}
|
||||
/>
|
||||
@ -77,6 +77,7 @@ export function SettingsBehavior() {
|
||||
disabled={!form.runAtStartup}
|
||||
onChange={() => {
|
||||
handleChange({ startMinimized: !form.startMinimized });
|
||||
window.electron.autoLaunch({ minimized: !form.startMinimized });
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user