Skip to content

media

The community/plugin/media directory provides cross-platform voice commands for controlling system media playback and volume in Talon. By mapping spoken phrases to standard hardware key presses and custom Python actions, it enables seamless, hands-free control of audio and video.

Key Components

The directory contains two core files that work in tandem:

  • media.py: A Python module that registers custom Talon actions. It defines a platform-aware user.play_pause() action. Since operating systems handle play/pause commands differently, this action detects if the host OS is Windows to send the generic "play_pause" keystroke, defaulting to "play" on other platforms (macOS and Linux).
  • media.talon: The voice command definition file. It maps natural language phrases to standard keyboard media keys (such as volup, voldown, mute, next, and prev) and integrates with python actions for more complex behaviors.

Available Commands

The voice commands defined in this module fall into two primary categories:

  • Playback Control

    • media (play | pause): Toggles playback state by invoking the platform-specific user.play_pause() action.
    • [media] play next / [media] play previous: Skips to the next or previous track using hardware-level key simulation.
  • Volume Control

    • volume up / volume down: Steps the system volume up or down.
    • (volume | media) mute: Toggles the system mute state.
    • set volume <number>: Programmatically sets the volume to a specific level via user.media_set_volume(number).