Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
client/global menu: create a "Theme" submenu
Adorian Doranba0fb1437856
diff --git a/apps/client/src/services/color_scheme.ts b/apps/client/src/services/color_scheme.tsindex e4492a17dc..187fbf560a 100644--- a/apps/client/src/services/color_scheme.ts+++ b/apps/client/src/services/color_scheme.ts@@ -3,6 +3,12 @@ export type ColorScheme = "system" | "light" | "dark";/** Order the color-scheme switcher cycles through on each click. */export const COLOR_SCHEME_CYCLE: readonly ColorScheme[] = [ "system", "light", "dark" ];+export const COLOR_SCHEME_ICONS: Record<ColorScheme, string> = {+ system: "bx bx-brightness-half",+ light: "bx bx-sun",+ dark: "bx bx-moon"+};+/** Maps each theme family and color scheme to the concrete `theme` option value. */export const THEME_FAMILY_SCHEMES: Record<string, Record<ColorScheme, string>> = {modern: { system: "next", light: "next-light", dark: "next-dark" },diff --git a/apps/client/src/services/theme.ts b/apps/client/src/services/theme.tsindex d00b3f3b35..8e6a7dd401 100644--- a/apps/client/src/services/theme.ts+++ b/apps/client/src/services/theme.ts@@ -1,3 +1,5 @@+import type { UserTheme } from "@triliumnext/commons";+import { readCssVar } from "../utils/css-var.js";export function getThemeStyle(): "auto" | "light" | "dark" {@@ -170,7 +172,7 @@ export async function applyThemeFromOptions() {// Custom theme — resolve its note to build the CSS URL and the optional `next` base.const { default: server } = await import("./server.js");- const userThemes = await server.get<CustomThemeInfo[]>("options/user-themes");+ const userThemes = await server.get<UserTheme[]>("options/user-themes");// The theme may have changed again while the request was in flight; applying the stale// one now would override the latest choice (whose own invocation may already have run).@@ -186,12 +188,6 @@ export async function applyThemeFromOptions() {);}-interface CustomThemeInfo {- val: string;- noteId: string;- appThemeBase?: ThemeBase;-}-/*** Swaps the active theme stylesheets without reloading the page. The new stylesheets are appended first and the* previous ones removed only once the new ones have loaded, so the swap stays free of a flash of unstyled content.diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.jsonindex a0dfa91cc8..bec9b3dc9e 100644--- a/apps/client/src/translations/en/translation.json+++ b/apps/client/src/translations/en/translation.json@@ -1191,7 +1191,8 @@"toggle-zen-mode": "Zen mode","new-version-available": "New update available","download-update": "Get version {{latestVersion}}",- "search_notes": "Search notes"+ "search_notes": "Search notes",+ "theme": "Theme"},"zen_mode": {"button_exit": "Exit Zen Mode"diff --git a/apps/client/src/widgets/buttons/global_menu.spec.tsx b/apps/client/src/widgets/buttons/global_menu.spec.tsxindex 10648cb29c..8b7e0aecaf 100644--- a/apps/client/src/widgets/buttons/global_menu.spec.tsx+++ b/apps/client/src/widgets/buttons/global_menu.spec.tsx@@ -4,7 +4,9 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";// Shared, mutable control state for the mocks below. `vi.hoisted` runs before the hoisted `vi.mock`// factories, so they can safely reference it.-const ctrl = vi.hoisted(() => ({ standalone: false, checkForUpdates: true, mobile: false }));+const ctrl = vi.hoisted(() => ({+ standalone: false, checkForUpdates: true, mobile: false, theme: "next", setTheme: vi.fn()+}));// `isStandalone` is a const in the target, read here as a live getter so each scenario can flip the// kind of client we are pretending to be. Partial-mock so the rest of utils stays real — in@@ -22,12 +24,21 @@ vi.mock("../../services/i18n", () => ({ t: (key: string) => key }));// The hook reads the user's preference through `useTriliumOptionBool`; stub just that one, so the// other hooks the menu pulls in keep their real implementation.-vi.mock("../react/hooks", async (importOriginal) => ({- ...(await importOriginal<typeof import("../react/hooks")>()),- useTriliumOptionBool: () => [ ctrl.checkForUpdates, vi.fn() ]-}));+vi.mock("../react/hooks", async (importOriginal) => {+ const original = await importOriginal<typeof import("../react/hooks")>();+ return {+ ...original,+ useTriliumOptionBool: () => [ ctrl.checkForUpdates, vi.fn() ],+ useTriliumOption: (...args: Parameters<typeof original.useTriliumOption>) => (args[0] === "theme"+ ? [ ctrl.theme, ctrl.setTheme ]+ : original.useTriliumOption(...args))+ };+});// Import AFTER the mocks (vi.mock is hoisted, but the import must resolve the mocked deps).+import type { UserTheme } from "@triliumnext/commons";++import server from "../../services/server";import GlobalMenu, { parseLatestVersion, RELEASES_API_URL, UPDATE_CHECK_INTERVAL, useTriliumUpdateStatus } from "./global_menu";let status: ReturnType<typeof useTriliumUpdateStatus> | undefined;@@ -161,26 +172,51 @@ describe("GlobalMenu", () => {const rows = (scope: Element | null | undefined) => [ ...scope?.querySelectorAll(":scope > li.dropdown-item, :scope > .dropdown-item") ?? [] ].map((row) => row.textContent?.trim());- async function openAdvanced() {+ let userThemes: UserTheme[] = [];++ /** Opens the menu, then the submenu whose title is `titleKey`. */+ async function openSubmenu(titleKey: string) {await act(async () => {if (container) render(<GlobalMenu isHorizontalLayout />, container);});const toggle = container?.querySelector<HTMLButtonElement>("button.global-menu-button");await act(async () => toggle?.click());await vi.waitFor(() => expect(popup()).not.toBeNull());- const topLevel = rows(popup()?.querySelector(".tn-menu-scroll"));+ const topLevelScroll = popup()?.querySelector(".tn-menu-scroll");+ const topLevel = rows(topLevelScroll);- const advanced = [ ...popup()?.querySelectorAll<HTMLElement>("li.dropdown-submenu") ?? [] ]- .find((row) => row.textContent?.includes("global_menu.advanced"));+ const submenuRow = [ ...popup()?.querySelectorAll<HTMLElement>("li.dropdown-submenu") ?? [] ]+ .find((row) => row.textContent?.includes(titleKey));// A phone opens a submenu as a page over the menu; a desktop beside it, on hover.const opened = () => popup()?.querySelector(":scope > .tn-menu-page .tn-menu-scroll")?? popup()?.querySelector(":scope > div.dropdown-submenu > .dropdown-menu .tn-menu-scroll");await act(async () => {- if (ctrl.mobile) advanced?.click();- else advanced?.dispatchEvent(new PointerEvent("pointerenter"));+ if (ctrl.mobile) submenuRow?.click();+ else submenuRow?.dispatchEvent(new PointerEvent("pointerenter"));});await vi.waitFor(() => expect(opened()).toBeTruthy());- return { topLevel, advanced: rows(opened()) };+ return { topLevel, topLevelScroll, submenuRow, submenu: opened() };+ }++ async function openAdvanced() {+ const { topLevel, submenu } = await openSubmenu("global_menu.advanced");+ return { topLevel, advanced: rows(submenu) };+ }++ /** Opens the theme submenu once the custom themes have loaded into it. */+ async function openThemes() {+ const opened = await openSubmenu("global_menu.theme");+ const items = () => [ ...opened.submenu?.querySelectorAll<HTMLElement>(":scope > li") ?? [] ];+ await vi.waitFor(() => expect(items().length).toBe(6 + userThemes.length));+ const row = (text: string) => items().find((item) => item.textContent?.trim() === text);+ return {+ ...opened,+ entries: items().map((item) => item.textContent?.trim()),+ checked: items().filter((item) => item.getAttribute("aria-checked") === "true")+ .map((item) => item.textContent?.trim()),+ row,+ click: (text: string) => act(async () => row(text)?.click())+ };}beforeEach(() => {@@ -188,12 +224,70 @@ describe("GlobalMenu", () => {container = document.body.appendChild(document.createElement("div"));// Without slides, a submenu's page goes as soon as it closes.document.body.classList.add("motion-disabled");++ ctrl.theme = "next";+ ctrl.setTheme.mockReset();+ userThemes = [ { val: "solarized", title: "Solarized", noteId: "solarizedNote", icon: "bx bx-paint" } ];+ const get = server.get.bind(server);+ vi.spyOn(server, "get").mockImplementation((async (url: string) => (url === "options/user-themes"+ ? userThemes+ : get(url))) as typeof server.get);});afterEach(() => {document.body.classList.remove("motion-disabled");});+ it("puts the theme submenu right above Advanced", async () => {+ const { topLevelScroll, submenuRow } = await openSubmenu("global_menu.theme");++ expect(submenuRow?.querySelector(".bx-palette")).not.toBeNull();+ const rowsInOrder = [ ...topLevelScroll?.querySelectorAll(":scope > li") ?? [] ];+ const next = submenuRow ? rowsInOrder[rowsInOrder.indexOf(submenuRow) + 1] : undefined;+ expect(next?.textContent?.trim()).toBe("global_menu.advanced");+ });++ it("lists the color schemes, then Modern and the custom themes, with the active ones checked", async () => {+ ctrl.theme = "next-dark";+ const { entries, checked, row, click } = await openThemes();++ expect(entries).toEqual([+ "theme.color_scheme",+ "theme.color_scheme_system", "theme.color_scheme_light", "theme.color_scheme_dark",+ "global_menu.theme",+ "theme.modern_themes", "Solarized"+ ]);+ expect(checked).toEqual([ "theme.color_scheme_dark", "theme.modern_themes" ]);+ expect(row("theme.color_scheme_dark")?.querySelector(".menu-trailing-icon.bx-check")).not.toBeNull();+ expect(row("theme.modern_themes")?.querySelector(".menu-trailing-icon.bx-check")).not.toBeNull();+ expect(row("Solarized")?.querySelector(".menu-trailing-icon")).toBeNull();+ expect(row("Solarized")?.querySelector(".tn-icon.bx-paint")).not.toBeNull();++ await click("theme.color_scheme_light");+ expect(ctrl.setTheme).toHaveBeenCalledWith("next-light");+ });++ it("leaves the legacy theme out, and keeps its color scheme when switching to Modern", async () => {+ ctrl.theme = "dark";+ const { entries, checked, click } = await openThemes();++ expect(entries).not.toContain("theme.legacy_themes");+ expect(checked).toEqual([ "theme.color_scheme_dark" ]);++ await click("theme.modern_themes");+ expect(ctrl.setTheme).toHaveBeenCalledWith("next-dark");+ });++ it("disables the color schemes while a custom theme is active", async () => {+ ctrl.theme = "solarized";+ const { checked, row } = await openThemes();++ expect(checked).toEqual([ "Solarized" ]);+ for (const scheme of [ "theme.color_scheme_system", "theme.color_scheme_light", "theme.color_scheme_dark" ]) {+ expect(row(scheme)?.getAttribute("aria-disabled")).toBe("true");+ }+ });+it("keeps the shared notes and space usage views in Advanced", async () => {const { topLevel, advanced } = await openAdvanced();diff --git a/apps/client/src/widgets/buttons/global_menu.tsx b/apps/client/src/widgets/buttons/global_menu.tsxindex a3b04a9cb2..882ad88a6d 100644--- a/apps/client/src/widgets/buttons/global_menu.tsx+++ b/apps/client/src/widgets/buttons/global_menu.tsx@@ -6,11 +6,17 @@ import { useContext, useEffect, useRef, useState } from "preact/hooks";import { CommandNames } from "../../components/app_context";import Component from "../../components/component";+import {+ COLOR_SCHEME_CYCLE, COLOR_SCHEME_ICONS, ColorScheme, resolveColorScheme, THEME_FAMILY_SCHEMES+} from "../../services/color_scheme";import { t } from "../../services/i18n";import utils, { isElectron, isMobile, isStandalone } from "../../services/utils";import Dropdown from "../react/Dropdown";import { FormDropdownDivider, FormDropdownSubmenu, FormListHeader, FormListItem } from "../react/FormList";-import { useStaticTooltip, useStaticTooltipWithKeyboardShortcut, useTriliumOption, useTriliumOptionBool } from "../react/hooks";+import {+ useStaticTooltip, useStaticTooltipWithKeyboardShortcut, useTriliumOption, useTriliumOptionBool,+ useUserThemes+} from "../react/hooks";import { ParentComponent } from "../react/react_utils";interface MenuItemProps<T> {@@ -60,6 +66,7 @@ export default function GlobalMenu({ isHorizontalLayout }: { isHorizontalLayout:{!isMobile() && <SwitchToOptions />}<MenuItem command="showLaunchBarSubtree" icon={`bx ${isMobile() ? "bx-mobile" : "bx-sidebar"}`} text={t("global_menu.configure_launchbar")} />+ <ThemeMenu /><AdvancedMenu /><MenuItem command="showOptions" icon="bx bx-cog" text={t("global_menu.options")} /><FormDropdownDivider />@@ -80,6 +87,60 @@ export default function GlobalMenu({ isHorizontalLayout }: { isHorizontalLayout:);}+/** Picks the color scheme and the theme. The legacy theme is left out. */+function ThemeMenu() {+ const [ theme, setTheme ] = useTriliumOption("theme");+ const userThemes = useUserThemes();+ const { family, scheme, isCustom } = resolveColorScheme(theme);+ const schemeLabels: Record<ColorScheme, string> = {+ system: t("theme.color_scheme_system"),+ light: t("theme.color_scheme_light"),+ dark: t("theme.color_scheme_dark")+ };++ return (+ <FormDropdownSubmenu icon="bx bx-palette" title={t("global_menu.theme")}>+ <FormListHeader text={t("theme.color_scheme")} />+ {COLOR_SCHEME_CYCLE.map((value) => (+ <FormListItem+ key={value}+ icon={COLOR_SCHEME_ICONS[value]}+ checkable+ checked={!isCustom && scheme === value}+ disabled={isCustom}+ disabledTooltip={t("theme.color_scheme_custom_disabled")}+ onClick={() => {+ if (family) void setTheme(THEME_FAMILY_SCHEMES[family][value]);+ }}+ >+ {schemeLabels[value]}+ </FormListItem>+ ))}++ <FormListHeader text={t("global_menu.theme")} />+ <FormListItem+ icon="bx bx-star"+ checkable+ checked={family === "modern"}+ onClick={() => void setTheme(THEME_FAMILY_SCHEMES.modern[scheme])}+ >+ {t("theme.modern_themes")}+ </FormListItem>+ {userThemes.map((userTheme) => (+ <FormListItem+ key={userTheme.val}+ icon={userTheme.icon}+ checkable+ checked={theme === userTheme.val}+ onClick={() => void setTheme(userTheme.val)}+ >+ {userTheme.title}+ </FormListItem>+ ))}+ </FormDropdownSubmenu>+ );+}+function AdvancedMenu() {return (<FormDropdownSubmenu icon="bx bx-chip" title={t("global_menu.advanced")}>diff --git a/apps/client/src/widgets/launch_bar/ColorSchemeSwitcher.tsx b/apps/client/src/widgets/launch_bar/ColorSchemeSwitcher.tsxindex 56f9bc7748..d3480e779d 100644--- a/apps/client/src/widgets/launch_bar/ColorSchemeSwitcher.tsx+++ b/apps/client/src/widgets/launch_bar/ColorSchemeSwitcher.tsx@@ -1,16 +1,12 @@import "./ColorSchemeSwitcher.css";-import { ColorScheme, getNextColorSchemeTheme, resolveColorScheme } from "../../services/color_scheme";+import {+ COLOR_SCHEME_ICONS, ColorScheme, getNextColorSchemeTheme, resolveColorScheme+} from "../../services/color_scheme";import { t } from "../../services/i18n";import { useTriliumOption } from "../react/hooks";import { LaunchBarActionButton, LauncherNoteProps } from "./launch_bar_widgets";-const SCHEME_ICONS: Record<ColorScheme, string> = {- system: "bx bx-brightness-half",- light: "bx bx-sun",- dark: "bx bx-moon"-};-export default function ColorSchemeSwitcher({ launcherNote }: LauncherNoteProps) {const [ theme, setTheme ] = useTriliumOption("theme");const { scheme, isCustom } = resolveColorScheme(theme);@@ -30,7 +26,7 @@ export default function ColorSchemeSwitcher({ launcherNote }: LauncherNoteProps)<LaunchBarActionButtonlauncherNote={launcherNote}className={`color-scheme-switcher${isCustom ? " unsupported" : ""}`}- icon={SCHEME_ICONS[scheme]}+ icon={COLOR_SCHEME_ICONS[scheme]}text={tooltip}tooltipHtmltooltipClass="color-scheme-switcher-tooltip"diff --git a/apps/client/src/widgets/react/hooks.tsx b/apps/client/src/widgets/react/hooks.tsxindex e5c7a65704..a9fe12df4a 100644--- a/apps/client/src/widgets/react/hooks.tsx+++ b/apps/client/src/widgets/react/hooks.tsx@@ -1,7 +1,10 @@import "./tooltip.css";import type { CKTextEditor } from "@triliumnext/ckeditor5";-import { FilterLabelsByType, HighlightedTokenInfo, KeyboardActionNames, NoteType, OptionNames, RelationNames } from "@triliumnext/commons";+import {+ FilterLabelsByType, HighlightedTokenInfo, KeyboardActionNames, NoteType, OptionNames, RelationNames,+ UserTheme+} from "@triliumnext/commons";import { Tooltip } from "bootstrap";import Mark from "mark.js";import { CSSProperties, Ref, RefObject, VNode } from "preact";@@ -457,6 +460,23 @@ export function useTriliumOptions<T extends OptionNames>(...names: T[]) {] as const;}+/** The custom themes (notes with `#appTheme`), fetched once when the component mounts. */+export function useUserThemes() {+ const [ userThemes, setUserThemes ] = useState<UserTheme[]>([]);++ useEffect(() => {+ let cancelled = false;+ void server.get<UserTheme[] | undefined>("options/user-themes").then((themes) => {+ if (!cancelled) setUserThemes(themes ?? []);+ });+ return () => {+ cancelled = true;+ };+ }, []);++ return userThemes;+}+/*** Generates a unique name via a random alphanumeric string of a fixed length.*diff --git a/apps/client/src/widgets/type_widgets/options/appearance.tsx b/apps/client/src/widgets/type_widgets/options/appearance.tsxindex 660811c063..13ec25c66f 100644--- a/apps/client/src/widgets/type_widgets/options/appearance.tsx+++ b/apps/client/src/widgets/type_widgets/options/appearance.tsx@@ -1,11 +1,10 @@import "./appearance.css";-import { useEffect, useMemo, useState } from "preact/hooks";+import { useMemo } from "preact/hooks";import zoomService from "../../../components/zoom";import { ColorScheme, resolveColorScheme, THEME_FAMILY_SCHEMES } from "../../../services/color_scheme";import { t } from "../../../services/i18n";-import server from "../../../services/server";import { isElectron, isMobile } from "../../../services/utils";import { Card, CardSection, OptionCardSection } from "../../react/Card";import Dropdown from "../../react/Dropdown";@@ -13,7 +12,7 @@ import { FormListHeader, FormListItem } from "../../react/FormList";import { FormTextBoxWithUnit } from "../../react/FormTextBox";import FormToggle from "../../react/FormToggle";import HelpButton from "../../react/HelpButton";-import { useTriliumOption, useTriliumOptionBool } from "../../react/hooks";+import { useTriliumOption, useTriliumOptionBool, useUserThemes } from "../../react/hooks";import Icon from "../../react/Icon";import SegmentedChoice, { SegmentedChoiceOption } from "../../react/SegmentedChoice";import Fonts from "./appearance_fonts";@@ -25,13 +24,6 @@ import RestartAction from "./components/RestartAction";const MIN_CONTENT_WIDTH = 640;-interface CustomTheme {- val: string;- title: string;- icon?: string;- noteId?: string;-}-interface ThemeFamily {key: string;title: string;@@ -92,15 +84,9 @@ export default function AppearanceSettings() {function UserInterface() {const [ theme, setTheme ] = useTriliumOption("theme");- const [ customThemes, setCustomThemes ] = useState<CustomTheme[]>([]);+ const customThemes = useUserThemes();const [ editedNotesOpenInRibbon, setEditedNotesOpenInRibbon ] = useTriliumOptionBool("editedNotesOpenInRibbon");- useEffect(() => {- server.get<CustomTheme[]>("options/user-themes").then((userThemes) => {- setCustomThemes(userThemes);- });- }, []);-const resolved = useMemo(() => resolveTheme(theme ?? null), [theme]);const isCustom = resolved.isCustom;diff --git a/apps/server/src/assets/help/help_content.json b/apps/server/src/assets/help/help_content.jsonindex 38eec291b5..3da7de8aff 100644--- a/apps/server/src/assets/help/help_content.json+++ b/apps/server/src/assets/help/help_content.json@@ -36,7 +36,7 @@"_help_tAassRL4RSQL": "<p>Data directory contains:</p><ul><li><code>document.db</code> - <a href=\"#root/_help_wX4HbRucYSDD\">database</a></li><li><code>config.ini</code> - instance level settings like port on which the Trilium application runs</li><li><code>backup</code> - contains automatically <a href=\"#root/_help_ODY7qQn5m2FT\">backup</a> of documents</li><li><code>log</code> - contains application log files</li></ul><h2>Location of the data directory</h2><p>Easy way how to find out which data directory Trilium uses is to look at the \"About Trilium Notes\" dialog (from \"Menu\" in upper left corner):</p><p><img src=\"{{helpAssets}}/User%20Guide/Installation%20%26%20Setup/Data%20directory_image.jpg\"></p><p>Here's how the location is decided:</p><p>Data directory is normally named <code>trilium-data</code> and it is stored in:</p><ul><li><code>/home/[user]/.local/share</code> for Linux</li><li><code>/home/[user]/.var/app/org.triliumnotes.Trilium/data</code> for the Flathub version on Linux</li><li><code>C:\\Users\\[user]\\AppData\\Roaming</code> for Windows Vista and up</li><li><code>/Users/[user]/Library/Application Support</code> for Mac OS</li><li>user's home is a fallback if some of the paths above don't exist</li><li>user's home is also a default setup for [[docker|Docker server installation]]</li></ul><p>If you want to back up your Trilium data, just backup this single directory - it contains everything you need.</p><h3>Changing the location of data directory</h3><p>If you want to use some other location for the data directory than the default one, you may change it via <code>TRILIUM_DATA_DIR</code> environment variable to some other location:</p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\"><span class=\"tn-icon bx bxl-windows\"></span> Windows</p><div class=\"trilium-tab-panel\"><ol><li>Press the <span class=\"tn-icon bx bxl-windows\"></span> key on your keyboard.</li><li>Search and select <em>Edit the system variables</em>.</li><li>Press the <em>Environment Variables…</em> button in the bottom-right of the newly opened screen.</li><li>On the top section (<em>User variables for [user]</em>), press the <em>New…</em> button.</li><li>In the <em>Variable name</em> field insert <code>TRILIUM_DATA_DIR</code>.</li><li>Press the <em>Browse Directory…</em> button and select the new directory where to store the database.</li><li>Close all the windows by pressing the <em>OK</em> button for each of them.</li></ol></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\"><span class=\"tn-icon bx bxl-tux\"></span> Linux</p><div class=\"trilium-tab-panel\"><p>Trilium reads <code>TRILIUM_DATA_DIR</code> when it starts, so the variable must be set in the environment that launches it.</p><aside class=\"admonition note\"><p>Setting the variable does not move existing notes. To keep them, close Trilium and copy the old data directory to the new location first. Trilium creates the last folder of the path if it is missing, but not its parent folders.</p></aside><p><strong>Desktop application (.deb, .rpm, AppImage or .zip)</strong></p><p>To use the new location however Trilium is started (from the application menu, a desktop shortcut, at login or from a terminal), set the variable for the whole session:</p><ol><li><p>Create the file <code>~/.config/environment.d/trilium.conf</code> with the following content, using the full path (<code>~</code> is not expanded in this file):</p><pre><code class=\"language-text-x-trilium-auto\">TRILIUM_DATA_DIR=/home/myuser/data/my-trilium-data</code></pre></li><li><p>Log out and log back in.</p></li></ol><p>This works on desktops started by <code>systemd</code>, which covers most distributions running GNOME or KDE Plasma. On other systems, add the following line to <code>~/.profile</code> instead, then log out and log back in:</p><pre><code class=\"language-text-x-sh\">export TRILIUM_DATA_DIR=\"$HOME/data/my-trilium-data\"</code></pre><p>The same line in <code>~/.bashrc</code> (or your shell's equivalent) only applies when Trilium is started from a terminal, not from the application menu.</p><p><strong>Flatpak (Flathub)</strong></p><p>The Flathub version runs in a sandbox that cannot see the rest of the file system, so it needs access to the folder as well as the variable:</p><pre><code class=\"language-text-x-sh\">flatpak override --user \\\n --env=TRILIUM_DATA_DIR=/home/myuser/data/my-trilium-data \\\n --filesystem=/home/myuser/data/my-trilium-data:create \\\n org.triliumnotes.Trilium</code></pre><p>To return to the default location, run <code>flatpak override --user --reset org.triliumnotes.Trilium</code>. This also removes any other overrides set for Trilium.</p><p><strong>Server running as a systemd service</strong></p><p>Add an <code>Environment=</code> line to the <code>[Service]</code> section of the unit file described in <a class=\"reference-link\" href=\"#root/_help_3tW6mORuTHnB\">Packaged version for Linux</a>:</p><pre><code class=\"language-text-x-trilium-auto\">[Service]\nEnvironment=TRILIUM_DATA_DIR=/var/lib/trilium-data</code></pre><p>Then reload and restart the service:</p><pre><code class=\"language-text-x-sh\">sudo systemctl daemon-reload\nsudo systemctl restart trilium</code></pre><p>The user set in <code>User=</code> must be able to write to the folder. For Docker, see <a class=\"reference-link\" href=\"#root/_help_rWX5eY045zbE\">Using Docker</a> instead.</p></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\"><span class=\"tn-icon bx bxl-apple\"></span> macOS</p><div class=\"trilium-tab-panel\"><p>You need to create a <code>.plist</code> file under <code>~/Library/LaunchAgents</code> to load it properly each login.</p><p>To load it manually, you need to use <code>launchctl setenv TRILIUM_DATA_DIR <yourpath></code></p><p>Here is a pre-defined template, where you just need to add your path to:</p><pre><code class=\"language-text-xml\"><?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n <key>Label</key>\n <string>set.trilium.env</string>\n <key>RunAtLoad</key>\n <true/>\n <key>ProgramArguments</key>\n <array>\n <string>/bin/launchctl</string>\n <string>setenv</string>\n <string>TRILIUM_DATA_DIR</string>\n <string>/Users/YourUserName/Library/Application Support/trilium-data</string>\n </array>\n</dict>\n</plist>\n</code></pre></div></section></div><h3>Create a script to run with specific data directory</h3><p>An alternative to globally setting environment variable is to run only the Trilium Notes with this environment variable. This then allows for different setup styles like two <a href=\"#root/_help_wX4HbRucYSDD\">database</a> instances or \"portable\" installation.</p><p>To do this in Unix-based systems simply run <code>trilium</code> like this:</p><pre><code class=\"language-text-x-trilium-auto\">TRILIUM_DATA_DIR=/home/myuser/data/my-trilium-data trilium</code></pre><p>You can then save the above command as a shell script on your path for convenience.</p><h2>Electron user data directory (desktop only)</h2><p>When running the desktop application, Electron stores internal data (caches, spell-check dictionaries, session storage, etc.) separately from the Trilium data directory. By default this goes to the system's application data folder (e.g. <code>%APPDATA%</code> on Windows), which may be undesirable in corporate environments with roaming profiles or when running in portable mode.</p><p>To keep Electron data out of the system's roaming profile, set the <code>TRILIUM_ELECTRON_DATA_DIR</code> environment variable to an explicit path. The <code>trilium-portable</code> script does this automatically, pointing it to <code>trilium-electron-data/</code> next to the application.</p><h2>Fine-grained directory/path location</h2><p>Apart from the data directory, some of the subdirectories of it can be moved elsewhere by changing an environment variable:</p><figure class=\"table\"><table><thead><tr><th>Environment variable</th><th>Default value</th><th>Description</th></tr></thead><tbody><tr><td><code>TRILIUM_DOCUMENT_PATH</code></td><td><code>${TRILIUM_DATA_DIR}/document.db</code></td><td>Path to the <a class=\"reference-link\" href=\"#root/_help_wX4HbRucYSDD\">Database</a> (storing all notes and metadata).</td></tr><tr><td><code>TRILIUM_BACKUP_DIR</code></td><td><code>${TRILIUM_DATA_DIR}/backup</code></td><td>Directory where automated <a class=\"reference-link\" href=\"#root/_help_ODY7qQn5m2FT\">Backup</a> databases are stored.</td></tr><tr><td><code>TRILIUM_LOG_DIR</code></td><td><code>${TRILIUM_DATA_DIR}/log</code></td><td>Directory where daily <a class=\"reference-link\" href=\"#root/_help_bnyigUA2UK7s\">Backend (server) logs</a> are stored.</td></tr><tr><td><code>TRILIUM_TMP_DIR</code></td><td><code>${TRILIUM_DATA_DIR}/tmp</code></td><td>Directory where temporary files are stored (for example when opening in an external app).</td></tr><tr><td><code>TRILIUM_ANONYMIZED_DB_DIR</code></td><td><code>${TRILIUM_DATA_DIR}/anonymized-db</code></td><td>Directory where a <a class=\"reference-link\" href=\"#root/_help_x59R8J8KV5Bp\">Anonymized Database</a> is stored.</td></tr><tr><td><code>TRILIUM_RESOURCES_DIR</code></td><td><code>${TRILIUM_DATA_DIR}/resources</code></td><td>Directory where <a class=\"reference-link\" href=\"#root/_help_ebyr7ES2SwOW\">Downloaded resources</a> are stored, such as the speech recognition models.</td></tr><tr><td><code>TRILIUM_CONFIG_INI_PATH</code></td><td><code>${TRILIUM_DATA_DIR}/config.ini</code></td><td>Path to <a class=\"reference-link\" href=\"#root/_help_Gzjqa934BdH4\">Configuration (config.ini or environment variables)</a> file.</td></tr><tr><td><code>TRILIUM_ELECTRON_DATA_DIR</code></td><td>System appData</td><td>Directory for Electron internal data (caches, spell-check dictionaries, etc.). Set this in portable mode to avoid writing to the system profile (desktop only).</td></tr></tbody></table></figure>","_help_ebyr7ES2SwOW": "<p>Downloaded resources are large files that some features need but that do not ship with Trilium, such as the speech recognition models used to transcribe meetings. Trilium downloads them the first time a feature needs them, and keeps them on the device for later use.</p><p>Currently, only <a class=\"reference-link\" href=\"#root/_help_Y84QCbArmK3z\">Meeting transcription</a> on the desktop application uses downloaded resources:</p><figure class=\"table\"><table><thead><tr><th>Resource</th><th>Size</th><th>License</th><th>Used for</th></tr></thead><tbody><tr><td>Parakeet TDT 0.6B v3 (standard)</td><td>0.6 GB</td><td>CC-BY-4.0</td><td>Recognizing speech, with the <em>Standard</em> model.</td></tr><tr><td>Parakeet TDT 0.6B v3 (high accuracy)</td><td>2.4 GB</td><td>CC-BY-4.0</td><td>Recognizing speech, with the <em>High accuracy</em> model.</td></tr><tr><td>Silero VAD</td><td>0.6 MB</td><td>MIT</td><td>Detecting when someone speaks.</td></tr><tr><td>TitaNet</td><td>40 MB</td><td>Apache-2.0</td><td>Telling speakers apart, while <em>Identify speakers</em> is on.</td></tr></tbody></table></figure><h2>Downloading resources</h2><p>When a feature needs resources that are not on the device yet, Trilium asks before downloading them. The dialog lists each resource with what it is used for, where it is downloaded from, its license and its size, followed by the total download size and the free space on the disk.</p><ul><li>To start the download, press <em>Download</em>. Each resource shows its progress, and the feature continues once all of them are downloaded.</li><li>To stop the download, press <em>Cancel</em> or close the dialog. The files already downloaded are kept, and the next download continues where this one stopped, even within a large file.</li><li>If the disk does not have enough free space, the dialog says so and the download cannot be started.</li></ul><p>Every file is checked against a checksum built into Trilium before it is used, so a file that was damaged or altered during the download is discarded.</p><aside class=\"admonition note\"><p>Downloaded resources are not synchronized. Each device that uses a feature downloads its resources separately, even when the notes are kept in sync through <a class=\"reference-link\" href=\"#root/_help_cbkrhQjrkKrh\">Synchronization</a>.</p></aside><h2>Managing downloaded resources</h2><p>To see the downloaded resources, go to <a class=\"reference-link\" href=\"#root/_help_4TIF1oA4VQRO\">Options</a> → <em>Downloaded resources</em>. Each resource that was downloaded, or partly downloaded by an interrupted download, is listed with the space it takes on the disk and its status. Below the list, <em>Space used</em> shows the space they take in total, and how much free space is left on the disk.</p><ul><li>To open the folder of a resource, press the <span class=\"tn-icon bx bx-folder-open\"></span> button (desktop only).</li><li>To delete a resource, press the <span class=\"tn-icon bx bx-trash\"></span> button. If a feature needs it again, it is downloaded again.</li></ul><p>The list also shows, faded out, anything else in the resources folder:</p><ul><li><em>Older version</em>: the files of an earlier version of a resource. When a resource is updated, the new version is downloaded into a new folder, and the old one is left behind.</li><li><em>Not used</em>: a resource that no feature of this installation uses, for example one downloaded by a feature that was removed.</li><li><em>Unknown</em>: any other file or folder, for example one copied there by hand.</li></ul><p>These can be deleted in the same way.</p><aside class=\"admonition warning\"><p>If a server and a desktop application share the same data directory, a resource used by only one of them shows as <em>Not used</em> in the other. Deleting it there removes it for both.</p></aside><h2>Location</h2><p>The resources are stored in the <code>resources</code> folder of the <a class=\"reference-link\" href=\"#root/_help_tAassRL4RSQL\">Data directory</a>, one folder per resource. To store them elsewhere, set the <code>TRILIUM_RESOURCES_DIR</code> environment variable to another folder before starting Trilium.</p><h2>Installing without an Internet connection</h2><p>To install a resource on a device that cannot download it, copy its folder from the <code>resources</code> folder of a device that already has it into the same place on the other device. The next time a feature asks to download it, press <em>Download</em>: the files already in place are checked against their checksums and kept, and only the missing ones are downloaded.</p>","_help_x0JgW8UqGXvq": "<p>Trilium supports two different layouts, based on your preference.</p><h3>Vertical layout</h3><p>The vertical layout is Trilium's original layout:</p><ul><li>The <a class=\"reference-link\" href=\"#root/_help_xYmIYSP6wE3F\">Launch Bar</a> is positioned on the left side of the screen, with buttons being laid out vertically.</li><li>The tab bar is at the top, but to the right of the <a class=\"reference-link\" href=\"#root/_help_oPVyFC7WL2Lp\">Note Tree</a>.</li><li>The <a class=\"reference-link\" href=\"#root/_help_Ms1nauBra7gq\">Quick search</a> is at the top of the <a class=\"reference-link\" href=\"#root/_help_oPVyFC7WL2Lp\">Note Tree</a>.</li><li>The <a class=\"reference-link\" href=\"#root/_help_oPVyFC7WL2Lp\">Note Tree</a> can be collapsed by pressing the <span class=\"tn-icon bx bx-chevrons-left\"></span> button at the bottom of the <a class=\"reference-link\" href=\"#root/_help_xYmIYSP6wE3F\">Launch Bar</a>. While collapsed, it can be peeked temporarily above the content by pressing the strip on the right side of the <a class=\"reference-link\" href=\"#root/_help_xYmIYSP6wE3F\">Launch Bar</a>.</li><li>The <a class=\"reference-link\" href=\"#root/_help_x3i7MxGccDuM\">Global menu</a> can be accessed via the <span class=\"tn-icon cke cke-trilium\"></span> icon at the top of the <a class=\"reference-link\" href=\"#root/_help_xYmIYSP6wE3F\">Launch Bar</a>.</li></ul><p><img src=\"{{helpAssets}}/User%20Guide/Basic%20Concepts%20and%20Features/UI%20Elements/1_Vertical%20and%20horizontal%20layout_image.jpg\"></p><h3>Horizontal layout</h3><p>The horizontal layout is a more traditional layout, since it bears similarity with other applications. In this mode:</p><ul><li>The <a class=\"reference-link\" href=\"#root/_help_xYmIYSP6wE3F\">Launch Bar</a> is at the top of the screen, with the buttons laid horizontally.</li><li>The tab bar is at the top of the screen, but now covers the entirety of the width, allowing for more tabs to be displayed at once.</li><li>The <a class=\"reference-link\" href=\"#root/_help_Ms1nauBra7gq\">Quick search</a> is now part of the <a class=\"reference-link\" href=\"#root/_help_xYmIYSP6wE3F\">Launch Bar</a>. It can be moved around according to preference and even removed if needed.</li><li>The <a class=\"reference-link\" href=\"#root/_help_oPVyFC7WL2Lp\">Note Tree</a> can be collapsed by pressing the small <span class=\"tn-icon bx bx-sidebar\"></span> button to the left of the first tab. While collapsed, it can be peeked temporarily above the content by pressing the strip on the left edge of the app.</li><li>The <a class=\"reference-link\" href=\"#root/_help_x3i7MxGccDuM\">Global menu</a> can be accessed via the <span class=\"tn-icon bx bx-menu\"></span> button at the end of the <a class=\"reference-link\" href=\"#root/_help_xYmIYSP6wE3F\">Launch Bar</a>.</li></ul><p><img src=\"{{helpAssets}}/User%20Guide/Basic%20Concepts%20and%20Features/UI%20Elements/Vertical%20and%20horizontal%20layout_image.jpg\"></p><h2>Changing the layout</h2><p>Go to <a class=\"reference-link\" href=\"#root/_help_4TIF1oA4VQRO\">Options</a> and look for the <em>Appearance</em> option on the left. Then look for the <em>Layout</em> section, where there is the possibility to switch between the two available layouts.</p><p>Clicking an option will immediately apply the selected layout by reloading the window.</p>",- "_help_x3i7MxGccDuM": "<p>The global menu configures the current window (zoom, keeping the window on top) and offers access to some more advanced options.</p><p><img src=\"{{helpAssets}}/User%20Guide/Basic%20Concepts%20and%20Features/UI%20Elements/Global%20menu_image.jpg\"></p><h2>Accessing the global menu</h2><p>See <a href=\"#root/_help_x0JgW8UqGXvq\">Vertical and horizontal layout</a> since the position of the global menu is changed based on which layout has been selected.</p>",+ "_help_x3i7MxGccDuM": "<p>The global menu configures the current window (zoom, keeping the window on top), switches the theme and offers access to some more advanced options.</p><p><img src=\"{{helpAssets}}/User%20Guide/Basic%20Concepts%20and%20Features/UI%20Elements/Global%20menu_image.jpg\"></p><h2>Accessing the global menu</h2><p>See <a href=\"#root/_help_x0JgW8UqGXvq\">Vertical and horizontal layout</a> since the position of the global menu is changed based on which layout has been selected.</p><h2>Switching the theme</h2><p>The <em>Theme</em> submenu changes the look of the application without opening the <a class=\"reference-link\" href=\"#root/_help_4TIF1oA4VQRO\">Options</a>. A check mark at the end of a row shows the active choice.</p><ul><li>Under <em>Color scheme</em>, choose <em>System</em> to follow the light or dark mode of the operating system, or <em>Light</em> or <em>Dark</em> to use one regardless.</li><li>Under <em>Theme</em>, choose <em>Modern</em> (the default theme) or one of the custom themes, each shown with the icon of its note. Switching to <em>Modern</em> keeps the current color scheme.</li></ul><p>A custom theme brings its own colors, so the color schemes are unavailable while one is active. The legacy theme is not listed; select it from <a class=\"reference-link\" href=\"#root/_help_4TIF1oA4VQRO\">Options</a> → <em>Appearance</em> instead.</p><p>For more about the built-in and custom themes, see <a class=\"reference-link\" href=\"#root/_help_Wy267RK4M69c\">Themes</a>.</p>","_help_oPVyFC7WL2Lp": "<p>This page explains how to manipulate the note tree in TriliumNext, focusing on moving notes.</p><p><img src=\"{{helpAssets}}/User%20Guide/Basic%20Concepts%20and%20Features/UI%20Elements/Note%20Tree_image.jpg\"></p><h2>Drag and Drop</h2><p><img src=\"{{helpAssets}}/User%20Guide/Basic%20Concepts%20and%20Features/UI%20Elements/Note%20Tree_drag-and-drop.gif\" alt=\"Drag and drop example\"></p><p>You can easily rearrange the note tree by dragging and dropping notes, as demonstrated in the example above.</p><h3>Importing files</h3><p>A file or archive can easily be imported into Trilium just by dragging it inside the note tree.</p><p>Note that a drag & drop always imports with <em>safe import</em> on, meaning that some features such as scripts are disabled in the upcoming notes. To bypass that, use the dedicated <a href=\"#root/_help_mHbBMPDPkVV5\">import</a> feature (right click → <em>Import into note</em>).</p><p>Unlike the import dialog, the drag & drop also has some basic auto-detection of the import. For example, dragging a .zip file with a <code>.obsidian</code> folder in it will automatically trigger a dedicated <a class=\"reference-link\" href=\"#root/_help_iWD7wiIuMtgV\">Obsidian</a> import.</p><h2>Keyboard Manipulation</h2><p><img src=\"{{helpAssets}}/User%20Guide/Basic%20Concepts%20and%20Features/UI%20Elements/Note%20Tree_move-note-with-keyboard.gif\" alt=\"Example of using keyboard keys to move a note\">Trilium offers efficient keyboard-based manipulation using the following <a href=\"#root/_help_A9Oc6YKKc65v\">shortcuts</a>:</p><ul><li><kbd>Ctrl</kbd> + <kbd>↑</kbd> and <kbd>Ctrl</kbd> +<kbd>↓</kbd>: Move the note up or down in the order.</li><li><kbd>Ctrl</kbd>+<kbd>←</kbd>: Move the note up in the hierarchy by changing its parent to the note's grandparent.</li><li><kbd>Ctrl</kbd>+<kbd>→</kbd>: Move the note down in the hierarchy by setting its parent to the note currently above it (this action is best understood through a demo or hands-on experience).</li><li><kbd>←</kbd> and <kbd>→</kbd>: Expand and collapse a sub-tree.</li></ul><h2>Context Menu</h2><p>You can also move notes using the familiar cut and paste functions available in the context menu, or with the associated keyboard <a href=\"#root/_help_A9Oc6YKKc65v\">shortcuts</a>: <code>CTRL-C</code> ( <a href=\"#root/_help_IakOLONlIfGI\">copy</a>), <kbd>Ctrl</kbd> + <kbd>X</kbd> (cut) and <kbd>Ctrl</kbd> + <kbd>V</kbd> (paste).</p><p>See <a class=\"reference-link\" href=\"#root/_help_YtSN43OrfzaA\">Note tree contextual menu</a> for more information.</p><h2>Tree Settings</h2><p>Click the tree icon in the tree toolbar to open the tree settings popup. Each option is a toggle that takes effect as soon as it is switched:</p><ul><li><em>Hide archived notes</em>: When enabled, archived notes are not shown in the tree.</li><li><em>Automatically collapse notes</em>: When enabled, notes are collapsed after a period of inactivity to keep the tree tidy.</li><li><em>Follow active note</em>: When enabled (default), the tree automatically scrolls and expands parent nodes to keep the currently active note visible. When disabled, the tree is fully detached from navigation — only the background highlight of the active note is updated, but the tree viewport and its expanded/collapsed state are never changed by navigation. Use the crosshair button to manually jump the tree to the active note at any time.</li></ul><h2>Hiding and peeking the tree</h2><p>To hide or show the note tree, press the <span class=\"tn-icon bx bx-sidebar\"></span> button to the left of the first tab in the horizontal layout, or the <span class=\"tn-icon bx bx-chevrons-left\"></span> button at the bottom of the <a class=\"reference-link\" href=\"#root/_help_xYmIYSP6wE3F\">Launch Bar</a> in the vertical layout. The <em>Toggle Left Pane</em> <a href=\"#root/_help_A9Oc6YKKc65v\">keyboard shortcut</a>, which is not assigned by default, does the same. See <a class=\"reference-link\" href=\"#root/_help_x0JgW8UqGXvq\">Vertical and horizontal layout</a>.</p><p>A small strip with an arrow icon runs along the left edge of the app in the horizontal layout. In the vertical layout, it runs along the right side of the <a class=\"reference-link\" href=\"#root/_help_xYmIYSP6wE3F\">Launch Bar</a>, and only shows while the tree is hidden.</p><ul><li>When the tree is hidden, pressing the strip will <em>peek</em> the tree.<ul><li>In this mode the tree is shown temporarily above the content, without shifting the content of your notes.</li><li>Clicking outside the tree, pressing <kbd>Esc</kbd> or pressing the strip again will hide the tree.</li><li>Pressing the button that shows the tree will dock it.</li></ul></li><li>In the horizontal layout, pressing the strip while the tree is docked will hide it.</li></ul><p>The <em>Peek Tree Pane</em> <a href=\"#root/_help_A9Oc6YKKc65v\">keyboard shortcut</a>, <kbd>Alt</kbd>+<kbd>[</kbd> by default, does the same as pressing the strip. Only one panel is peeked at a time: peeking the tree hides a peeked <a class=\"reference-link\" href=\"#root/_help_RnaPdbciOfeq\">Right Sidebar</a>, and the other way around.</p><h2>Keyboard shortcuts</h2><p>The note tree comes with multiple keyboard shortcuts to make editing faster, consult the dedicated <a class=\"reference-link\" href=\"#root/_help_DvdZhoQZY9Yd\">Keyboard shortcuts</a> section.</p>","_help_YtSN43OrfzaA": "<figure class=\"image image-style-align-right\"><img style=\"aspect-ratio:269/608;\" src=\"{{helpAssets}}/User%20Guide/Basic%20Concepts%20and%20Features/UI%20Elements/Note%20Tree/1_Note%20tree%20contextual%20menu_image.png\" width=\"269\" height=\"608\"></figure><p>The <em>note tree menu</em> can be accessed by right-clicking in the <a class=\"reference-link\" href=\"#root/_help_oPVyFC7WL2Lp\">Note Tree</a>.</p><h2>Interaction</h2><p>The contextual menu can operate:</p><ul><li>On a single note, by right clicking it in the note tree.</li><li>On multiple notes, by selecting them first. See <a class=\"reference-link\" href=\"#root/_help_yTjUdsOi4CIE\">Multiple selection</a> on how to do so.<ul><li>When right clicking, do note that usually the note being right clicked is also included in the affected notes, regardless of whether it was selected or not.</li></ul></li></ul><h2>Available options</h2><aside class=\"admonition note\"><p>When multiple notes are selected, only a subset of notes will be active. The ones that do support multiple notes will mention this in the list below.</p></aside><p>The most frequent actions stand side by side at the top of the menu, each as an icon over its name. Use <kbd>←</kbd> and <kbd>→</kbd>, or <kbd>↑</kbd> and <kbd>↓</kbd>, to move between them.</p><ul><li><strong>Cut</strong><ul><li>Will place the given notes in clipboard.</li><li>Use one of the two paste functions (or the keyboard shortcuts) to move them to the desired location.</li></ul></li><li><strong>Clone</strong><ul><li>Will place the given notes in clipboard.</li><li>Use one of the two paste functions (or the keyboard shortcuts) to copy them to the desired location.</li><li>Note that the copy function here works according to the <a class=\"reference-link\" href=\"#root/_help_IakOLONlIfGI\">Cloning Notes</a> functionality (i.e. the note itself will be present in two locations at once, and editing it in one place will edit it everywhere).</li><li>To simply create a duplicate note that can be modified independently, look for <em>Duplicate</em>.</li></ul></li><li><strong>Paste into</strong><ul><li>Pastes the notes in clipboard as child notes of the right-clicked one.</li><li>Shown only after notes have been cut or cloned.</li></ul></li><li><strong>Paste after</strong><ul><li>Pastes the notes in clipboard underneath the right-clicked one.</li><li>Shown only after notes have been cut or cloned.</li></ul></li><li><strong>Delete…</strong><ul><li>Will delete the given notes, asking for confirmation first.</li><li>In the dialog, the following options can be configured:<ul><li><em>Delete also all clones</em> to ensure that the note will be deleted everywhere if it has been placed into multiple locations (see <a class=\"reference-link\" href=\"#root/_help_IakOLONlIfGI\">Cloning Notes</a>).</li><li><em>Erase notes permanently</em> will ensure that the note cannot be recovered from <a class=\"reference-link\" href=\"#root/_help_r5JGHN99bVKn\">Recent Changes</a>.</li></ul></li></ul></li></ul><p>The rest of the menu lists its options one per row:</p><ul><li><strong>Open note</strong><ul><li>Clicking it opens the note in a new <a href=\"#root/_help_3seOhtN8uLIY\">tab</a>.</li><li>Hovering it or clicking its arrow opens a submenu with the places the note can be opened in: <em>Open in a new tab</em>, <em>Open in a new split</em> (to the right of the note, within the current tab) and <em>Open in a new window</em>.</li></ul></li><li><strong>Quick edit</strong><ul><li>Opens the note in <a class=\"reference-link\" href=\"#root/_help_ZjLYv08Rp3qC\">Quick edit</a>, over the current one.</li></ul></li><li><strong>Hoist note</strong><ul><li>Will focus the note tree on this note. See <a class=\"reference-link\" href=\"#root/_help_OR8WJ7Iz9K4U\">Note Hoisting</a> for more information.</li></ul></li><li><strong>Insert note after</strong><ul><li>Allows easy creation of a note with a specified <a href=\"#root/_help_KSZ04uQ2D1St\">note type</a>.</li><li>The <em>Code</em> submenu starts with the scripting notes, each a code note set up for its role: <em>Custom CSS</em> (with <code>#appCss</code>), <em>Widget</em> (with <code>#widget</code> and a starting skeleton) and <em>Backend script</em>. The enabled code languages follow.</li><li><a class=\"reference-link\" href=\"#root/_help_GTwFsgaA0lCt\">Collections</a> are grouped in the <em>Collection</em> submenu. The note types created less often, the <a class=\"reference-link\" href=\"#root/_help_B2ORr7OVEZtc\">Snippets</a> and the AI quick action are in the <em>More</em> submenu.</li><li><a class=\"reference-link\" href=\"#root/_help_KC1HB96bqqHX\">Templates</a> will also be present (if any) at the end of the list.</li><li>To find an entry quickly, type into the search box at the top of the submenu, or just start typing while the submenu is open. The submenu then lists every matching entry, including those inside its own submenus (such as a code language or a collection), each with the submenu it comes from. Use <kbd>↑</kbd> and <kbd>↓</kbd> to pick a match, <kbd>Enter</kbd> to create it, and <kbd>Esc</kbd> to clear the search.</li><li>The note will be added on the same level of hierarchy as the note selected.</li></ul></li><li><strong>Insert child note</strong><ul><li>Same as <em>Insert note after</em>, but the note will be created as a child of the selected note.</li></ul></li><li><strong>Move to…</strong><ul><li>Will display a modal to specify where to move the desired notes.</li></ul></li><li><strong>Clone to…</strong><ul><li>Will display a modal to specify where to <a href=\"#root/_help_IakOLONlIfGI\">clone</a> the desired notes.</li></ul></li><li><strong>Duplicate</strong><ul><li>Creates a copy of the note and its descendants, placed right after the original.</li><li>When the note has child notes, the item also has an arrow, set apart by a divider. Hovering the item or clicking the arrow opens a submenu:<ul><li><em>Note and its children</em> does the same as clicking <em>Duplicate</em>.</li><li><em>This note only</em> copies the note with its content and attributes, but without any of its child notes. Links and relations to the original children keep pointing at them.</li></ul></li><li>This process is different from <a class=\"reference-link\" href=\"#root/_help_IakOLONlIfGI\">Cloning Notes</a> since the duplicated note can be edited independently from the original.</li><li>An alternative to this, if done regularly, would be <a class=\"reference-link\" href=\"#root/_help_KC1HB96bqqHX\">Templates</a>.</li></ul></li><li><strong>Archive/Unarchive</strong><ul><li>Marks a note as <a href=\"#root/_help_MKmLg5x6xkor\">archived</a>.</li><li>If the note is already archived, it will be unarchived instead.</li><li>Multiple notes can be selected as well. However, all the selected notes must be in the same state (archived or not), otherwise the option will be disabled.</li></ul></li><li><strong>Protect subtree/Unprotect subtree</strong><ul><li>On a note that is not protected, <em>Protect subtree</em> marks this note and all of its descendants as protected. On a protected note, the item reads <em>Unprotect subtree</em> and unprotects them instead. See <a class=\"reference-link\" href=\"#root/_help_bwg0e8ewQMak\">Protected Notes</a> for more information.</li><li>Hovering the item or clicking its arrow opens a submenu with both actions, for instance to unprotect the protected notes below a note that is not protected itself.</li></ul></li><li><strong>Import into note…</strong><ul><li>Opens the <a href=\"#root/_help_mHbBMPDPkVV5\">import</a> dialog and places the imported notes as child notes of the selected one.</li></ul></li><li><strong>Export…</strong><ul><li>Opens the <a href=\"#root/_help_mHbBMPDPkVV5\">export</a> dialog for the selected notes.</li></ul></li><li><strong>Search in subtree</strong><ul><li>Opens a full <a class=\"reference-link\" href=\"#root/_help_eIg8jdvaoNNd\">Search</a> with it preconfigured to only look into this note and its descendants (the <em>Ancestor</em> field).</li></ul></li></ul><h2>Advanced options</h2><figure class=\"image image-style-align-right\"><img style=\"aspect-ratio:231/263;\" src=\"{{helpAssets}}/User%20Guide/Basic%20Concepts%20and%20Features/UI%20Elements/Note%20Tree/Note%20tree%20contextual%20menu_image.png\" width=\"231\" height=\"263\"></figure><p>The advanced options menu offers some of the less frequently used actions for notes.</p><p>To access these options, first look for the <em>Advanced</em> option at the bottom of the contextual menu to reveal a sub-menu with:</p><ul><li><strong>Apply bulk actions…</strong><ul><li>Opens the <a class=\"reference-link\" href=\"#root/_help_ivYnonVFBxbQ\">Bulk Actions</a> dialog, to apply actions such as adding labels or moving notes to multiple notes at once (see <a class=\"reference-link\" href=\"#root/_help_yTjUdsOi4CIE\">Multiple selection</a>).</li></ul></li><li><strong>Edit branch prefix…</strong><ul><li>Opens a dialog to assign a name to be able to distinguish <a href=\"#root/_help_IakOLONlIfGI\">clones</a>, see <a class=\"reference-link\" href=\"#root/_help_TBwsyfadTA18\">Branch prefix</a> for more information.</li></ul></li><li><strong>Convert to attachment…</strong><ul><li>Converts the selected notes to <a class=\"reference-link\" href=\"#root/_help_0vhv7lsOLy82\">Attachments</a> of their parent notes.</li><li>This functional is most useful when dealing with image <a class=\"reference-link\" href=\"#root/_help_W8vYD3Q1zjCR\">File</a> notes that were imported from an external source or an older version of Trilium.</li></ul></li><li><strong>Expand subtree</strong><ul><li>Expands all the child notes in the <a class=\"reference-link\" href=\"#root/_help_oPVyFC7WL2Lp\">Note Tree</a>.</li></ul></li><li><strong>Collapse subtree</strong><ul><li>Collapses all the child notes in the note tree.</li></ul></li><li><strong>Sort by…</strong><ul><li>Opens a dialog to sort all the child notes of the selected note.</li><li>The sorting is done only once, there is an automatic sorting mechanism as well that can be set using <a class=\"reference-link\" href=\"#root/_help_zEY4DaJG4YT5\">Attributes</a>.</li><li>See <a class=\"reference-link\" href=\"#root/_help_aGlEvb9hyDhS\">Sorting Notes</a> for more information.</li></ul></li><li><strong>Copy note path to clipboard</strong><ul><li>Copies a URL fragment representing the full path to this branch for a note, such as <code>#root/Hb2E70L7HPuf/4sRFgMZhYFts/2IVuShedRJ3U/LJVMvKXOFv7n</code>.</li><li>The URL to manually create <a class=\"reference-link\" href=\"#root/_help_QEAPj01N5f7w\">Links</a> within notes, or for note <a class=\"reference-link\" href=\"#root/_help_wArbEsdSae6g\">Navigation</a>.</li></ul></li><li><strong>Recent changes in subtree</strong><ul><li>This will open <a class=\"reference-link\" href=\"#root/_help_r5JGHN99bVKn\">Recent Changes</a>, but filtered to only the changes related to this note or one of its descendants.</li></ul></li></ul>","_help_yTjUdsOi4CIE": "<p>In the <a class=\"reference-link\" href=\"#root/_help_oPVyFC7WL2Lp\">Note Tree</a>, it's possible to select multiple notes at one time. This won't affect the currently displayed note, but it allows to do batch operations.</p><h2>Types of multiple selection</h2><figure class=\"image image-style-align-right image_resized\" style=\"width:28.54%;\"><img style=\"aspect-ratio:335/306;\" src=\"{{helpAssets}}/User%20Guide/Basic%20Concepts%20and%20Features/UI%20Elements/Note%20Tree/Multiple%20selection_image.png\" width=\"335\" height=\"306\"></figure><h3>Selecting notes one by one</h3><p>To individually select each note, press the <kbd>Alt</kbd> key and click on the note to be selected.</p><p>The selected notes will be indicated via a different background color and an icon.</p><h3>Selecting notes in a sequence</h3><figure class=\"image image-style-align-right image_resized\" style=\"width:29.24%;\"><img style=\"aspect-ratio:233/205;\" src=\"{{helpAssets}}/User%20Guide/Basic%20Concepts%20and%20Features/UI%20Elements/Note%20Tree/Multiple%20selection_image.jpg\" width=\"233\" height=\"205\"></figure><p>When notes are in a sequence (e.g. one underneath the other), the entire selection can be made just by selecting the first and the last item instead of individually clicking all the notes.</p><p>To do so, first select the note to start the selection with. Then hold <kbd>Shift</kbd> and click on the note to end the selection with. All the notes between the start and the end note will be selected as well.</p><h2>Selected notes vs. active note</h2><p>There is a distinction between <em>selected notes</em> and the <em>active note</em>:</p><ul><li><em>Selected notes</em> are simply the notes that were selected in the multiple section process (i.e. either via <kbd>Alt</kbd> or <kbd>Shift</kbd>).</li><li>The <em>active note</em> is simply the note that whose content is being displayed to the right of the tree.<ul><li><p>Visually, it's identified in the tree by having a different background color and a subtle shadow.</p></li><li><p>The active note can also be selected case in which the icon and background will also change:</p><img class=\"image_resized\" style=\"aspect-ratio:317/223;width:35.1%;\" src=\"{{helpAssets}}/User%20Guide/Basic%20Concepts%20and%20Features/UI%20Elements/Note%20Tree/1_Multiple%20selection_image.png\" width=\"317\" height=\"223\"></li></ul></li></ul>",@@ -93,7 +93,7 @@"_help_xWtq5NUHOwql": "<figure class=\"image image-style-align-right image_resized\" style=\"width:50.46%;\"><img style=\"aspect-ratio:538/290;\" src=\"{{helpAssets}}/User%20Guide/Basic%20Concepts%20and%20Features/Navigation/Similar%20Notes_image.png\" width=\"538\" height=\"290\"></figure><p>The Similar Notes feature tries to identify notes that relate to the current note by looking at the content of the notes, their relationships, as well as the date they were created.</p><p>To access the list of similar notes:</p><ul><li>Go to the <a class=\"reference-link\" href=\"#root/_help_KRlZFoIH0j6p\">Connections tab</a> in the <a class=\"reference-link\" href=\"#root/_help_RnaPdbciOfeq\">Right Sidebar</a> and look for the corresponding section.</li><li>Alternatively, press the <span class=\"tn-icon bx bx-info-circle\"></span> in the <a class=\"reference-link\" href=\"#root/_help_AlJ73vBCjWDw\">Status bar</a> and select <em>Show similar notes</em> which will open a pane at the bottom.</li><li>On the <a class=\"reference-link\" href=\"#root/_help_RDslemsQ6gCp\">Mobile Frontend</a>, open the <a class=\"reference-link\" href=\"#root/_help_8YBEPzcpUgxw\">Note menu</a> → <em>Note info</em> and select <em>Show similar notes</em>.</li></ul><h2>Interaction</h2><ul><li>Hover over a note to see a short preview of the note.</li><li>Click over a note to open it in the current view.</li><li><kbd>Ctrl</kbd> + click a note to open it in a separate tab.</li></ul>","_help_McngOG2jbUWX": "<figure class=\"image image_resized\" style=\"width:100%;\"><img style=\"aspect-ratio:898/93;\" src=\"{{helpAssets}}/User%20Guide/Basic%20Concepts%20and%20Features/Navigation/Search%20in%20note_image.png\" width=\"898\" height=\"93\"></figure><p>Local search allows you to search within the currently displayed note. </p><h2>Alternatives</h2><ul><li>Pressing <kbd>Ctrl</kbd>+<kbd>F</kbd> while in a browser while not focused in a <a class=\"reference-link\" href=\"#root/_help_iPIMuisry3hd\">Text</a> or a <a class=\"reference-link\" href=\"#root/_help_6f9hih2hXXZk\">Code</a> note will trigger the browser's native search. This will also find text that is part of Trilium's UI.</li><li>Pressing <kbd>Ctrl</kbd>+<kbd>F</kbd> in a <a class=\"reference-link\" href=\"#root/_help_iPIMuisry3hd\">Text</a> note will reveal <a class=\"reference-link\" href=\"#root/_help_MI26XDLSAlCD\">CKEditor</a>'s search functionality.</li></ul><h2>Accessing the search</h2><ul><li>On desktop, press<kbd>Ctrl</kbd> + <kbd>F</kbd>.</li><li>From the <a class=\"reference-link\" href=\"#root/_help_8YBEPzcpUgxw\">Note menu</a>, select <em>Find</em> in the row of icons at the top.</li><li>In <a class=\"reference-link\" href=\"#root/_help_ZjLYv08Rp3qC\">Quick edit</a>, both open a search bar at the bottom of the popup, for the note in the popup.</li></ul><h2>Interaction</h2><ul><li>Finding:<ul><li>Fill in the <em>Find in text…</em> with the text to search for.</li><li>The search will be executed automatically in the background.</li><li>Use up and down arrows of the text box to navigate between results.</li></ul></li><li>Replacing:<ul><li>Fill in the <em>Find in text</em>… field with the text to replace.</li><li>Fill in the <em>Replace with…</em> field the text to replace it with.</li><li>Press <em>Replace</em> to replace only the current result.</li><li>Press <em>Replace all</em> to replace all of them at once.</li></ul></li><li>Options:<ul><li><em>Case sensitive</em> – the search will distinguish upper case characters from lower case (e.g. searching for Hello will not match <code>hello</code>).</li><li><em>Match words</em> - the search will find only exact word matches (e.g. searching for <code>Java</code> will not match <code>JavaScript</code>).</li></ul></li></ul><h2>Included notes</h2><p>In a <a class=\"reference-link\" href=\"#root/_help_iPIMuisry3hd\">Text</a> note, the search also finds the text of the notes included with <a class=\"reference-link\" href=\"#root/_help_nBAXQFj20hS1\">Include Note</a>, in the order they appear in the note.</p><ul><li>The text of included text and code notes and of embedded code files, such as a <code>.js</code> or <code>.txt</code> attachment, is searched. The title of an include and the content of other notes, such as a collection or a drawing, are not.</li><li>The up and down arrows move through the results of an include as through the rest of the note.</li><li>A result in a collapsed <em>Expandable</em> include expands the include while that result is the current one, and collapses it again once the search moves on.</li><li><em>Replace</em> and <em>Replace all</em> change an included note only while its <em>Editable</em> button is on. While the current result is in an include that cannot be edited, <em>Replace</em> is disabled, and <em>Replace all</em> leaves such results unchanged.</li></ul>","_help_A9Oc6YKKc65v": "<p>This is supposed to be a complete list of keyboard shortcuts. Note that some of these may work only in certain contexts (e.g. in tree pane or note editor).</p><h2>Configuring keyboard shortcuts</h2><p>It is also possible to configure most keyboard shortcuts in <a class=\"reference-link\" href=\"#root/_help_4TIF1oA4VQRO\">Options</a> → <em>Shortcuts</em>.</p><p>On the <a class=\"reference-link\" href=\"#root/_help_poXkQfguuA0U\">Desktop Installation</a>, it's also possible to make shortcuts global by pressing on the globe icon near the key combination, which makes the shortcut work even without Trilium being in focus.</p><h3>Keyboard layouts</h3><p>Shortcuts follow the characters printed on the keys of the active keyboard layout. On a French AZERTY keyboard, for example, <kbd>Ctrl</kbd>+<kbd>Z</kbd> is the key labeled Z.</p><p>On a layout that doesn't type Latin letters, such as Russian, Greek or Hebrew, a key that types a letter of that alphabet counts as the key at the same position on a US QWERTY keyboard. <kbd>Ctrl</kbd>+<kbd>J</kbd> is then the key that types <code>о</code> on a Russian keyboard, so shortcuts keep working without switching the layout first.</p><p>Keys that type punctuation still follow their own character. On a Russian keyboard, the key that types <code>.</code> triggers <kbd>Ctrl</kbd>+<kbd>.</kbd>, not the shortcut of the US key at its position.</p><h2>Shortcut reference</h2><aside class=\"admonition note\"><p>All these shortcuts indicate the default key-bindings which can be changed individually from <a class=\"reference-link\" href=\"#root/_help_4TIF1oA4VQRO\">Options</a> → <em>Shortcuts.</em></p></aside><h3>Tree</h3><p>See the corresponding section: <a class=\"reference-link\" href=\"#root/_help_DvdZhoQZY9Yd\">Keyboard shortcuts</a></p><h3>Note navigation</h3><ul><li><kbd>Alt</kbd>+<kbd>←</kbd>, <kbd>Alt</kbd>+<kbd>→</kbd> – go back / forwards in the history</li><li><kbd>Ctrl</kbd>+<kbd>J</kbd> – show <a href=\"#root/_help_MMiBEQljMQh2\">\"Jump to\" dialog</a></li><li><kbd>Ctrl</kbd>+<kbd>.</kbd> – scroll to current note (useful when you scroll away from your note or your focus is currently in the editor)</li><li><kbd>Backspace</kbd> – jumps to parent note</li><li><kbd>Alt</kbd>+<kbd>C</kbd> – collapse whole note tree</li><li><kbd>Alt</kbd>+<kbd>-</kbd> (alt with minus sign) – collapse subtree (if some subtree takes too much space on tree pane you can collapse it)</li><li>you can define a <a href=\"#root/_help_zEY4DaJG4YT5\">label</a> <code>#keyboardShortcut</code> with e.g. value <code>Ctrl + I</code> . Pressing this keyboard combination will then bring you to the note on which it is defined. Note that Trilium must be reloaded/restarted (<kbd>Ctrl</kbd>+<kbd>R</kbd> ) for changes to be in effect.</li></ul><p>See demo of some of these features in <a href=\"#root/_help_MMiBEQljMQh2\">note navigation</a>.</p><h3>Tabs</h3><ul><li><kbd>Ctrl</kbd> + <kbd>🖱 Left click</kbd> – (or middle mouse click) on note link opens note in a new tab</li></ul><p>Only in desktop (electron build):</p><ul><li><kbd>Ctrl</kbd>+<kbd>T</kbd> – opens empty tab</li><li><kbd>Ctrl</kbd>+<kbd>W</kbd> – closes active tab</li><li><kbd>Ctrl</kbd>+<kbd>Tab</kbd> – activates next tab</li><li><kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>Tab</kbd> – activates previous tab</li></ul><h3>Splits</h3><p><a class=\"reference-link\" href=\"#root/_help_luNhaphA37EO\">Split View</a> can also be controlled through keyboard actions, such as:</p><ul><li>Creating a new split</li><li>Closing the active split</li><li>Moving a split left/right</li><li>Focusing the split to the left/right.</li></ul><p>All these keyboard shortcuts do not have a default set, go to <a class=\"reference-link\" href=\"#root/_help_4TIF1oA4VQRO\">Options</a> → <em>Shortcuts</em> and look for the <em>Split View</em> category.</p><h3>Context menus</h3><p>Every context menu can be operated from the keyboard, however it was opened, for example with the <kbd>Menu</kbd> key in a text note to reach the spelling suggestions. These keys are fixed and cannot be changed in the options.</p><ul><li><kbd>↑</kbd>, <kbd>↓</kbd> – move to the previous / next item, skipping disabled ones and wrapping around at either end</li><li><kbd>Home</kbd>, <kbd>End</kbd> – move to the first / last item</li><li><kbd>→</kbd> – open the submenu of the current item, or move to the next column in a submenu laid out in columns</li><li><kbd>←</kbd> – move to the previous column, or close the submenu and go back to its item</li><li><kbd>Enter</kbd> or <kbd>Space</kbd> – run the current item, or open its submenu</li><li><kbd>Esc</kbd> – close the innermost submenu, then the menu itself</li><li>typing the first letters of an item – jump to the next item whose title starts with them</li></ul><p>With a right-to-left language, <kbd>←</kbd> and <kbd>→</kbd> swap roles.</p><h3>Creating notes</h3><ul><li><kbd>Ctrl</kbd>+<kbd>O</kbd> – creates new note after the current note</li><li><kbd>Ctrl</kbd>+<kbd>P</kbd> – creates new sub-note into current note</li><li><kbd>F2</kbd> – edit the <a class=\"reference-link\" href=\"#root/_help_TBwsyfadTA18\">Branch prefix</a> of current note clone</li></ul><h3>Editing notes</h3><aside class=\"admonition note\"><p>For keyboard shortcuts specific to <a class=\"reference-link\" href=\"#root/_help_iPIMuisry3hd\">Text</a> notes, refer to <a class=\"reference-link\" href=\"#root/_help_oiVPnW8QfnvS\">Keyboard shortcuts</a> and <a class=\"reference-link\" href=\"#root/_help_QrtTYPmdd1qq\">Markdown-like formatting</a>.</p></aside><ul><li>Enter in tree pane switches from tree pane into note title. Enter from note title switches focus to text editor. <kbd>Ctrl</kbd>+<kbd>.</kbd> switches back from editor to tree pane.</li><li><kbd>Ctrl</kbd>+<kbd>.</kbd> – jump away from the editor to tree pane and scroll to current note</li></ul><h3>Runtime shortcuts</h3><p>These are hooked in Electron to be similar to native browser keyboard shortcuts.</p><ul><li><kbd>F5</kbd>, <kbd>Ctrl</kbd>+<kbd>R</kbd> – reloads Trilium front-end</li><li><kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>I</kbd> – show developer tools</li><li><kbd>Ctrl</kbd>+<kbd>F</kbd> – show search dialog</li><li><kbd>Ctrl</kbd>+<kbd>-</kbd> – zoom out</li><li><kbd>Ctrl</kbd>+<kbd>=</kbd> – zoom in</li></ul><h3>Other</h3><ul><li><kbd>Alt</kbd>+<kbd>O</kbd> – show SQL console (use only if you know what you're doing)</li><li><kbd>Alt</kbd>+<kbd>M</kbd> – distraction-free mode - display only note editor, everything else is hidden</li><li><kbd>F11 </kbd> – toggle full screen</li><li><kbd>Ctrl</kbd>+<kbd>S</kbd> – toggle <a href=\"#root/_help_eIg8jdvaoNNd\">search</a> form in tree pane</li><li><kbd>Alt</kbd>+<kbd>A</kbd> – show note <a href=\"#root/_help_zEY4DaJG4YT5\">attributes</a> dialog</li></ul>",- "_help_Wy267RK4M69c": "<h2>Default Themes</h2><p>Trilium comes with a couple pre-installed color themes, with the default being a light theme. To switch to a dark theme or any other available theme, navigate to the <span class=\"tn-icon bx bx-cog\"></span> Options menu (accessible via the app icon in the top-left corner), select the Appearance tab, and choose your preferred theme.</p><p><img src=\"{{helpAssets}}/User%20Guide/Basic%20Concepts%20and%20Features/Themes_dark-theme.png\" alt=\"Dark Theme\"></p><p>While a dark theme is active, Trilium asks the Dark Reader browser extension not to darken the page a second time. Dark Reader still darkens the light themes. After switching from a dark theme to a light one, reload the page (<kbd>Ctrl</kbd>+<kbd>R</kbd>) for Dark Reader to take effect again.</p><h2>Creating Custom CSS Themes</h2><p>Trilium supports custom user themes, allowing you to personalize the application's appearance. To create a custom theme, follow these steps:</p><ol><li><strong>Create a CSS Code Note</strong>: Start by creating a new <a href=\"#root/_help_6f9hih2hXXZk\">code note</a> with the <code>CSS</code> type.</li><li><strong>Annotate with</strong> <code>#appTheme</code>: Add the <a href=\"#root/_help_zEY4DaJG4YT5\">attribute</a> <code>#appTheme=my-theme-name</code> to your note, where <code>my-theme-name</code> is the name of your custom theme.</li><li><strong>Define Your Styles</strong>: Write your custom CSS within the note.</li></ol><details class=\"trilium-collapsible\" open=\"\"><summary>Example of a custom theme</summary><pre><code class=\"language-text-x-trilium-auto\">@font-face {\n font-family: 'Raleway';\n font-style: normal;\n font-weight: 400;\n src: url('/custom/fonts/raleway.woff2') format('woff2');\n}\n\n:root {\n --main-font-family: 'Raleway' !important;\n --main-font-size: normal;\n --tree-font-family: inherit;\n --tree-font-size: normal;\n --detail-font-family: inherit;\n --detail-font-size: normal;\n --detail-text-font-family: 'Garamond' !important;\n\n --main-background-color: #404552;\n --main-text-color: #AFB8C6;\n --main-border-color: #AFB8C6;\n --accented-background-color: #383C4A;\n --more-accented-background-color: #2F343F;\n --header-background-color: #383C4A;\n --button-background-color: #2F343F;\n --button-disabled-background-color: #404552;\n --button-border-color: #333;\n --button-text-color: #AFB8C6;\n --button-border-radius: 2px;\n --primary-button-background-color: #6c757d;\n --primary-button-text-color: white;\n --primary-button-border-color: #6c757d;\n --muted-text-color: #86919F;\n --input-text-color: #AFB8C6;\n --input-background-color: #404552;\n --hover-item-text-color: white;\n --hover-item-background-color: #4877B1;\n --active-item-text-color: white;\n --active-item-background-color: #4877B1;\n --menu-text-color: #AFB8C6;\n --menu-background-color: #383C4A;\n --tooltip-background-color: #383C4A;\n --link-color: lightskyblue;\n --modal-background-color: #404552;\n --modal-backdrop-color: black;\n --scrollbar-border-color: rgba(175, 184, 198, 0.5);\n}\n\nbody .note-detail-text {\n font-size: 120%;\n}\n\nbody .CodeMirror {\n filter: invert(100%) hue-rotate(180deg);\n}</code></pre><p> </p></details><p> </p><h3>Activating Your Custom Theme</h3><p>Once you've created your custom theme:</p><ol><li>Go to \"Menu\" -> \"Options\" (<span class=\"tn-icon bx bx-cog\"></span>) -> \"Appearance.\"</li><li>In the theme selection dropdown, you should see your custom theme listed under the name you provided with the <code>#appTheme</code> <a href=\"#root/_help_zEY4DaJG4YT5\">label</a>.</li><li>Select your custom theme to activate it.</li></ol><p>If you make changes to your theme, press Ctrl + R to reload the frontend and apply your updates.</p><h3>Sharing and Importing Themes</h3><p>Custom themes can be exported as <code>.tar</code> archives, which can be shared with other users. However, be cautious when importing themes from untrusted sources, as they may contain executable scripts that could pose security risks.</p><p>An example user theme, <em>Steel Blue</em>, is available in the demo document.</p><p><img src=\"{{helpAssets}}/User%20Guide/Basic%20Concepts%20and%20Features/Themes_steel-blue.png\" alt=\"Steel Blue Theme\"></p><h3>Using Custom CSS for Specific Purposes</h3><p>In addition to full themes, Trilium allows for custom CSS that isn't tied to a theme. This can be particularly useful in scripting contexts, where you might want to modify specific UI elements, such as changing the colors of notes in the tree view.</p><h3>Applying Custom CSS</h3><p>To use custom CSS:</p><ol><li><strong>Create a CSS Code Note</strong>: Create a new <a class=\"reference-link\" href=\"#root/_help_6f9hih2hXXZk\">Code</a> note with the <code>CSS</code> type.</li><li><strong>Add the</strong> <code>appCss</code> <strong>Label</strong>: Annotate the note with the <code>#appCss</code> <a href=\"#root/_help_zEY4DaJG4YT5\">label</a>.</li><li><strong>Write Your CSS</strong>: Add your custom CSS rules to the note.</li></ol><p>For example:</p><pre><code class=\"language-text-x-trilium-auto\">/* Custom CSS to style specific elements */\n.tree-item {\n color: #ff6347; /* Change tree item color */\n}</code></pre><p>When Trilium's frontend starts, all notes labeled with <code>appCss</code> are automatically included in the style element of the HTML page.</p><p>After making changes, press Ctrl + R to reload the frontend and apply your new styles.</p><p><img src=\"{{helpAssets}}/User%20Guide/Basic%20Concepts%20and%20Features/Themes_image.jpg\"></p><h3>Styling Specific Notes in the Tree</h3><p>To apply specific styles to certain notes in the tree:</p><ul><li><strong>Use the</strong> <code>cssClass</code> <strong>Attribute</strong>: Add the <code>cssClass</code> <a href=\"#root/_help_zEY4DaJG4YT5\">attribute</a> to a note, and assign it a value representing the desired CSS class.</li><li><strong>Define an</strong> <code>iconClass</code>: You can also define a custom icon for a note using the <code>iconClass</code> attribute, selecting from <a href=\"https://boxicons.com\">Box Icons</a> or your own custom classes.</li></ul><p>For example, if you want to style notes of a specific type, such as notes containing PNG images, you can target them with classes like <code>type-image mime-image-png</code>.</p><h3>User-Provided Themes</h3><p>A gallery of user-created themes is available, showcasing the variety of customizations that the Trilium community has developed. For more information, check the <a class=\"reference-link\" href=\"#root/_help_VbjZvtUek0Ln\">Theme Gallery</a>.</p><h3>Asset Path Management</h3><p>When referencing built-in assets like images in your custom themes or CSS, you can avoid hardcoding version numbers by using the <code>vX</code> alias. For example, instead of specifying <code>/assets/v0.57.0-beta/images/icon-grey.png</code>, you can use <code>/assets/vX/images/icon-grey.png</code> to keep your theme compatible with future versions of Trilium.</p>",+ "_help_Wy267RK4M69c": "<h2>Default Themes</h2><p>Trilium comes with a couple pre-installed color themes, with the default being a light theme. To switch to a dark theme or any other available theme, navigate to the <span class=\"tn-icon bx bx-cog\"></span> Options menu (accessible via the app icon in the top-left corner), select the Appearance tab, and choose your preferred theme. The <em>Theme</em> submenu of the <a class=\"reference-link\" href=\"#root/_help_x3i7MxGccDuM\">Global menu</a> switches the theme and the color scheme as well.</p><p><img src=\"{{helpAssets}}/User%20Guide/Basic%20Concepts%20and%20Features/Themes_dark-theme.png\" alt=\"Dark Theme\"></p><p>While a dark theme is active, Trilium asks the Dark Reader browser extension not to darken the page a second time. Dark Reader still darkens the light themes. After switching from a dark theme to a light one, reload the page (<kbd>Ctrl</kbd>+<kbd>R</kbd>) for Dark Reader to take effect again.</p><h2>Creating Custom CSS Themes</h2><p>Trilium supports custom user themes, allowing you to personalize the application's appearance. To create a custom theme, follow these steps:</p><ol><li><strong>Create a CSS Code Note</strong>: Start by creating a new <a href=\"#root/_help_6f9hih2hXXZk\">code note</a> with the <code>CSS</code> type.</li><li><strong>Annotate with</strong> <code>#appTheme</code>: Add the <a href=\"#root/_help_zEY4DaJG4YT5\">attribute</a> <code>#appTheme=my-theme-name</code> to your note, where <code>my-theme-name</code> is the name of your custom theme.</li><li><strong>Define Your Styles</strong>: Write your custom CSS within the note.</li></ol><details class=\"trilium-collapsible\" open=\"\"><summary>Example of a custom theme</summary><pre><code class=\"language-text-x-trilium-auto\">@font-face {\n font-family: 'Raleway';\n font-style: normal;\n font-weight: 400;\n src: url('/custom/fonts/raleway.woff2') format('woff2');\n}\n\n:root {\n --main-font-family: 'Raleway' !important;\n --main-font-size: normal;\n --tree-font-family: inherit;\n --tree-font-size: normal;\n --detail-font-family: inherit;\n --detail-font-size: normal;\n --detail-text-font-family: 'Garamond' !important;\n\n --main-background-color: #404552;\n --main-text-color: #AFB8C6;\n --main-border-color: #AFB8C6;\n --accented-background-color: #383C4A;\n --more-accented-background-color: #2F343F;\n --header-background-color: #383C4A;\n --button-background-color: #2F343F;\n --button-disabled-background-color: #404552;\n --button-border-color: #333;\n --button-text-color: #AFB8C6;\n --button-border-radius: 2px;\n --primary-button-background-color: #6c757d;\n --primary-button-text-color: white;\n --primary-button-border-color: #6c757d;\n --muted-text-color: #86919F;\n --input-text-color: #AFB8C6;\n --input-background-color: #404552;\n --hover-item-text-color: white;\n --hover-item-background-color: #4877B1;\n --active-item-text-color: white;\n --active-item-background-color: #4877B1;\n --menu-text-color: #AFB8C6;\n --menu-background-color: #383C4A;\n --tooltip-background-color: #383C4A;\n --link-color: lightskyblue;\n --modal-background-color: #404552;\n --modal-backdrop-color: black;\n --scrollbar-border-color: rgba(175, 184, 198, 0.5);\n}\n\nbody .note-detail-text {\n font-size: 120%;\n}\n\nbody .CodeMirror {\n filter: invert(100%) hue-rotate(180deg);\n}</code></pre><p> </p></details><p> </p><h3>Activating Your Custom Theme</h3><p>Once you've created your custom theme:</p><ol><li>Go to \"Menu\" -> \"Options\" (<span class=\"tn-icon bx bx-cog\"></span>) -> \"Appearance.\"</li><li>In the theme selection dropdown, you should see your custom theme listed under the name you provided with the <code>#appTheme</code> <a href=\"#root/_help_zEY4DaJG4YT5\">label</a>.</li><li>Select your custom theme to activate it.</li></ol><p>Your custom theme is also listed under <a class=\"reference-link\" href=\"#root/_help_x3i7MxGccDuM\">Global menu</a> → <em>Theme</em>, with the icon of its note.</p><p>If you make changes to your theme, press Ctrl + R to reload the frontend and apply your updates.</p><h3>Sharing and Importing Themes</h3><p>Custom themes can be exported as <code>.tar</code> archives, which can be shared with other users. However, be cautious when importing themes from untrusted sources, as they may contain executable scripts that could pose security risks.</p><p>An example user theme, <em>Steel Blue</em>, is available in the demo document.</p><p><img src=\"{{helpAssets}}/User%20Guide/Basic%20Concepts%20and%20Features/Themes_steel-blue.png\" alt=\"Steel Blue Theme\"></p><h3>Using Custom CSS for Specific Purposes</h3><p>In addition to full themes, Trilium allows for custom CSS that isn't tied to a theme. This can be particularly useful in scripting contexts, where you might want to modify specific UI elements, such as changing the colors of notes in the tree view.</p><h3>Applying Custom CSS</h3><p>To use custom CSS:</p><ol><li><strong>Create a CSS Code Note</strong>: Create a new <a class=\"reference-link\" href=\"#root/_help_6f9hih2hXXZk\">Code</a> note with the <code>CSS</code> type.</li><li><strong>Add the</strong> <code>appCss</code> <strong>Label</strong>: Annotate the note with the <code>#appCss</code> <a href=\"#root/_help_zEY4DaJG4YT5\">label</a>.</li><li><strong>Write Your CSS</strong>: Add your custom CSS rules to the note.</li></ol><p>For example:</p><pre><code class=\"language-text-x-trilium-auto\">/* Custom CSS to style specific elements */\n.tree-item {\n color: #ff6347; /* Change tree item color */\n}</code></pre><p>When Trilium's frontend starts, all notes labeled with <code>appCss</code> are automatically included in the style element of the HTML page.</p><p>After making changes, press Ctrl + R to reload the frontend and apply your new styles.</p><p><img src=\"{{helpAssets}}/User%20Guide/Basic%20Concepts%20and%20Features/Themes_image.jpg\"></p><h3>Styling Specific Notes in the Tree</h3><p>To apply specific styles to certain notes in the tree:</p><ul><li><strong>Use the</strong> <code>cssClass</code> <strong>Attribute</strong>: Add the <code>cssClass</code> <a href=\"#root/_help_zEY4DaJG4YT5\">attribute</a> to a note, and assign it a value representing the desired CSS class.</li><li><strong>Define an</strong> <code>iconClass</code>: You can also define a custom icon for a note using the <code>iconClass</code> attribute, selecting from <a href=\"https://boxicons.com\">Box Icons</a> or your own custom classes.</li></ul><p>For example, if you want to style notes of a specific type, such as notes containing PNG images, you can target them with classes like <code>type-image mime-image-png</code>.</p><h3>User-Provided Themes</h3><p>A gallery of user-created themes is available, showcasing the variety of customizations that the Trilium community has developed. For more information, check the <a class=\"reference-link\" href=\"#root/_help_VbjZvtUek0Ln\">Theme Gallery</a>.</p><h3>Asset Path Management</h3><p>When referencing built-in assets like images in your custom themes or CSS, you can avoid hardcoding version numbers by using the <code>vX</code> alias. For example, instead of specifying <code>/assets/v0.57.0-beta/images/icon-grey.png</code>, you can use <code>/assets/vX/images/icon-grey.png</code> to keep your theme compatible with future versions of Trilium.</p>","_help_VbjZvtUek0Ln": "<p>These are user-created themes which were made publicly available:</p><h2>Legacy Themes</h2><p>These themes may or may not be compatible with the latest versions of TriliumNext and are based on the original/legacy theme.</p><figure class=\"table\"><table><thead><tr><th>Theme</th><th>Author</th></tr></thead><tbody><tr><td><a href=\"https://github.com/tobealive/trilium-midnight-theme\">Midnight</a></td><td><a href=\"https://github.com/tobealive\">tobealive</a></td></tr><tr><td><a href=\"https://github.com/tobealive/trilum-eote-theme\">EOTE</a></td><td><a href=\"https://github.com/tobealive\">tobealive</a></td></tr><tr><td><a href=\"https://github.com/Abourass/TriliumThemes\">Trilium Themes</a></td><td><a href=\"https://github.com/Abourass\">Abourass</a></td></tr><tr><td><a href=\"https://github.com/ZMonk91/Material-Dark-Trilium\">MaterialDark</a></td><td><a href=\"https://github.com/ZMonk91\">ZMonk91</a></td></tr><tr><td><a href=\"https://github.com/jaroet/trilium-theme-lightslategray\">lightslategray</a></td><td><a href=\"https://github.com/jaroet\">jaroet</a></td></tr><tr><td><a href=\"https://github.com/raphwriter/trilium-theme-melon\">melon-4</a></td><td><a href=\"https://github.com/raphwriter\">raphwriter</a></td></tr><tr><td><a href=\"https://github.com/Engr-AllanG/trilium-themes\">Neon_Dark</a></td><td><a href=\"https://github.com/Engr-AllanG\">Engr-AllanG</a></td></tr><tr><td><a href=\"https://github.com/Engr-AllanG/trilium-themes\">Coder_Dark</a></td><td><a href=\"https://github.com/Engr-AllanG\">Engr-AllanG</a></td></tr><tr><td><a href=\"https://github.com/idelem/trilium-theme-velvet\">velvet</a></td><td><a href=\"https://github.com/idelem\">idelem</a></td></tr><tr><td><a href=\"https://github.com/SADAVA/trilium-notes-theme-dark-plus\">Dark Plus</a></td><td><a href=\"https://github.com/SADAVA\">SADAVA</a></td></tr><tr><td><a href=\"https://github.com/WKSu/trilium-solarized-theme\">Solarized</a></td><td><a href=\"https://github.com/WKSu\">WKSu</a></td></tr><tr><td><a href=\"https://github.com/en3r0/Trilium-Nord-Theme\">Nord</a></td><td><a href=\"https://github.com/en3r0\">en3r0</a></td></tr><tr><td><a href=\"https://github.com/AllanZyne/trilium-bear-theme\">Bear Note Light</a></td><td><a href=\"https://github.com/AllanZyne\">AllanZyne</a></td></tr><tr><td><a href=\"https://github.com/AllanZyne/trilium-bear-theme\">Bear Note Dark</a></td><td><a href=\"https://github.com/AllanZyne\">AllanZyne</a></td></tr><tr><td><a href=\"https://github.com/Sebiann/miku-hatsune-trilium-theme\">Miku Hatsune</a></td><td><a href=\"https://github.com/Sebiann\">Sebiann</a></td></tr><tr><td><a href=\"https://github.com/cwilliams5/Midnight-Trilium-Dark-Mode\">Midnight</a></td><td><a href=\"https://github.com/cwilliams5\">cwilliams5</a></td></tr><tr><td><a href=\"https://github.com/SiriusXT/trilium-theme-blue\">Blue</a> (light)</td><td><a href=\"https://github.com/SiriusXT\">SiriusXT</a></td></tr><tr><td><a href=\"https://github.com/SiriusXT/trilium-theme-blue\">Blue</a> (dark)</td><td><a href=\"https://github.com/SiriusXT\">SiriusXT</a></td></tr></tbody></table></figure><aside class=\"admonition tip\"><p>If you would like to add your theme to this gallery, write a new post in <a href=\"https://github.com/TriliumNext/Trilium/discussions/categories/show-and-tell\">👐 Show and tell</a>.</p></aside>","_help_gOKqSJgXLcIj": "<figure class=\"image image-style-align-right image_resized\" style=\"width:45.14%;\"><img style=\"aspect-ratio:854/649;\" src=\"{{helpAssets}}/User%20Guide/Basic%20Concepts%20and%20Features/Themes/Icon%20Packs_image.png\" width=\"854\" height=\"649\"></figure><p>By default, Trilium comes with a set of icons called Boxicons v2. Since v0.102.0, custom icon packs allow a wider selection of icons for notes.</p><p>Icon packs are specific to Trilium, so they must either be created from scratch (see below) or imported from a ZIP file from a third-party developer.</p><h2>Sample icon packs</h2><p>The Trilium team maintains a few icon packs that are not shipped with Trilium. These icon packs can be found on the official website on the <a href=\"https://triliumnotes.org/resources\">Resources page</a>.</p><h2>Importing an existing icon pack</h2><aside class=\"admonition note\"><p><strong>Icon packs are third-party content</strong></p><p>Apart from the <a href=\"https://triliumnotes.org/resources\">sample icon packs</a>, the Trilium maintainers are not responsible for keeping icon packs up to date. If you have an issue with a specific icon pack, then the issue must be reported to the third-party developer responsible for it, not the Trilium team.</p></aside><p>To import an icon pack:</p><ol><li>Ideally, create a dedicated spot in your note tree where to place the icon packs.</li><li>Right click the note where to put it and select <em>Import into note</em>.</li><li>Uncheck <em>Safe import</em>.</li><li>Select <em>Import</em>.</li><li><a href=\"#root/_help_s8alTXmpFR61\">Refresh the application</a>.</li></ol><aside class=\"admonition warning\"><p>Since <em>Safe import</em> is disabled, make sure you trust the source as it could contain dangerous third-party scripts. One good way to check if the icon pack is safe is to manually extract the .zip and inspect the file contents. Icon packs should only contain a font file and a JSON file. Other files (especially scripts) are to be considered harmful.</p></aside><h2>Creating an icon pack</h2><p>Creating an icon pack requires some scripting knowledge outside Trilium in order to generate the list of icons. For information, see <a class=\"reference-link\" href=\"#root/_help_g1mlRoU8CsqC\">Creating an icon pack</a>.</p><h2>Using an icon from an icon pack</h2><p>After <a href=\"#root/_help_s8alTXmpFR61\">refreshing the application</a>, the icon pack should be enabled by default. To test this, simply select an existing note or create a new one and try to change the note icon.</p><p>There should be a <em>Filter</em> button to the right of the search bar in the icon list. Clicking it allows filtering by icon pack and the newly imported icon pack should be displayed there.</p><aside class=\"admonition note\"><p>If the icon pack is missing from that list, then most likely there's something wrong with it.</p><ul><li>Try checking the <a class=\"reference-link\" href=\"#root/_help_bnyigUA2UK7s\">Backend (server) logs</a> for clues and make sure that the icon pack has the <code>#iconPack</code> <a href=\"#root/_help_HI6GBBIduIgv\">label</a> with a value assigned to it (a prefix).</li><li>Icon packs that are <a href=\"#root/_help_bwg0e8ewQMak\">protected</a> are ignored.</li></ul></aside><h2>Integration with the share and export functionality</h2><p>Custom icon packs are also supported by the <a class=\"reference-link\" href=\"#root/_help_R9pX4DGra2Vt\">Sharing</a> feature, where they will be shown in the note tree. However, in order for an icon pack to be visible to the share function, the icon pack note must also be shared.</p><p>If you are using a custom share theme, make sure it supports the <code>iconPackCss</code>, otherwise icons will not show up. Check the original share template source code for reference.</p><p>Custom icon packs will also be preserved when <a class=\"reference-link\" href=\"#root/_help_ycBFjKrrwE9p\">Exporting static HTML for web publishing</a>. In this case, there's no requirement to make the icon pack shared.</p><h2>What happens if I remove an icon pack</h2><p>If an icon pack is removed or disabled (by removing or altering its <code>#iconPack</code> label), all the notes that use this icon pack will show in the <a class=\"reference-link\" href=\"#root/_help_oPVyFC7WL2Lp\">Note Tree</a> with no icon. This won't cause any issues apart from looking strange.</p><p>The solution is to replace the icons with some else, try using <a class=\"reference-link\" href=\"#root/_help_eIg8jdvaoNNd\">Search</a> which supports bulk actions, to identify the notes with the now deleted icon pack (by looking for the prefix) and changing or removing their <code>iconClass</code>.</p>","_help_w4rMEhJsALlA": "<h2>Using different fonts</h2><p>Trilium comes by default with its own font (<em>Inter</em>), but the font can be adjusted in <a class=\"reference-link\" href=\"#root/_help_4TIF1oA4VQRO\">Options</a> → <em>Appearance</em>, by checking <em>Use different fonts</em> in the <em>Fonts</em> section.</p><p>The font can be personalized for the following areas of the application:</p><ul><li>Interface text, for most of the UI (menus, toolbars, dialogs).</li><li><a class=\"reference-link\" href=\"#root/_help_oPVyFC7WL2Lp\">Note Tree</a>.</li><li>Document text, for the actual content of the notes (especially for <a class=\"reference-link\" href=\"#root/_help_iPIMuisry3hd\">Text</a> notes).</li><li>Monospace text, e.g. for <a class=\"reference-link\" href=\"#root/_help_6f9hih2hXXZk\">Code</a> notes and <a class=\"reference-link\" href=\"#root/_help_QxEyIjRBizuC\">Code blocks</a>.</li></ul><p>Each area also has its own <em>Size</em>. The note tree and document sizes are relative to the interface size, so changing the interface size moves them along with it.</p><p>The list of fonts contains the following items:</p><ul><li><strong>Generic fonts</strong><ul><li><em>Theme defined</em> which uses the font that is embedded with the current <a href=\"#root/_help_Wy267RK4M69c\">theme</a>. For example on the default modern theme, the font is <em>Inter</em>. This does not require the font to be installed.</li><li><em>System default</em> which uses a combination of fonts that works best for the <a href=\"#root/_help_poXkQfguuA0U\">desktop app</a>. For example on Windows it will use <em>Segoe UI</em>.</li><li>Generic font selections for fonts with serifs (e.g. <em>Times New Roman</em>-like), no serifs and monospace.</li></ul></li><li><strong>Web fonts</strong> which appear on the <a class=\"reference-link\" href=\"#root/_help_WOcw2SLH6tbX\">Server Installation</a>, which is a predefined list of fonts and grouped into Sans-serif, serif, monospace and handwriting. The fonts that are not supported by your system (i.e. not installed) are not displayed.</li><li><strong>System fonts</strong> which appear on the <a class=\"reference-link\" href=\"#root/_help_poXkQfguuA0U\">Desktop Installation</a>. Unlike the server fonts which are predefined, the system fonts are listed from your operating system.</li><li><strong>Custom fonts</strong>, allowing any font to be used provided it's imported into Trilium. See the section below for more information.</li></ul><p>Font changes take effect after a reload; the section offers a <em>Reload to apply changes</em> button once something has been changed.</p><h2>Custom fonts</h2><p>A font file imported into Trilium can be used by the application itself, without writing any CSS.</p><h3>Adding a font</h3><ol><li>Import the font file, by dragging it into the <a class=\"reference-link\" href=\"#root/_help_oPVyFC7WL2Lp\">Note Tree</a> or through <em>Import into note</em>. TrueType (<code>.ttf</code>), OpenType (<code>.otf</code>) and Web Open Font Format (<code>.woff</code>, <code>.woff2</code>) files are recognized; the note takes the font's name without its extension and is marked with a font icon (an “A” icon).</li><li>Select the resulting note where a preview of a font will be displayed: a specimen line to type your own text into, a slider for its size, a preview in multiple sizes, and the Latin character set.</li><li>Turn on <em>In font picker</em> above the specimen.</li><li>In <a class=\"reference-link\" href=\"#root/_help_4TIF1oA4VQRO\">Options</a> → <em>Appearance</em> → <em>Fonts</em>, the font is now offered under <em>Custom fonts</em>, ahead of the built-in families, and can be set for any of the four areas.</li></ol><aside class=\"admonition note\"><p>Embedded OpenType (<code>.eot</code>) files and TrueType collections (<code>.ttc</code>) cannot be drawn by the browser, so they are treated as ordinary files: no preview, and no entry in the picker.</p></aside><h3>How custom fonts behave</h3><ul><li>Each entry is named after its note, so renaming the note renames the entry. The setting refers to the note itself rather than to its name, and keeps working across a rename.</li><li>The font file is an ordinary note, so <a class=\"reference-link\" href=\"#root/_help_cbkrhQjrkKrh\">Synchronization</a> carries it to your other devices. The choice of font is not synced: appearance settings are deliberately kept per-device, so on another device the font is already there and only needs to be selected again.</li><li>A font kept in a <a href=\"#root/_help_bwg0e8ewQMak\">protected note</a> can only be previewed and used while the protected session is open.</li></ul><p>For theme authors, a font can also be embedded in a theme's CSS through <a class=\"reference-link\" href=\"#root/_help_d3fAXQ2diepH\">Custom Resource Providers</a>, which is the route to take when the font should come with the theme rather than be chosen in the settings.</p><h3>Downloading from Google Fonts</h3><p>A large selection of fonts can be easily retrieved from Google Fonts, as follows:</p><ol><li>Go to <a href=\"https://fonts.google.com\">https://fonts.google.com</a>.</li><li>Search for a desired font.</li><li>Press <em>Get font</em> in the top right.</li><li>Check that the list of fonts on the left side corresponds to your selection.</li><li>Press <em>Download all</em>.</li><li>In the <a class=\"reference-link\" href=\"#root/_help_oPVyFC7WL2Lp\">Note Tree</a>, create a note where to store the new fonts.</li><li>In the <a class=\"reference-link\" href=\"#root/_help_oPVyFC7WL2Lp\">Note Tree</a>, drag-and-drop the .zip file directly onto the newly created note and follow the steps from the previous section.</li></ol><h2>Programming ligatures</h2><p>Some fonts support programming ligatures, which will turn character combinations such as <code>!=</code> into <code>≠</code> or <code>-></code> as <code>→</code> in <a class=\"reference-link\" href=\"#root/_help_QxEyIjRBizuC\">Code blocks</a> and <a class=\"reference-link\" href=\"#root/_help_6f9hih2hXXZk\">Code</a> notes.</p><p>These are only a display affordance, so copying the text is not affected. Regardless, this feature can be disabled in Trilium by unchecking <em>Programming ligatures</em> in the font settings.</p>",diff --git a/docs/User Guide/User Guide/Basic Concepts and Features/Themes.md b/docs/User Guide/User Guide/Basic Concepts and Features/Themes.mdindex 369d66a1cc..388e2326df 100644--- a/docs/User Guide/User Guide/Basic Concepts and Features/Themes.md+++ b/docs/User Guide/User Guide/Basic Concepts and Features/Themes.md@@ -1,7 +1,7 @@# Themes## Default Themes-Trilium comes with a couple pre-installed color themes, with the default being a light theme. To switch to a dark theme or any other available theme, navigate to the <span class="tn-icon bx bx-cog"></span> Options menu (accessible via the app icon in the top-left corner), select the Appearance tab, and choose your preferred theme.+Trilium comes with a couple pre-installed color themes, with the default being a light theme. To switch to a dark theme or any other available theme, navigate to the <span class="tn-icon bx bx-cog"></span> Options menu (accessible via the app icon in the top-left corner), select the Appearance tab, and choose your preferred theme. The _Theme_ submenu of the <a class="reference-link" href="UI%20Elements/Global%20menu.md">Global menu</a> switches the theme and the color scheme as well.@@ -79,6 +79,8 @@ Once you've created your custom theme:2. In the theme selection dropdown, you should see your custom theme listed under the name you provided with the `#appTheme` [label](../Advanced%20Usage/Attributes.md).3. Select your custom theme to activate it.+Your custom theme is also listed under <a class="reference-link" href="UI%20Elements/Global%20menu.md">Global menu</a> → _Theme_, with the icon of its note.+If you make changes to your theme, press Ctrl + R to reload the frontend and apply your updates.### Sharing and Importing Themesdiff --git a/docs/User Guide/User Guide/Basic Concepts and Features/UI Elements/Global menu.md b/docs/User Guide/User Guide/Basic Concepts and Features/UI Elements/Global menu.mdindex 899ce7477f..275d1912e0 100644--- a/docs/User Guide/User Guide/Basic Concepts and Features/UI Elements/Global menu.md+++ b/docs/User Guide/User Guide/Basic Concepts and Features/UI Elements/Global menu.md@@ -1,8 +1,19 @@# Global menu-The global menu configures the current window (zoom, keeping the window on top) and offers access to some more advanced options.+The global menu configures the current window (zoom, keeping the window on top), switches the theme and offers access to some more advanced options.## Accessing the global menu-See [Vertical and horizontal layout](Vertical%20and%20horizontal%20layout.md) since the position of the global menu is changed based on which layout has been selected.\ No newline at end of file+See [Vertical and horizontal layout](Vertical%20and%20horizontal%20layout.md) since the position of the global menu is changed based on which layout has been selected.++## Switching the theme++The _Theme_ submenu changes the look of the application without opening the <a class="reference-link" href="Options.md">Options</a>. A check mark at the end of a row shows the active choice.++* Under _Color scheme_, choose _System_ to follow the light or dark mode of the operating system, or _Light_ or _Dark_ to use one regardless.+* Under _Theme_, choose _Modern_ (the default theme) or one of the custom themes, each shown with the icon of its note. Switching to _Modern_ keeps the current color scheme.++A custom theme brings its own colors, so the color schemes are unavailable while one is active. The legacy theme is not listed; select it from <a class="reference-link" href="Options.md">Options</a> → _Appearance_ instead.++For more about the built-in and custom themes, see <a class="reference-link" href="../Themes.md">Themes</a>.\ No newline at end of filediff --git a/packages/commons/src/lib/server_api.ts b/packages/commons/src/lib/server_api.tsindex 33a1fafb0a..22f5f87554 100644--- a/packages/commons/src/lib/server_api.ts+++ b/packages/commons/src/lib/server_api.ts@@ -857,6 +857,18 @@ export interface UserFont {blobId: string;}+/** A CSS note carrying `#appTheme`, as `/api/options/user-themes` lists it. */+export interface UserTheme {+ /** The value of the `theme` option that selects this theme. */+ val: string;+ title: string;+ noteId: string;+ /** The icon class of the note. */+ icon: string;+ /** The built-in theme loaded under the custom one, from `#appThemeBase`. */+ appThemeBase?: "next" | "next-light" | "next-dark";+}+export interface TemplatesResponse {/** The IDs of the user-defined templates, i.e. the notes labelled with `#template`. */templateNoteIds: string[];diff --git a/packages/trilium-core/src/routes/api/options.ts b/packages/trilium-core/src/routes/api/options.tsindex b85cf9b55a..37307b5205 100644--- a/packages/trilium-core/src/routes/api/options.ts+++ b/packages/trilium-core/src/routes/api/options.ts@@ -1,6 +1,6 @@-import type { OptionNames, UserFont } from "@triliumnext/commons";+import type { OptionNames, UserFont, UserTheme } from "@triliumnext/commons";import type { Request } from "../../http_interface";import attributeService from "../../services/attributes.js";@@ -13,14 +13,6 @@ import { getSql } from "../../services/sql/index.js";import syncOptions from "../../services/sync_options.js";import { ValidationError } from "../../errors.js";-interface UserTheme {- val: string; // value of the theme, used in the URL- title: string; // title of the theme, displayed in the UI- noteId: string; // ID of the note containing the theme- icon: string; // icon class of the note- appThemeBase?: "next" | "next-light" | "next-dark"; // optional base theme to load underneath the custom theme-}-// options allowed to be updated directly in the Options dialogconst ALLOWED_OPTIONS = new Set<OptionNames>(["eraseEntitiesAfterTimeInSeconds",