Skip to content

dock

This directory provides integration with the macOS Dock, allowing you to trigger system-level UI actions—such as toggling App Exposé, showing the desktop, and launching Launchpad—directly via Talon voice commands.

It leverages macOS-specific APIs and accessibility hierarchies to programmatically interact with the Dock process.

How It Works

The directory consists of two main files: a Python implementation file that exposes helper actions, and a Talon file that maps those actions to voice commands.

  • dock.py defines the core mechanics of interacting with the macOS Dock. It defines two main actions:

    • dock_send_notification(notification: str): Utilizes Talon's internal talon.mac.dock.dock_notify API to send System Private Interface (SPI) notifications directly to the macOS Dock process. This is used to trigger system features like Launchpad and Show Desktop.
    • dock_app_expose(app: Optional[ui.App] = None): Queries the macOS accessibility tree to find the Dock item associated with the targeted application (defaulting to the active app). It does this by searching the "com.apple.dock" application's children for elements with AXSubrole="AXApplicationDockItem" matching the app's name. Once located, it invokes the "AXShowExpose" action on that UI element to trigger macOS App Exposé.
  • dock.talon maps spoken commands to these Python actions when running on macOS.

Voice Commands

The following commands are made available by this integration:

  • "desktop": Sends the "com.apple.showdesktop.awake" notification to show the desktop.
  • "window": Triggers App Exposé (user.dock_app_expose()) for the currently focused application, helping you quickly switch between multiple windows of the same application.
  • "launch pad": Sends the "com.apple.launchpad.toggle" notification to toggle the macOS Launchpad overlay.