Skip to content

Build your personal knowledge base with Trilium Notes

feat(desktop): add hide-to-tray on autostart option

Elian Doran1883d90351a8
diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.json
index 8690e68bb5..bedc33045f 100644
--- a/apps/client/src/translations/en/translation.json
+++ b/apps/client/src/translations/en/translation.json
@@ -1522,7 +1522,9 @@
"startup": {
"title": "Startup",
"launch_on_startup": "Launch on startup",
- "launch_on_startup_description": "Open Trilium automatically when you log into your computer."
+ "launch_on_startup_description": "Open Trilium automatically when you log into your computer.",
+ "hide_on_auto_start": "Start minimized to tray",
+ "hide_on_auto_start_description": "When launched automatically at login, start hidden in the system tray instead of opening a window. Requires launch on startup and the tray icon to be enabled."
},
"tray": {
"title": "System Tray",
diff --git a/apps/client/src/widgets/type_widgets/options/other.tsx b/apps/client/src/widgets/type_widgets/options/other.tsx
index e7c9874337..0e23335728 100644
--- a/apps/client/src/widgets/type_widgets/options/other.tsx
+++ b/apps/client/src/widgets/type_widgets/options/other.tsx
@@ -110,6 +110,8 @@ function SearchEngineSettings() {
function StartupSettings() {
const [ launchOnStartup, setLaunchOnStartup ] = useTriliumOptionBool("launchOnStartup");
+ const [ hideOnAutoStart, setHideOnAutoStart ] = useTriliumOptionBool("hideOnAutoStart");
+ const [ disableTray ] = useTriliumOptionBool("disableTray");
return (
<OptionsSection title={t("startup.title")}>
@@ -124,6 +126,20 @@ function StartupSettings() {
utils.reapplyLaunchOnStartup();
}}
/>
+ <OptionsRowWithToggle
+ name="hide-on-auto-start"
+ label={t("startup.hide_on_auto_start")}
+ description={t("startup.hide_on_auto_start_description")}
+ currentValue={hideOnAutoStart}
+ // Only meaningful when launched at login, and the tray must exist to
+ // bring the hidden window back.
+ disabled={!launchOnStartup || disableTray}
+ onChange={async enabled => {
+ await setHideOnAutoStart(enabled);
+ // Re-tag the autostart entry so it launches hidden (or not).
+ utils.reapplyLaunchOnStartup();
+ }}
+ />
</OptionsSection>
);
}
diff --git a/apps/desktop/src/main.spec.ts b/apps/desktop/src/main.spec.ts
index 9d19b84878..90b025dfd9 100644
--- a/apps/desktop/src/main.spec.ts
+++ b/apps/desktop/src/main.spec.ts
@@ -65,6 +65,8 @@ const h = vi.hoisted(() => ({
registerGlobalShortcuts: vi.fn((..._a: unknown[]) => Promise.resolve()),
setupAutoLaunch: vi.fn(),
applyLaunchOnStartup: vi.fn(),
+ wasLaunchedHidden: vi.fn(() => false),
+ disableTray: false,
unregisterAll: vi.fn(),
// Controllable server start so tests can simulate a slow/hanging server.
startServer: (() => Promise.resolve({})) as () => Promise<unknown>
@@ -114,12 +116,15 @@ vi.mock("@triliumnext/core", async (importOriginal) => {
h.initConfig = config;
return Promise.resolve();
}),
- options: { getOptionOrNull: (key: string) => {
- if (key === "smoothScrollEnabled") return h.smoothScroll;
- if (key === "locale") return h.locale;
- if (key === "formattingLocale") return h.formattingLocale;
- return null;
- } },
+ options: {
+ getOptionOrNull: (key: string) => {
+ if (key === "smoothScrollEnabled") return h.smoothScroll;
+ if (key === "locale") return h.locale;
+ if (key === "formattingLocale") return h.formattingLocale;
+ return null;
+ },
+ getOptionBool: (key: string) => (key === "disableTray" ? h.disableTray : false)
+ },
sql_init: { isDbInitialized: () => h.isDbInitialized, dbReady: Promise.resolve() },
ws: { sendTransactionEntityChangesToAllClients: (...a: unknown[]) => h.sendTransactionEntityChangesToAllClients(...a) },
cls: { getAndClearEntityChangeIds: () => h.entityChangeIds },
@@ -181,7 +186,8 @@ vi.mock("./services/printing", () => ({ setupPrintingHandlers: vi.fn() }));
vi.mock("./services/tray", () => ({ setupSystemTray: vi.fn() }));
vi.mock("./services/auto_launch", () => ({
setupAutoLaunch: (...a: unknown[]) => h.setupAutoLaunch(...a),
- applyLaunchOnStartup: (...a: unknown[]) => h.applyLaunchOnStartup(...a)
+ applyLaunchOnStartup: (...a: unknown[]) => h.applyLaunchOnStartup(...a),
+ wasLaunchedHidden: () => h.wasLaunchedHidden()
}));
vi.mock("./services/shell", () => ({ setupShellHandlers: vi.fn() }));
vi.mock("./services/security_settings", () => ({
diff --git a/apps/desktop/src/main.ts b/apps/desktop/src/main.ts
index bff0b031ab..f5e63833cd 100644
--- a/apps/desktop/src/main.ts
+++ b/apps/desktop/src/main.ts
@@ -25,7 +25,7 @@ import { PRODUCT_NAME } from "./app-info";
import IpcMessagingProvider from "./ipc_messaging_provider";
import DesktopPlatformProvider from "./platform_provider";
import { registerTriliumAppScheme, setupTriliumAppProtocol } from "./protocol";
-import { applyLaunchOnStartup, setupAutoLaunch } from "./services/auto_launch";
+import { applyLaunchOnStartup, setupAutoLaunch, wasLaunchedHidden } from "./services/auto_launch";
import { setupCustomDictionary } from "./services/custom_dictionary";
import { setupPrintingHandlers } from "./services/printing";
import { getSecuritySettings, registerSecurityIpcHandlers } from "./services/security_settings";
@@ -263,7 +263,11 @@ async function onReady() {
if (sql_init.isDbInitialized()) {
await sql_init.dbReady;
- await windowService.createMainWindow();
+ // Open minimized to the tray only when launched at login with the option
+ // on (never on a manual launch, which expects a window) and the tray is
+ // available to summon it from.
+ const startHidden = wasLaunchedHidden() && !options.getOptionBool("disableTray");
+ await windowService.createMainWindow(startHidden);
// Repair the OS autostart entry so it matches the stored option (it can
// drift if the user toggled it elsewhere). Options are loaded now that the
diff --git a/apps/desktop/src/services/auto_launch.spec.ts b/apps/desktop/src/services/auto_launch.spec.ts
index 3f7c520ddb..b06357f002 100644
--- a/apps/desktop/src/services/auto_launch.spec.ts
+++ b/apps/desktop/src/services/auto_launch.spec.ts
@@ -5,9 +5,11 @@ type Handler = (...args: unknown[]) => unknown;
const state = vi.hoisted(() => ({
launchOnStartup: false,
+ hideOnAutoStart: false,
appName: "Trilium Notes",
setLoginItemSettings: vi.fn(),
setLoginItemThrows: false,
+ wasOpenedAsHidden: false,
ipcOn: new Map<string, Handler>(),
mkdirSync: vi.fn(),
writeFileSync: vi.fn(),
@@ -22,6 +24,7 @@ vi.mock("electron", () => ({
if (state.setLoginItemThrows) throw new Error("boom");
return state.setLoginItemSettings(...a);
},
+ getLoginItemSettings: () => ({ wasOpenedAsHidden: state.wasOpenedAsHidden }),
getName: () => state.appName
},
ipcMain: {
@@ -42,11 +45,17 @@ vi.mock("os", () => ({ default: { homedir: () => "/home/user" } }));
vi.mock("@triliumnext/core", () => ({
getLog: () => state.log,
- options: { getOptionBool: (name: string) => (name === "launchOnStartup" ? state.launchOnStartup : false) },
+ options: {
+ getOptionBool: (name: string) => {
+ if (name === "launchOnStartup") return state.launchOnStartup;
+ if (name === "hideOnAutoStart") return state.hideOnAutoStart;
+ return false;
+ }
+ },
utils: { safeExtractMessageAndStackFromError: (e: unknown) => String(e) }
}));
-const { applyLaunchOnStartup, setupAutoLaunch } = await import("./auto_launch.js");
+const { applyLaunchOnStartup, setupAutoLaunch, wasLaunchedHidden, START_HIDDEN_FLAG } = await import("./auto_launch.js");
// Built with the same path.join as the module so the assertions hold on every OS.
const AUTOSTART_DIR = path.join("/home/user", ".config", "autostart");
@@ -66,7 +75,9 @@ function setExecPath(p: string) {
beforeEach(() => {
vi.clearAllMocks();
state.launchOnStartup = false;
+ state.hideOnAutoStart = false;
state.setLoginItemThrows = false;
+ state.wasOpenedAsHidden = false;
state.ipcOn.clear();
delete process.env.APPIMAGE;
});
@@ -82,14 +93,34 @@ describe("auto_launch", () => {
setPlatform("win32");
state.launchOnStartup = true;
applyLaunchOnStartup();
- expect(state.setLoginItemSettings).toHaveBeenCalledWith({ openAtLogin: true });
+ expect(state.setLoginItemSettings).toHaveBeenCalledWith({ openAtLogin: true, openAsHidden: false, args: [] });
});
it("disables the OS login item when the option is off", () => {
setPlatform("darwin");
state.launchOnStartup = false;
applyLaunchOnStartup();
- expect(state.setLoginItemSettings).toHaveBeenCalledWith({ openAtLogin: false });
+ expect(state.setLoginItemSettings).toHaveBeenCalledWith({ openAtLogin: false, openAsHidden: false, args: [] });
+ });
+
+ it("tags the login item to start hidden when hide-on-auto-start is on", () => {
+ setPlatform("win32");
+ state.launchOnStartup = true;
+ state.hideOnAutoStart = true;
+ applyLaunchOnStartup();
+ expect(state.setLoginItemSettings).toHaveBeenCalledWith({
+ openAtLogin: true,
+ openAsHidden: true,
+ args: [START_HIDDEN_FLAG]
+ });
+ });
+
+ it("does not start hidden when autostart is off, even if hide-on-auto-start is on", () => {
+ setPlatform("darwin");
+ state.launchOnStartup = false;
+ state.hideOnAutoStart = true;
+ applyLaunchOnStartup();
+ expect(state.setLoginItemSettings).toHaveBeenCalledWith({ openAtLogin: false, openAsHidden: false, args: [] });
});
it("writes a .desktop autostart file on Linux when enabled", () => {
@@ -109,6 +140,18 @@ describe("auto_launch", () => {
expect(state.setLoginItemSettings).not.toHaveBeenCalled();
});
+ it("appends the start-hidden flag to the Linux Exec line when enabled", () => {
+ setPlatform("linux");
+ setExecPath("/opt/trilium/trilium");
+ state.launchOnStartup = true;
+ state.hideOnAutoStart = true;
+
+ applyLaunchOnStartup();
+
+ const [, content] = state.writeFileSync.mock.calls[0] as [string, string];
+ expect(content).toContain(`Exec="/opt/trilium/trilium" ${START_HIDDEN_FLAG}`);
+ });
+
it("prefers APPIMAGE over execPath for the Linux Exec line", () => {
setPlatform("linux");
setExecPath("/tmp/electron");
@@ -139,6 +182,27 @@ describe("auto_launch", () => {
expect(state.log.error).toHaveBeenCalledWith(expect.stringContaining("Failed to apply launch-on-startup"));
});
+ it("wasLaunchedHidden reflects the --start-hidden argv flag on Windows/Linux", () => {
+ setPlatform("win32");
+ const original = process.argv;
+ try {
+ process.argv = ["node", "main.js", START_HIDDEN_FLAG];
+ expect(wasLaunchedHidden()).toBe(true);
+ process.argv = ["node", "main.js"];
+ expect(wasLaunchedHidden()).toBe(false);
+ } finally {
+ process.argv = original;
+ }
+ });
+
+ it("wasLaunchedHidden reflects wasOpenedAsHidden on macOS", () => {
+ setPlatform("darwin");
+ state.wasOpenedAsHidden = true;
+ expect(wasLaunchedHidden()).toBe(true);
+ state.wasOpenedAsHidden = false;
+ expect(wasLaunchedHidden()).toBe(false);
+ });
+
it("setupAutoLaunch registers the reapply IPC, which applies the current setting", () => {
setPlatform("win32");
setupAutoLaunch();
@@ -148,6 +212,6 @@ describe("auto_launch", () => {
state.launchOnStartup = true;
handler?.();
- expect(state.setLoginItemSettings).toHaveBeenCalledWith({ openAtLogin: true });
+ expect(state.setLoginItemSettings).toHaveBeenCalledWith({ openAtLogin: true, openAsHidden: false, args: [] });
});
});
diff --git a/apps/desktop/src/services/auto_launch.ts b/apps/desktop/src/services/auto_launch.ts
index ba403c0dfb..843b79b3a0 100644
--- a/apps/desktop/src/services/auto_launch.ts
+++ b/apps/desktop/src/services/auto_launch.ts
@@ -10,28 +10,52 @@ import path from "path";
const LINUX_AUTOSTART_DIR = path.join(os.homedir(), ".config", "autostart");
const LINUX_DESKTOP_FILE = path.join(LINUX_AUTOSTART_DIR, "trilium.desktop");
+// We tag the autostart command so the app can tell, at launch, that it was started
+// by the OS at login (and should hide to the tray) rather than launched manually
+// (where it must show a window). macOS has no argv hook for login items, so it uses
+// the native openAsHidden flag and reports it back via wasOpenedAsHidden instead.
+export const START_HIDDEN_FLAG = "--start-hidden";
+
/**
- * Reconciles the OS autostart entry with the current `launchOnStartup` option.
- * Safe to call repeatedly (it's idempotent) and on every startup, so the OS state
- * is repaired if it drifts from the stored option. Failures are logged rather than
+ * Reconciles the OS autostart entry with the current `launchOnStartup` /
+ * `hideOnAutoStart` options. Safe to call repeatedly (it's idempotent) and on every
+ * startup, so the OS state is repaired if it drifts. Failures are logged rather than
* thrown so a permission error (e.g. a read-only autostart dir on Linux) can't take
* down app startup.
*/
export function applyLaunchOnStartup() {
try {
const enabled = optionService.getOptionBool("launchOnStartup");
+ const hidden = enabled && optionService.getOptionBool("hideOnAutoStart");
if (process.platform === "linux") {
- applyLinuxAutostart(enabled);
+ applyLinuxAutostart(enabled, hidden);
} else {
- // macOS + Windows: handled natively by Electron.
- electron.app.setLoginItemSettings({ openAtLogin: enabled });
+ // macOS + Windows: handled natively by Electron. `openAsHidden` is the
+ // macOS mechanism; `args` is the Windows one. Each platform ignores the
+ // option that doesn't apply to it.
+ electron.app.setLoginItemSettings({
+ openAtLogin: enabled,
+ openAsHidden: hidden,
+ args: hidden ? [START_HIDDEN_FLAG] : []
+ });
}
} catch (e) {
getLog().error(`Failed to apply launch-on-startup setting: ${coreUtils.safeExtractMessageAndStackFromError(e)}`);
}
}
+/**
+ * Whether this process was started hidden by the OS at login (vs. launched manually).
+ * Used to decide whether the main window should open minimized to the tray.
+ */
+export function wasLaunchedHidden(): boolean {
+ if (process.platform === "darwin") {
+ return electron.app.getLoginItemSettings().wasOpenedAsHidden;
+ }
+ return process.argv.includes(START_HIDDEN_FLAG);
+}
+
/**
* Registers the IPC the renderer sends after the `launchOnStartup` option changes,
* so the autostart entry updates immediately without an app restart.
@@ -40,24 +64,25 @@ export function setupAutoLaunch() {
electron.ipcMain.on("reapply-launch-on-startup", applyLaunchOnStartup);
}
-function applyLinuxAutostart(enabled: boolean) {
+function applyLinuxAutostart(enabled: boolean, hidden: boolean) {
if (enabled) {
fs.mkdirSync(LINUX_AUTOSTART_DIR, { recursive: true });
- fs.writeFileSync(LINUX_DESKTOP_FILE, buildLinuxDesktopEntry());
+ fs.writeFileSync(LINUX_DESKTOP_FILE, buildLinuxDesktopEntry(hidden));
} else {
fs.rmSync(LINUX_DESKTOP_FILE, { force: true });
}
}
-function buildLinuxDesktopEntry() {
+function buildLinuxDesktopEntry(hidden: boolean) {
// When packaged as an AppImage, APPIMAGE points at the bundle to relaunch;
// otherwise fall back to the running executable.
const exec = process.env.APPIMAGE ?? process.execPath;
+ const execLine = hidden ? `Exec="${exec}" ${START_HIDDEN_FLAG}` : `Exec="${exec}"`;
return [
"[Desktop Entry]",
"Type=Application",
`Name=${electron.app.getName()}`,
- `Exec="${exec}"`,
+ execLine,
"Terminal=false",
"X-GNOME-Autostart-enabled=true",
""
diff --git a/apps/desktop/src/services/tray.spec.ts b/apps/desktop/src/services/tray.spec.ts
index 2a47a789a9..6d8862dbe0 100644
--- a/apps/desktop/src/services/tray.spec.ts
+++ b/apps/desktop/src/services/tray.spec.ts
@@ -29,6 +29,7 @@ const state = vi.hoisted(() => ({
},
// controllable windows
lastFocusedWindow: null as unknown,
+ mainWindow: null as unknown,
allWindows: [] as unknown[],
browserWindowAll: [] as unknown[]
}));
@@ -100,6 +101,7 @@ vi.mock("electron", () => ({
vi.mock("./window.js", () => ({
default: {
getLastFocusedWindow: () => state.lastFocusedWindow,
+ getMainWindow: () => state.mainWindow,
getAllWindows: () => state.allWindows
}
}));
@@ -124,7 +126,7 @@ interface FakeWindow {
show: ReturnType<typeof vi.fn>;
focus: ReturnType<typeof vi.fn>;
hide: ReturnType<typeof vi.fn>;
- isVisible: () => boolean;
+ isVisible: ReturnType<typeof vi.fn>;
close: ReturnType<typeof vi.fn>;
}
@@ -153,7 +155,7 @@ function makeWindow(idOrTitle?: number | string, maybeTitle = "My Note - Trilium
show: vi.fn(),
focus: vi.fn(),
hide: vi.fn(),
- isVisible: () => true,
+ isVisible: vi.fn(() => true),
close: vi.fn()
};
}
@@ -189,6 +191,7 @@ describe("tray", () => {
state.isDev = false;
state.shouldUseDarkColors = false;
state.lastFocusedWindow = null;
+ state.mainWindow = null;
state.allWindows = [];
state.browserWindowAll = [];
// Bookmarks subtree must always exist for buildBookmarksMenu.
@@ -271,6 +274,26 @@ describe("tray", () => {
expect(win.show).toHaveBeenCalled();
expect(win.focus).toHaveBeenCalled();
});
+
+ it("click handler summons a window started hidden (no focus history)", () => {
+ // hide-on-autostart: the window was created hidden, never focused, so it
+ // isn't in the focus list — only reachable via getMainWindow().
+ const win = makeWindow(1);
+ win.isVisible.mockReturnValue(false);
+ state.lastFocusedWindow = null;
+ state.mainWindow = win;
+ state.allWindows = [win];
+ state.browserWindowAll = [win];
+
+ // Build the menu so the window is seeded into windowVisibilityMap (as
+ // hidden, from isVisible()).
+ state.ipcHandlers.get("reload-tray")?.();
+
+ state.trayInstance?.clickHandlers.get("click")?.();
+ expect(win.show).toHaveBeenCalled();
+ expect(win.focus).toHaveBeenCalled();
+ expect(win.hide).not.toHaveBeenCalled();
+ });
});
describe("updateTrayMenu menu contents", () => {
diff --git a/apps/desktop/src/services/tray.ts b/apps/desktop/src/services/tray.ts
index 85df159ab7..5013afee54 100644
--- a/apps/desktop/src/services/tray.ts
+++ b/apps/desktop/src/services/tray.ts
@@ -91,8 +91,10 @@ function updateWindowVisibilityMap(allWindows: BrowserWindow[]) {
allWindows.forEach(window => {
const windowId = window.id;
if (!(windowId in windowVisibilityMap)) {
- // If it does not exist, it is the newly created window
- windowVisibilityMap[windowId] = true;
+ // Newly created window: seed from its actual state rather than assuming
+ // visible, so a window created hidden (hide-on-autostart) is tracked as
+ // hidden and the tray can bring it into view.
+ windowVisibilityMap[windowId] = window.isVisible();
registerVisibilityListener(window);
}
});
@@ -275,18 +277,21 @@ function updateTrayMenu() {
}
function changeVisibility() {
- const lastFocusedWindow = windowService.getLastFocusedWindow();
+ // Fall back to the main window: a window started hidden (hide-on-autostart)
+ // has never been focused, so it isn't in the focus list yet — but it's still
+ // the thing the tray click should reveal.
+ const targetWindow = windowService.getLastFocusedWindow() ?? windowService.getMainWindow();
- if (!lastFocusedWindow) {
+ if (!targetWindow) {
return;
}
// If the window is visible, hide it
- if (windowVisibilityMap[lastFocusedWindow.id]) {
- lastFocusedWindow.hide();
+ if (windowVisibilityMap[targetWindow.id]) {
+ targetWindow.hide();
} else {
- lastFocusedWindow.show();
- lastFocusedWindow.focus();
+ targetWindow.show();
+ targetWindow.focus();
}
}
diff --git a/apps/desktop/src/services/window.spec.ts b/apps/desktop/src/services/window.spec.ts
index d26dcc5208..a83ca5dbb6 100644
--- a/apps/desktop/src/services/window.spec.ts
+++ b/apps/desktop/src/services/window.spec.ts
@@ -340,6 +340,14 @@ describe("window service", () => {
expect(opts.frame).toBeUndefined();
});
+ it("creates the window hidden when startHidden is set, visible otherwise", async () => {
+ await windowService.createMainWindow(true);
+ expect((state.windows[state.windows.length - 1].opts as Record<string, unknown>).show).toBe(false);
+
+ await windowService.createMainWindow();
+ expect((state.windows[state.windows.length - 1].opts as Record<string, unknown>).show).toBe(true);
+ });
+
it("marks startup metrics for creation, first paint, and load finish", async () => {
await windowService.createMainWindow();
const win = state.windows[state.windows.length - 1];
diff --git a/apps/desktop/src/services/window.ts b/apps/desktop/src/services/window.ts
index c0b026d7e8..c6a8b817cf 100644
--- a/apps/desktop/src/services/window.ts
+++ b/apps/desktop/src/services/window.ts
@@ -88,7 +88,7 @@ async function createExtraWindow(extraWindowHash: string) {
trackWindowFocus(win);
}
-async function createMainWindow() {
+async function createMainWindow(startHidden = false) {
if ("setUserTasks" in electron.app) {
electron.app.setUserTasks([
{
@@ -122,6 +122,10 @@ async function createMainWindow() {
minWidth: 500,
minHeight: 400,
title: "Trilium Notes",
+ // Start hidden (launched at login with hide-on-autostart) means the window
+ // is never shown until the user summons it from the tray. Constructing it
+ // hidden avoids a visible flash that show()-then-hide() would cause.
+ show: !startHidden,
webPreferences: {
nodeIntegration: false,
contextIsolation: true,
diff --git a/packages/commons/src/lib/options_interface.ts b/packages/commons/src/lib/options_interface.ts
index 79b160acfa..a812302d6b 100644
--- a/packages/commons/src/lib/options_interface.ts
+++ b/packages/commons/src/lib/options_interface.ts
@@ -172,6 +172,8 @@ export interface OptionDefinitions extends KeyboardShortcutsOptions<KeyboardActi
closeToTray: boolean;
/** Whether the desktop app is launched automatically when the user logs into their computer. */
launchOnStartup: boolean;
+ /** When the app is launched automatically at login, start it minimized to the tray instead of showing a window. Requires {@link launchOnStartup} and the tray icon. */
+ hideOnAutoStart: boolean;
editedNotesOpenInRibbon: boolean;
codeBlockWordWrap: boolean;
codeBlockTabWidth: number;
diff --git a/packages/trilium-core/src/routes/api/options.ts b/packages/trilium-core/src/routes/api/options.ts
index 4de56564b6..e67461943e 100644
--- a/packages/trilium-core/src/routes/api/options.ts
+++ b/packages/trilium-core/src/routes/api/options.ts
@@ -93,6 +93,7 @@ const ALLOWED_OPTIONS = new Set<OptionNames>([
"disableTray",
"closeToTray",
"launchOnStartup",
+ "hideOnAutoStart",
"eraseUnusedAttachmentsAfterSeconds",
"eraseUnusedAttachmentsAfterTimeScale",
"disableTray",
diff --git a/packages/trilium-core/src/services/options_init.ts b/packages/trilium-core/src/services/options_init.ts
index ae5a7e139d..c8624e03c9 100644
--- a/packages/trilium-core/src/services/options_init.ts
+++ b/packages/trilium-core/src/services/options_init.ts
@@ -167,6 +167,7 @@ const defaultOptions: DefaultOption[] = [
{ name: "disableTray", value: "false", isSynced: false },
{ name: "closeToTray", value: "false", isSynced: false },
{ name: "launchOnStartup", value: "false", isSynced: false },
+ { name: "hideOnAutoStart", value: "false", isSynced: false },
{ name: "eraseUnusedAttachmentsAfterSeconds", value: "2592000", isSynced: true }, // default 30 days
{ name: "eraseUnusedAttachmentsAfterTimeScale", value: "86400", isSynced: true }, // default 86400 seconds = Day
{ name: "logRetentionDays", value: "90", isSynced: false }, // default 90 days