Last active
August 10, 2022 08:08
-
-
Save nikhilw/daa2a2f99558b3278fc61023e73b0248 to your computer and use it in GitHub Desktop.
Toggle mic on-off on a Ubuntu / Linux Mint machine with a keyboard shortcut
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
# static icon, easier to set as a bash alias or directly use as a single command instead of creating a script file. | |
amixer set Capture toggle | gawk 'match($0, /Front Left.*\[(.*)\]/, a) {print a[1]}' | xargs notify-send --hint=int:transient:1 -i "audio-input-microphone" "Mic switched: $1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
# With icon indicating the state of the mic | |
state=`amixer set Capture toggle | gawk 'match($0, /Front Left.*\[(.*)\]/, a) {print a[1]}'` | |
if [ $state = "off" ]; then | |
icon="audio-input-microphone-muted-symbolic" | |
else | |
icon="audio-input-microphone-symbolic" | |
fi | |
notify-send --hint=int:transient:1 -i $icon "Mic switched: $state" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I needed this, Thank you.