Portage sound notifications

Posted on Monday, November 3, 2008 in Gentoo Linux

Portage sound notifications

The context: you run emerge with --ask parameter and, since it can take some time to calculate dependencies, you do some other thing. After a while, when you've forgotten it, you discover that emerge have ended calculating dependencies time ago and it's waiting for your confirmation when it could be already done. Has this ever happened to you? Me too. This is why I added sound notifications to some Portage events.

The patch is configured in /etc/make.conf file with the following variables: PLAY_CMD which is the command that will play the sound, like play, aplay, artsplay, esdplay or paplay, and SOUND_<event> which is the sound file that will be played, events may be ASK, SUCCESS or FAILURE. Files may be in any format supported by PLAY_CMD, so you can use WAV, MP3, OggVorbis, AAC, WMA, ... using the suitable command.

Example:

# Sounds will be played with PulseAudio using command paplay
PLAY_CMD="paplay"
# Sound played when Portage asks you something (i.e., when you use --ask parameter)
SOUND_ASK="/home/fred/sounds/question.wav"
# Sound played when emerge exits successfully
SOUND_SUCCESS="/home/fred/sounds/correct.wav"
# Sound played when emerge exits with errors
SOUND_FAILURE="/home/fred/sounds/error.wav"

Download portage_sounds.diff