feat: minimise-to-tray-on-startup (#126)

* feat: minimise-to-tray-on-startup

Signed-off-by: Mihai <cristian@mihaimuresan.com>

* feat: minimise-to-tray-on-startup

Signed-off-by: Mihai <cristian@mihaimuresan.com>

* fix: redundant call

Signed-off-by: Mihai <cristian@mihaimuresan.com>

* fix: redundant call

Signed-off-by: Mihai <cristian@mihaimuresan.com>

---------

Signed-off-by: Mihai <cristian@mihaimuresan.com>
Co-authored-by: Mihai <cristian@mihaimuresan.com>
This commit is contained in:
Mihai
2026-02-17 21:28:29 +01:00
committed by GitHub
parent 897d706983
commit 8284117e76
2 changed files with 29 additions and 4 deletions
+24 -4
View File
@@ -16,6 +16,9 @@ const schema = {
minimiseToTray: {
type: "boolean",
} as JSONSchema.Boolean,
startMinimisedToTray: {
type: "boolean",
} as JSONSchema.Boolean,
spellchecker: {
type: "boolean",
} as JSONSchema.Boolean,
@@ -29,16 +32,16 @@ const schema = {
type: "object",
properties: {
x: {
type: 'number'
type: "number",
} as JSONSchema.Number,
y: {
type: 'number'
type: "number",
} as JSONSchema.Number,
width: {
type: 'number'
type: "number",
} as JSONSchema.Number,
height: {
type: 'number'
type: "number",
} as JSONSchema.Number,
isMaximised: {
type: "boolean",
@@ -53,6 +56,7 @@ const store = new Store({
firstLaunch: true,
customFrame: true,
minimiseToTray: true,
startMinimisedToTray: false,
spellchecker: true,
hardwareAcceleration: true,
discordRpc: true,
@@ -75,6 +79,7 @@ class Config {
firstLaunch: this.firstLaunch,
customFrame: this.customFrame,
minimiseToTray: this.minimiseToTray,
startMinimisedToTray: this.startMinimisedToTray,
spellchecker: this.spellchecker,
hardwareAcceleration: this.hardwareAcceleration,
discordRpc: this.discordRpc,
@@ -123,6 +128,21 @@ class Config {
this.sync();
}
get startMinimisedToTray() {
return (store as never as { get(k: string): boolean }).get(
"startMinimisedToTray",
);
}
set startMinimisedToTray(value: boolean) {
(store as never as { set(k: string, value: boolean): void }).set(
"startMinimisedToTray",
value,
);
this.sync();
}
get spellchecker() {
return (store as never as { get(k: string): boolean }).get("spellchecker");
}
+5
View File
@@ -36,6 +36,10 @@ const windowIcon = nativeImage.createFromDataURL(windowIconAsset);
* Create the main application window
*/
export function createMainWindow() {
// (CLI arg --hidden or config)
const startHidden =
app.commandLine.hasSwitch("hidden") || config.startMinimisedToTray;
// create the window
mainWindow = new BrowserWindow({
minWidth: 300,
@@ -45,6 +49,7 @@ export function createMainWindow() {
backgroundColor: "#191919",
frame: !config.customFrame,
icon: windowIcon,
show: !startHidden,
webPreferences: {
// relative to `.vite/build`
preload: join(__dirname, "preload.js"),