Skip to content

Commit

Permalink
fix(ShowOnStartup): bug that prevented window.showOnStartup option to…
Browse files Browse the repository at this point in the history
… work properly
  • Loading branch information
oliverschwendener committed Feb 17, 2024
1 parent b2ce496 commit 1d08a3a
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/main/Core/BrowserWindow/createBrowserWindow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const createBrowserWindow = (dependencyRegistry: DependencyRegistry<Depen
const operatingSystem = dependencyRegistry.get("OperatingSystem");
const settingsManager = dependencyRegistry.get("SettingsManager");

const startHidden = settingsManager.getValue<boolean>("window.showOnStartup", false);
const show = settingsManager.getValue<boolean>("window.showOnStartup", true);
const alwaysOnTop = settingsManager.getValue<boolean>("window.alwaysOnTop", false);

const preloadScriptFilePath = join(__dirname, "..", "dist-preload", "index.js");
Expand All @@ -20,7 +20,7 @@ export const createBrowserWindow = (dependencyRegistry: DependencyRegistry<Depen
width: 750,
height: 500,
frame: false,
show: !startHidden,
show,
webPreferences: {
preload: preloadScriptFilePath,
webSecurity: app.isPackaged,
Expand Down
4 changes: 2 additions & 2 deletions src/renderer/Core/I18n/getCoreTranslations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ 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 @@ -55,7 +54,6 @@ 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 Expand Up @@ -186,12 +184,14 @@ export const getCoreTranslations = (): { namespace: string; translations: Transl
hideWindowAfterExecution: "Hide window after execution",
hideWindowOnBlur: "Hide window on blur",
alwaysOnTop: "Always on top",
showOnStartup: "Show on startup",
},
"de-CH": {
title: "Fenster",
hideWindowAfterExecution: "Fenster verstecken nach Ausführung",
hideWindowOnBlur: "Fenster verstecken bei Fokusverlust",
alwaysOnTop: "Immer im Vordergrund",
showOnStartup: "Beim Start anzeigen",
},
},
},
Expand Down
15 changes: 15 additions & 0 deletions src/renderer/Core/Settings/Pages/Window/ShowOnStartup.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { useSetting } from "@Core/Hooks";
import { Field, Switch } from "@fluentui/react-components";
import { useTranslation } from "react-i18next";

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

const { value, updateValue } = useSetting({ key: "window.showOnStartup", defaultValue: true });

return (
<Field label={t("showOnStartup", { ns: "settingsWindow" })}>
<Switch checked={value} onChange={(_, { checked }) => updateValue(checked)} />
</Field>
);
};
4 changes: 4 additions & 0 deletions src/renderer/Core/Settings/Pages/Window/Window.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { BackgroundMaterial } from "./BackgroundMaterial";
import { HideWindowAfterExecution } from "./HideWindowAfterExecution";
import { HideWindowOnBlur } from "./HideWindowOnBlur";
import { Opacity } from "./Opacity";
import { ShowOnStartup } from "./ShowOnStartup";
import { Vibrancy } from "./Vibrancy";

export const Window = () => {
Expand All @@ -23,6 +24,9 @@ export const Window = () => {
<Section>
<AlwaysOnTop />
</Section>
<Section>
<ShowOnStartup />
</Section>
<Section>
<HideWindowOnBlur />
</Section>
Expand Down

0 comments on commit 1d08a3a

Please sign in to comment.