← 返回命令列表

Linux command

canberra-gtk-play 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Play a sound event by identifier

canberra-gtk-play --id [desktop-login]

Play a specific audio file

canberra-gtk-play --file [path/to/sound.ogg]

Play a sound event with a description

canberra-gtk-play --id [bell] --description "[Alert sound]"

Play a sound multiple times

canberra-gtk-play --file [path/to/sound.ogg] --loop [3]

Play with permanent caching for frequently used sounds

canberra-gtk-play --id [message] --cache-control permanent

说明

canberra-gtk-play plays sound events conforming to the XDG Sound Theme and Name Specification. It interfaces with the system sound server (PulseAudio or PipeWire) through libcanberra to play contextual sounds for desktop events. The utility can play predefined event sounds by identifier (e.g., "window-close", "dialog-information", "bell") or specific audio files. It passes metadata to the sound server for context-aware volume control and routing.

参数

-i, --id=_identifier_
Play the sound event with the specified XDG identifier
-f, --file=_file_
Play the specified audio file
-d, --description=_description_
Provide a description for the sound event
-l, --loop=_times_
Number of times to play (default: 1)
-c, --cache-control=_mode_
Cache mode: "permanent" for frequent sounds, "volatile" for temporary caching
--media-role=_role_
Set media role: event, feedback, notification, alarm
--display=_display_
Specify X display to use

FAQ

What is the canberra-gtk-play command used for?

canberra-gtk-play plays sound events conforming to the XDG Sound Theme and Name Specification. It interfaces with the system sound server (PulseAudio or PipeWire) through libcanberra to play contextual sounds for desktop events. The utility can play predefined event sounds by identifier (e.g., "window-close", "dialog-information", "bell") or specific audio files. It passes metadata to the sound server for context-aware volume control and routing.

How do I run a basic canberra-gtk-play example?

Run `canberra-gtk-play --id [desktop-login]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -i, --id=_identifier_ do in canberra-gtk-play?

Play the sound event with the specified XDG identifier