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

PropertyTypeDescription
appIdstringID that uniquely identifies the vault.
appMenuBarManagerAppMenuBarManagerManager for the application menu bar (desktop only).
cliCliCLI handler for the app.
commandsCommandsContains all registered commands.
customCssCustomCSSCustom CSS (snippets/themes) applied to the application.
domObsidianDOMReferences to important DOM elements of the application.
dragManagerDragManagerManager for drag-and-drop operations within the app.
embedRegistryEmbedRegistryRegistry that manages the creation of generic media type embeds.
fileManagerFileManagerThe file manager object.
foldManagerFoldManagerManager for editor fold (collapse) state persistence.
hotkeyManagerHotkeyManagerManages global hotkeys.
internalPluginsInternalPluginsManager of internal 'core' plugins.
isMobilebooleanWhether the application is currently running on mobile.
keymapKeymapThe keymap object.
lastEventnull | UserEventThe last known user interaction event, to help commands find out what modifier keys are pressed.
metadataCacheMetadataCacheManages the gathering and updating of metadata for all files in the vault.
metadataTypeManagerMetadataTypeManagerManages the frontmatter properties of the vault and the rendering of the properties.
mobileNavbarMobileNavbar | nullNavigation bar for mobile devices, or null on desktop.
mobileQuickActionsunknownQuick actions for mobile, null on desktop.
mobileTabSwitcherMobileTabSwitcher | nullTab switcher for mobile devices, or null on desktop.
mobileToolbarMobileToolbar | nullToolbar for mobile devices, or null on desktop.
nextFrameEvents(() => void)[]Events to execute on the next frame
nextFrameTimernull | numberTimer for the next frame
pluginsPluginsManages loading and enabling of community (non-core) plugins.
renderContextRenderContextThe render context.
scopeScopeThe scope object.
secretStorageSecretStorageThe secret storage.
settingAppSettingManages the settings modal and its tabs.
shareReceiverShareReceiverHandler for receiving shared content from external apps (mobile).
statusBarStatusBarStatus bar of the application
titlestringName of the vault with version suffix.
vaultVaultThe vault object.

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

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

Methods

MethodReturnsDescription
changeTheme(theme)voidSets the accent color of the application (light/dark mode).
copyObsidianUrl(file)voidCopies Obsidian URI of given file to clipboard.
debugMode(isEnabled)voidToggles debug mode.
disableCssTransition()voidDisables all CSS transitions in the vault (until manually re-enabled).
emulateMobile(emulate)voidRestarts Obsidian and renders workspace in mobile mode.
enableCssTransition()voidEnables all CSS transitions in the vault.
fixFileLinks(element, sourcePath)voidManually fix all file links pointing towards image/audio/video resources in element.
garbleText()voidApplies an obfuscation font to all text characters in the vault.
getAccentColor()stringGet the accent color of the application.
getAppTitle(title?)stringGet the current title of the application.
getObsidianUrl(file)stringGet 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()stringGet webview partition identifier.
importAttachments(attachmentsToImport, folder)Promise<void>Import attachments into specified folder.
importDirectory(directory, name, parent?)Promise<void>Import a directory from the file system into the vault (desktop only).
initializeWithAdapter(adapter)Promise<void>Initialize the entire application using the provided FS adapter
isDarkMode()booleanCheck if the application is in dark mode.
isVimEnabled()booleanCheck whether Vim keybindings are enabled.
loadLocalStorage(key)any | nullRetrieve value from localStorage for this vault.
nextFrame(callback)voidAdd callback to execute on next frame
nextFrameOnceCallback(callback)voidAdd callback to execute on next frame, and remove after execution
on()voidRegister an event listener on the app.
onConfigChanged(configKey)voidCalled when app config changes.
onNextFrame(callback)voidExecute all logged callback (called when next frame is loaded)
openHelp()voidOpen the help vault (or site if mobile).
openVaultChooser(closeWindow?)voidOpen the vault picker.
openWithDefaultApp(path)voidOpen the file with OS defined default file browser application.
registerCommands()voidRegister all basic application commands
registerQuitHook()voidRegister a hook for saving workspace data before unload
relaunch()voidRelaunch the application (desktop) or reload the window (mobile).
runOpeningBehavior(behavior)voidRun the vault opening behavior.
saveAttachment(name, extension, data)Promise<TFile>Save attachment at default attachments location
saveLocalStorage(key, data)voidSave vault-specific value to localStorage. If data is null, the entry will be cleared.
setAccentColor(color)voidSet the accent color of the application.
setSpellcheckLanguages(languages)voidSet the spellcheck languages.
setTheme(theme)voidSet the current color scheme of the application and reload the CSS.
showInFolder(path)voidOpen the OS file picker at path location.
showReleaseNotes(version?)voidShow the release notes for provided version as a new leaf.
updateAccentColor()voidUpdates the accent color and reloads the CSS.
updateAutoFullScreenDisplay()voidUpdate auto full screen display.
updateFloatingNavigationDisplay()voidUpdate floating navigation display.
updateFontFamily()voidUpdate the font family of the application and reloads the CSS.
updateFontSize()voidUpdate the font size of the application and reloads the CSS.
updateInlineTitleDisplay()voidUpdate the inline title rendering in notes.
updateMobileFrameTheme(isDark)voidUpdate mobile frame theme.
updateRibbonDisplay()voidUpdate the ribbon display.
updateTabSize()voidUpdate tab size setting.
updateTheme()voidUpdate the color scheme of the application and reloads the CSS.
updateUseNativeMenu()voidUpdate native menu usage.
updateViewHeaderDisplay()voidUpdate the view header display in notes.
static getOverrideConfigDir(appId)string | nullGet the override config directory for the given app ID.

Links to this page: