Skip to content

Instantly share code, notes, and snippets.

@fmartins-andre
Last active January 9, 2022 16:58
Show Gist options
  • Save fmartins-andre/246cb6b3801700963ef5367a0a74b0ac to your computer and use it in GitHub Desktop.
Save fmartins-andre/246cb6b3801700963ef5367a0a74b0ac to your computer and use it in GitHub Desktop.
Toggle microfone capture ON/OFF using command line. Useful with keyboard shortcut.
### reference: https://askubuntu.com/a/576507
on=/usr/share/icons/Adwaita/48x48/status/microphone-sensitivity-high-symbolic.symbolic.png
off=/usr/share/icons/Adwaita/48x48/status/microphone-disabled-symbolic.symbolic.png
amixer set Capture toggle \
&& amixer get Capture | grep '\[off\]' \
&& notify-send "Mic switched OFF" "Mic capture was disabled!" --icon=$off \
|| notify-send "Mic switched ON" "Mic capture was enabled!" --icon=$on
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment