Mute KDE from the Terminal

I’ll preface this by saying I like to listen to classical music. The problem is, that a certain streaming music service plays its classical music quietly, and it’s advertisements insanely loud. As a result, my comfortable classical music turns into this obnoxious loud cacophony of crap every time an ad comes on. Usually one of those you-appear-to-like-classical-why-not-listen-to-this-idiotic-rap-song adverts that make you listen to the first 15 seconds of some sheer garbage song.

I solved the problem by writing a shell script to just mute KDE, wait 30 seconds, then restore the volume. This gets triggered from a keyboard action.

First, the shell script:

Just copy it into a file somewhere on your machine. On mine, it’s in $HOME/Scripts/kde-mute-delay.sh. You’ll notice it takes a parameter – you can hardcode this in, but I may have to have different intervals for muting, depending on what I don’t want to hear.

Map it to the keyboard any way you like – the easiest would be in System Settings > Shortcuts and Gestures > Custom Shortcuts and create a new Command/URL shortcut. Set the trigger to an easy to reach key (F12 in my case) and set the command to be full path to your shell script above, making sure to pass the delay seconds parameter. My command looks like: /home/tom/Scripts/kde-mute-delay.sh 30.

Now, when one of those alarmingly loud ads comes on, salvation is a keypress away.

2 Replies to “Mute KDE from the Terminal”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.