Skip to content

Instantly share code, notes, and snippets.

@eric-glb
Last active May 24, 2023 11:58
Show Gist options
  • Save eric-glb/f6bfcc592e4fb4ddbcf3ba64cb20687d to your computer and use it in GitHub Desktop.
Save eric-glb/f6bfcc592e4fb4ddbcf3ba64cb20687d to your computer and use it in GitHub Desktop.
Linux: short script to mute/unmute mic (to associate to a keyboard shortcut)
#!/usr/bin/env bash
# Short script to mute/unmute mic; to associate to a keyboard shortcut
icon="audio-input-microphone-symbolic"
state=$(amixer set Capture toggle | awk 'match($0, /Front Left.*\[(.*)\]/, a) {print a[1]}')
# On Debian/Ubuntu/...: apt-get install libnotify-bin
which notify-send &>/dev/null && notify-send --hint=int:transient:1 -i $icon "Mic switched: $state"
echo -e "\nMic switched: $state\n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment