Skip to content

App

Official

The main app object.

Import:

import { App } from 'obsidian';

Signature:

export class App

Constructor

new App(adapter: DataAdapter, appId: string)

Constructor.

To get the constructor instance, use getAppConstructor from obsidian-typings/implementations.

Properties

Property Type Description
appId string ID that uniquely identifies the vault.
appMenuBarManager AppMenuBarManager Manager for the application menu bar (desktop only).
cli Cli CLI handler for the app.
commands Commands Contains all registered commands.
customCss CustomCSS Custom CSS (snippets/themes) applied to the application.
dom ObsidianDOM References to important DOM elements of the application.
dragManager DragManager Manager for drag-and-drop operations within the app.
embedRegistry EmbedRegistry Registry that manages the creation of generic media type embeds.
fileManager FileManager The file manager object.
foldManager FoldManager Manager for editor fold (collapse) state persistence.
hotkeyManager HotkeyManager Manages global hotkeys.
internalPlugins InternalPlugins Manager of internal 'core' plugins.
isMobile boolean Whether the application is currently running on mobile.
keymap Keymap The keymap object.
lastEvent null | UserEvent The last known user interaction event, to help commands find out what modifier keys are pressed.
metadataCache MetadataCache Manages the gathering and updating of metadata for all files in the vault.
metadataTypeManager MetadataTypeManager Manages the frontmatter properties of the vault and the rendering of the properties.
mobileNavbar MobileNavbar | null Navigation bar for mobile devices, or null on desktop.
mobileQuickActions unknown Quick actions for mobile, null on desktop.
mobileTabSwitcher MobileTabSwitcher | null Tab switcher for mobile devices, or null on desktop.
mobileToolbar MobileToolbar | null Toolbar for mobile devices, or null on desktop.
nextFrameEvents (() => void)[] Events to execute on the next frame
nextFrameTimer null | number Timer for the next frame
plugins Plugins Manages loading and enabling of community (non-core) plugins.
renderContext RenderContext The render context.
scope Scope The scope object.
secretStorage SecretStorage The secret storage.
setting AppSetting Manages the settings modal and its tabs.
shareReceiver ShareReceiver Handler for receiving shared content from external apps (mobile).
statusBar StatusBar Status bar of the application
title string Name of the vault with version suffix.
vault Vault The vault object.

Manages all file operations for the vault, contains hooks for file changes, and an adapter for low-level file system operations.
viewRegistry ViewRegistry Manages the construction of appropriate views when opening a file of a certain type.
workspace Workspace The workspace object.

Manages the workspace layout, construction, rendering and manipulation of leaves.

Methods

Method Returns Description
changeTheme(theme) void Sets the accent color of the application (light/dark mode).
copyObsidianUrl(file) void Copies Obsidian URI of given file to clipboard.
debugMode(isEnabled) void Toggles debug mode.
disableCssTransition() void Disables all CSS transitions in the vault (until manually re-enabled).
emulateMobile(emulate) void Restarts Obsidian and renders workspace in mobile mode.
enableCssTransition() void Enables all CSS transitions in the vault.
fixFileLinks(element, sourcePath) void Manually fix all file links pointing towards image/audio/video resources in element.
garbleText() void Applies an obfuscation font to all text characters in the vault.
getAccentColor() string Get the accent color of the application.
getAppTitle(title?) string Get the current title of the application.
getObsidianUrl(file) string Get the URI for opening specified file in Obsidian.
getSpellcheckLanguages() string[] Get currently active spellcheck languages.
getTheme() 'moonstone' | 'obsidian' Get the current color scheme of the application.
getWebviewPartition() string Get webview partition identifier.
importAttachments(attachmentsToImport, folder) Promise<void> Import attachments into specified folder.
initializeWithAdapter(adapter) Promise<void> Initialize the entire application using the provided FS adapter
isDarkMode() boolean Check if the application is in dark mode.
isVimEnabled() boolean Check whether Vim keybindings are enabled.
loadLocalStorage(key) any | null Retrieve value from localStorage for this vault.
nextFrame(callback) void Add callback to execute on next frame
nextFrameOnceCallback(callback) void Add callback to execute on next frame, and remove after execution
on() void Register an event listener on the app.
onConfigChanged(configKey) void Called when app config changes.
onNextFrame(callback) void Execute all logged callback (called when next frame is loaded)
openHelp() void Open the help vault (or site if mobile).
openVaultChooser(closeWindow?) void Open the vault picker.
openWithDefaultApp(path) void Open the file with OS defined default file browser application.
registerCommands() void Register all basic application commands
registerQuitHook() void Register a hook for saving workspace data before unload
runOpeningBehavior(behavior) void Run the vault opening behavior.
saveAttachment(name, extension, data) Promise<TFile> Save attachment at default attachments location
saveLocalStorage(key, data) void Save vault-specific value to localStorage. If data is null, the entry will be cleared.
setAccentColor(color) void Set the accent color of the application.
setSpellcheckLanguages(languages) void Set the spellcheck languages.
setTheme(theme) void Set the current color scheme of the application and reload the CSS.
showInFolder(path) void Open the OS file picker at path location.
showReleaseNotes(version?) void Show the release notes for provided version as a new leaf.
updateAccentColor() void Updates the accent color and reloads the CSS.
updateAutoFullScreenDisplay() void Update auto full screen display.
updateFloatingNavigationDisplay() void Update floating navigation display.
updateFontFamily() void Update the font family of the application and reloads the CSS.
updateFontSize() void Update the font size of the application and reloads the CSS.
updateInlineTitleDisplay() void Update the inline title rendering in notes.
updateMobileFrameTheme(isDark) void Update mobile frame theme.
updateRibbonDisplay() void Update the ribbon display.
updateTabSize() void Update tab size setting.
updateTheme() void Update the color scheme of the application and reloads the CSS.
updateUseNativeMenu() void Update native menu usage.
updateViewHeaderDisplay() void Update the view header display in notes.
static getOverrideConfigDir(appId) string | null Get the override config directory for the given app ID.

Links to this page: