Skip to content

Option to Stop a Command When "Time Up" Window is Closed

When the time is up on my timer, I have it set to play a looping sound:

mplayer -loop 0 /path/to/sound.wav

The problem is that the sound continues playing even after I close the "Time Up" window, so I have to manually kill mplayer. I'd like the sound to stop automatically when the window is closed.

Alternatively, if there was a way to issue a second command in response to either button on the dialog getting clicked, that would work, too. Then I could just run

pkill mplayer

when closing the window.

Edited by andonagio