Skip to content

obsidian

This directory provides deep integration and voice control capabilities for Obsidian, the Markdown-based knowledge management and note-taking application.

The implementation uses a dual-method command execution architecture that bridges voice inputs to either Obsidian's internal Command Palette or its official Command Line Interface (CLI).

Core Architecture

The integration consists of two primary files that work together to map voice commands to application behaviors:

  1. obsidian.py defines the application contexts, handles multi-OS application detection, implements custom actions, and handles the logic for executing Obsidian commands.
  2. obsidian.talon defines the voice-command vocabulary and activates relevant system-wide tags like tab management and split navigation.

Command Execution Modes

To invoke features within Obsidian, the system relies on the custom action user.obsidian(command_id). This action routes commands using one of two methods, configurable via the user.obsidian_use_cli setting:

  • Command Palette Fallback (Default): This method triggers the standard Obsidian command palette (using ctrl-p or cmd-p depending on the OS), inserts the localized human-readable name of the command retrieved from a predefined Python dictionary (obsidian_command_names), and presses enter. While robust and requiring no external dependencies, this method requires the Obsidian user interface language to be set to English.
  • CLI Mode: If user.obsidian_use_cli is set to True, Talon executes commands directly via the system shell using Python's subprocess module (e.g., obsidian command id=workspace:new-tab). This bypasses UI interactions entirely, making command execution significantly faster and independent of the active language, but it requires the Obsidian CLI to be enabled in Obsidian's settings and present on the system's PATH.

Key Components

obsidian.py

This file sets up the foundation for how Talon interacts with Obsidian:

  • Application Registry: Implements cross-platform detection for Linux, macOS, and Windows.
  • Standard Action Overrides: Re-implements core Talon actions to route directly to Obsidian internals. For example:
    • app.tab_open() maps to workspace:new-tab
    • edit.save() maps to editor:save-file
    • user.split_window() maps to workspace:split-vertical
  • Markdown Language Binding: Automatically forces the default coding language context to Markdown when focusing on Obsidian (unless a specific language is forced).
  • Error Recovery: The Python script contains error parsing logic that automatically falls back to Command Palette execution if the CLI tool is missing, misconfigured, or if the CLI interface has not been enabled inside Obsidian's general options.

obsidian.talon

This file defines the spoken commands for interacting with your vaults and notes.

  • System Tags: Activates standard capabilities such as user.find_and_replace, user.multiple_cursors, user.splits, and user.tabs. This allows standard universal commands to function in Obsidian.
  • File and Vault Navigation: Exposes voice commands like file hunt (opens quick switcher), note new (creates a note), and note rename to run the respective Obsidian internal command.
  • Daily Notes Integration: Supports specific commands for journal workflows, such as daily open, daily previous, and daily next.
  • UI Customization and Toggles: Contains voice triggers to toggle sidebars (bar switch, panel switch), toggle reading modes (view toggle), and manage text layouts.
  • Markdown Formatting: Simplifies rich text formatting, lists, checkboxes, and folding structures through commands like bold, italic, bullet, checkbox, fold all, and unfold all.