If you try to install Ubuntu at HP notebook, you will meet with some drawbacks. HP by default support Microsoft OSes only.
You will find that some common things are working not as you expected. For example, you will lose your fingerprint or your touch-pad will work with limitation. But I didn't expect that such a common thing like Microphone mute/unmute key not work under Ubuntu. But it is so!
To toggle mute of default microphone under Ubuntu at HP EliteBook you need an pulseaudio and some scripting.
- Make sure that you have
pacmd
(frompulseaudio-utils
package) andnotify-send
(fromlibnotify-bin
). - Use this script:
- Go to Setting -> Devices->Keyboard (for Ubuntu 18.x) and create custom shorcut by click "+" at the bottom of Keyboards Shortcut list.
- Fill in Toggle Microphone and add you favorite shortcut, don't use default it's not work! For example, I have used combination Super+'F8', not Fn+'F8'.
- Fill in command your script name, don't forget to make it executable.
#!/bin/sh
pacmd list-sources | awk '\
BEGIN {default_found=0;}
/^[\t ]*\*/ {default_found=1;}
/^[\t ]*name:/ {
if (default_found) {
name=$2;
gsub("[<>]", "", name);
}
}
/^[\t ]*muted:/ {
if (default_found) {
if ($2=="yes") {
mute=0;
icon="microphone-sensitivity-medium";
status="unmuted"
} else {
mute=1;
icon="microphone-sensitivity-muted";
status="muted"
}
system("pacmd set-source-mute " name " " mute);
system("notify-send --expire-time 1000 --icon " icon " Microphone: " status);
exit;
}
}
/^[\t ]*index:/{if (default_found) exit;}'
Comments
Post a Comment