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:
- obsidian.py defines the application contexts, handles multi-OS application detection, implements custom actions, and handles the logic for executing Obsidian commands.
- 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-porcmd-pdepending on the OS), inserts the localized human-readable name of the command retrieved from a predefined Python dictionary (obsidian_command_names), and pressesenter. 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_cliis set toTrue, Talon executes commands directly via the system shell using Python'ssubprocessmodule (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'sPATH.
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 toworkspace:new-tabedit.save()maps toeditor:save-fileuser.split_window()maps toworkspace: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, anduser.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), andnote renameto run the respective Obsidian internal command. - Daily Notes Integration: Supports specific commands for journal workflows, such as
daily open,daily previous, anddaily 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, andunfold all.