Microfoon aan/uit-schakelaar
20-10-2021
mute.sh
Voorkom afluisteren en schakel de microfoon(s) uit.Als je googelt naar hoe je je microfoon onder Linux moet muten dan vind je allerlei oplossingen die het geluid togglen. Ik wil echter het commando AAN of UIT sturen naar de microfoon. Niet "ga aan indien uit" of "ga uit indien aan".
Script om microfoon te muten:
#!/bin/bash
Status=`amixer -D pulse sset Capture toggle | grep '\[on\]'`
echo $Status
if [ "$Status" ]
then
amixer -D pulse sset Capture toggle
fi
Script om microfoon weer aan te zetten:
#!/bin/bash
Status=`amixer -D pulse sset Capture toggle | grep '\[off\]'`
echo $Status
if [ "$Status" ]
then
amixer -D pulse sset Capture toggle
fi
Toepassing: ik kan nu een globale sneltoets maken waarmee ik de microfoon tijdens een Teamsvergadering kan muten. Want MS Teams heeft (onder Linux) geen sneltoets hiervoor.
Om te zien of de microfoon aan of uit staat gebruik ik een werkbalkhulpje.
Hoe te gebruiken
Zet het script in een bestand mute.sh en maak het uitvoerbaar met:chmod +x mute.sh
Run het script vanuit een terminalvenster:./mute.sh
Automatisch
Zet dit script in crontab zodat het automatisch periodiek wordt uitgevoerd:crontab -e
Bekijk 28 meer scripts