Mute Mic With Keyboard Shortcut On Ubuntu Or Linux Mint

Mute Mic With Keyboard Shortcut On Ubuntu Or Linux Mint

Here is a quick tip for all the automation buffs like me. Turn your mic on and off with just a keyboard combo.

I do all my work remotely. Which is also to say I have a lot of conference calls. And like you, I hate it when people do not mute their phones / mic on laptops when not speaking! (cue in the obligatory meme about not putting your phone on mute during a call!)

I always wished for a hotkey of some sort to mute / un-mute myself during a call. So here is a way to do it.

  1. Use a Linux machine. (This in itself is a great tip! 😉 ) These steps in particular are for an Ubuntu / Linux Mint machine.
  2. Put the following snippet in a bash script file and add it to path. You can also define it as a bash alias and load it from your custom bash profile, but then assigning it a shortcut may not be that easy.
  3. Set a keyboard shortcut to trigger this script. I use Meta+M for this.

Here are the two variants of the script for that:

This script toggles mic state, shows a nice (transient) notification of the changed state, with an intuitive icon! It should also replace previous notification quickly, but somehow it does not seem to work yet.

(cue in the meme about speaking on mute! ;))

Update for fellow KDE users

KDE, the amazing DE that has some of the best customizations already have a configurable action to mute mic, it just does not have a default shortcut.

Just go to System Settings –> Shortcuts –> Global Shortcuts –> Audio Volume. Choose option “Mute Microphone” and set the “Global Alternate” to your shortcut of choice! Done! No script needed!

7 thoughts on “Mute Mic With Keyboard Shortcut On Ubuntu Or Linux Mint

  1. Cool, this is being really useful in these days working from home due to COVID-19. Thanks!

  2. My script runs fine from the command line but once I’ve mapped it to the hotkey it is not working.
    From the terminal I run
    ./path/to/script/Microphone.sh
    It works fine but when I pasted the same into the hotkey it does nothing. Any ideas?

    1. Never mind. I changed it to
      /path/to/script/./Microphone.sh
      It works fine now. Newbie mistake.

  3. Ubuntu 20.04 (maybe even earlier versions) also hast a mute shortcut in “Settings > Keyboard Shortcuts”. Just search for “mute”.

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.