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.
- Use a Linux machine. (This in itself is a great tip! 😉 ) These steps in particular are for an Ubuntu / Linux Mint machine.
- 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.
- 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”
Helpful. Thank you.
My OS (Mint 19 tara) and mic required some modifications:
pass “-D pulse” to amixer
replace “Front Left” by “Mono” or “(Front Left|Mono)”
my fork is here: https://gist.github.com/Vftdan/8db21e38d5f626f8abae2e43e521c8bb
Cool, this is being really useful in these days working from home due to COVID-19. Thanks!
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?
Never mind. I changed it to
/path/to/script/./Microphone.sh
It works fine now. Newbie mistake.
Ubuntu 20.04 (maybe even earlier versions) also hast a mute shortcut in “Settings > Keyboard Shortcuts”. Just search for “mute”.
Just use this command:
pactl set-source-mute @DEFAULT_SOURCE@ toggle