Skip to content

Build your personal knowledge base with Trilium Notes

docs(user): document TRILIUM_LAUNCH_EXEC for Linux packagers

Elian Doran1e538b30add8
diff --git a/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Installation & Setup/Desktop Installation/Tray icon & automatic startup.html b/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Installation & Setup/Desktop Installation/Tray icon & automatic startup.html
index e4f4b85ad5..7e0cb143d0 100644
--- a/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Installation & Setup/Desktop Installation/Tray icon & automatic startup.html
+++ b/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Installation & Setup/Desktop Installation/Tray icon & automatic startup.html
@@ -57,4 +57,19 @@
are not impacted by this option.</li>
</ul>
</li>
-</ul>
\ No newline at end of file
+</ul>
+<h3>Linux: custom launch command for packagers</h3>
+<p>On Linux, <em>Launch on startup</em> writes a <code>trilium.desktop</code> entry
+ to the user's autostart directory (<code>$XDG_CONFIG_HOME/autostart</code>,
+ usually <code>~/.config/autostart</code>). Its <code>Exec</code> line points
+ to the AppImage when running from one, or to the running executable otherwise.</p>
+<p>Distribution packages that run Trilium on a system-wide Electron (for
+ example <code>electron /usr/lib/trilium/app.asar</code>) cannot rely on the
+ running executable, since it is the bare Electron binary, which starts
+ without Trilium. Such packages can set the <code>TRILIUM_LAUNCH_EXEC</code> environment
+ variable, typically in their wrapper script, to the full command that starts
+ Trilium:</p><pre><code class="language-text-x-trilium-auto">export TRILIUM_LAUNCH_EXEC='electron "/usr/lib/trilium/app.asar"'</code></pre>
+<p>The value is written to the <code>Exec</code> line as-is, so any paths
+ containing spaces must already be quoted. When <em>Start minimized to tray</em> is
+ enabled, <code>--start-hidden</code> is appended to it. <code>TRILIUM_LAUNCH_EXEC</code> takes
+ precedence over both the AppImage path and the running executable.</p>
diff --git a/docs/User Guide/User Guide/Installation & Setup/Desktop Installation/Tray icon & automatic startup.md b/docs/User Guide/User Guide/Installation & Setup/Desktop Installation/Tray icon & automatic startup.md
index 47e210eeb4..96492335c2 100644
--- a/docs/User Guide/User Guide/Installation & Setup/Desktop Installation/Tray icon & automatic startup.md
+++ b/docs/User Guide/User Guide/Installation & Setup/Desktop Installation/Tray icon & automatic startup.md
@@ -34,4 +34,16 @@ Two options control the automatic startup functionality in <a class="reference-
* When _Launch on startup_ is enabled, the application will automatically start up when logging into the current user.
* Note that on Linux support depends on the desktop environment. Feel free to [report](../../Troubleshooting/Reporting%20issues.md) any issues.
* If _Start minimized to tray_ is also enabled, the application will start up in the background and can be revealed from the tray icon.
- * This only applies if _Launch on startup_ is enabled, manual starts are not impacted by this option.
\ No newline at end of file
+ * This only applies if _Launch on startup_ is enabled, manual starts are not impacted by this option.
+
+### Linux: custom launch command for packagers
+
+On Linux, _Launch on startup_ writes a `trilium.desktop` entry to the user's autostart directory (`$XDG_CONFIG_HOME/autostart`, usually `~/.config/autostart`). Its `Exec` line points to the AppImage when running from one, or to the running executable otherwise.
+
+Distribution packages that run Trilium on a system-wide Electron (for example `electron /usr/lib/trilium/app.asar`) cannot rely on the running executable, since it is the bare Electron binary, which starts without Trilium. Such packages can set the `TRILIUM_LAUNCH_EXEC` environment variable, typically in their wrapper script, to the full command that starts Trilium:
+
+```
+export TRILIUM_LAUNCH_EXEC='electron "/usr/lib/trilium/app.asar"'
+```
+
+The value is written to the `Exec` line as-is, so any paths containing spaces must already be quoted. When _Start minimized to tray_ is enabled, `--start-hidden` is appended to it. `TRILIUM_LAUNCH_EXEC` takes precedence over both the AppImage path and the running executable.