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-awareuser.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 asvolup,voldown,mute,next, andprev) 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-specificuser.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 viauser.media_set_volume(number).