canberra-gtk-play
Play event sounds using GTK+ settings
SYNOPSIS
canberra-gtk-play [OPTION...] [EVENT-ID]
PARAMETERS
-h, --help
Show help message and exit
-V, --version
Output version information and exit
-v, --verbose
Enable verbose output for debugging
--volume=<INT>
Set playback volume (0-100, default 50)
-f, --file=<FILE>
Play specified audio file directly
-i, --id=<ID>
Explicitly specify the event ID
--description=<STR>
Set human-readable event description
--transient
Play as transient sound (non-blocking, no volume affect)
--print-id
Print resolved event ID and exit (no playback)
DESCRIPTION
The canberra-gtk-play command is a lightweight utility from the libcanberra-gtk library, designed to play audio events in GTK-based desktop environments. It follows the XDG Sound Theme and Naming Specification, allowing applications to trigger named sounds like system bells, notifications, or login chimes without hardcoding file paths.
It queries the current sound theme (e.g., freedesktop) for the appropriate audio file associated with an event ID, such as desktop-login or bell, and plays it using the system's audio backend (typically PulseAudio or ALSA). This enables consistent, themeable audio feedback across GNOME, XFCE, and other GTK apps.
Primarily used in scripts, desktop files, or integrated into GTK modules (like libcanberra-gtk-module for automatic bell sounds), it supports volume control, transient playback (non-blocking), and direct file playback. Verbose mode aids debugging theme lookup failures. It's ideal for session managers or notification daemons to provide polished audio cues.
CAVEATS
Requires libcanberra-gtk3 installed and a sound theme like 'freedesktop'. Fails silently if no sound file found for ID. Limited to mono/stereo WAV/OGG; no streaming support.
COMMON EVENT IDS
Examples: desktop-login, bell, message, dialog-question. List via ls /usr/share/sounds/.
USAGE EXAMPLE
canberra-gtk-play --volume=75 desktop-logout
canberra-gtk-play -f /path/to/sound.wav
HISTORY
Part of libcanberra (2007, by Lennart Poettering), introduced for GNOME/PulseAudio sound theming. GTK wrapper added ~2008 for seamless integration with GTK+2/3 apps. Maintained in most distros; deprecated in favor of PipeWire in GNOME 40+.
SEE ALSO
canberra-play(1), paplay(1), aplay(1), gtk-update-icon-cache(1)


