Skip to content

Commit

Permalink
Added option to start app hidden
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverschwendener committed Feb 16, 2024
1 parent dbe284d commit 7b30d11
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/main/Core/BrowserWindow/createBrowserWindow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,15 @@ export const createBrowserWindow = (dependencyRegistry: DependencyRegistry<Depen
const operatingSystem = dependencyRegistry.get("OperatingSystem");
const settingsManager = dependencyRegistry.get("SettingsManager");

const startHidden = settingsManager.getValue<boolean>("general.startHidden", false);

const preloadScriptFilePath = join(__dirname, "..", "dist-preload", "index.js");

const defaultBrowserWindowOptions: BrowserWindowConstructorOptions = {
width: 750,
height: 500,
frame: false,
show: !startHidden,
webPreferences: {
preload: preloadScriptFilePath,
webSecurity: app.isPackaged,
Expand Down
2 changes: 2 additions & 0 deletions src/renderer/Core/I18n/getCoreTranslations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export const getCoreTranslations = (): { namespace: string; translations: Transl
hotkeyMoreInfo: "More info",
language: "Language",
autostart: "Start Ueli automatically after you log into the computer",
startHidden: "Start hidden",
},
"de-CH": {
title: "Allgemein",
Expand All @@ -54,6 +55,7 @@ export const getCoreTranslations = (): { namespace: string; translations: Transl
hotkeyMoreInfo: "Mehr Informationen",
language: "Sprache",
autostart: "Ueli automatisch starten, nach Anmelden am Computer",
startHidden: "Versteckt starten",
},
},
},
Expand Down
4 changes: 4 additions & 0 deletions src/renderer/Core/Settings/Pages/General/General.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { SectionList } from "../../SectionList";
import { Autostart } from "./Autostart";
import { HotKey } from "./HotKey";
import { Language } from "./Language";
import { StartHidden } from "./StartHidden";

export const General = () => {
return (
Expand All @@ -16,6 +17,9 @@ export const General = () => {
<Section>
<Autostart />
</Section>
<Section>
<StartHidden />
</Section>
</SectionList>
);
};
18 changes: 18 additions & 0 deletions src/renderer/Core/Settings/Pages/General/StartHidden.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { useSetting } from "@Core/Hooks";
import { Field, Switch } from "@fluentui/react-components";
import { useTranslation } from "react-i18next";

export const StartHidden = () => {
const { t } = useTranslation();

const { value: startHidden, updateValue: setStartHidden } = useSetting({
key: "general.startHidden",
defaultValue: false,
});

return (
<Field label={t("startHidden", { ns: "settingsGeneral" })}>
<Switch checked={startHidden} onChange={(_, { checked }) => setStartHidden(checked)} />
</Field>
);
};

0 comments on commit 7b30d11

Please sign in to comment.