Kubuntu: Play Sound When Timer Ends

I like to work using an adapted Pomodoro technique, therefore I added a timer widget to my desktop (I use Kubuntu as my operating system). Unfortunately, in Kubuntu by default when the timer ends, there is no sound notification about this event. In this short post, I explain how to ring a sound when timer ends.

You can configure the timer to pop up textual notification in the notification area. In order to do this right click on a timer widget and select the “Configure Timer…" option. In the opened window, tick the checkbox “Notification” and add “Show notification text” into the textarea like it is shown in Figure 1:

Configuring Timer Notification

However, beside the visual signal I like to receive an audio signal about the time end event (this is especially useful when you are doing something not in front of your computer). Unfortunately, there is no configuration option to play a sound after the timer ends. However, the “Advanced” tab provides the “After the timer completes: Execute command” functionality that we will facilitate to play a sound.

Configuring Advanced Options

In order to do this, we need to find a command starting a utility that will play a selected sound. I search for the Internet, and found several options of the utilities that can be called from a command line so that their execution will not launch a window. So as by default my system is supplied with the VLC player installed that can be used to play a sound in a background, I have decided to use this utility to achieve my goal. Thus, into the “Execute command” textarea I put the following command:

cvlc --play-and-exit /usr/share/sounds/freedesktop/stereo/alarm-clock-elapsed.oga

The cvlc runs a minimal vlc player. The --play-and-exit option stops the process after the sound is played. The last argument is the path to the sound file. In my case, I use one of the default sounds supplied with the system.

I add this article to the blog mostly for myself because I configure timer widget rarely, and therefore I often forget the steps (and the path to the audio file) how to do this. However, if it can be useful for someone else I will be happy.

Yury Zhauniarovich
Yury Zhauniarovich
R&D Engineer
Lead Data Scientist
Cyber Security Researcher

Related