Created
June 20, 2021 16:33
-
-
Save lu0/fd4a22d6869edab2592173f691043195 to your computer and use it in GitHub Desktop.
Enable micmute button on the Thinkpad Compact USB Keyboard with Trackpoint
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/bash | |
# The micmute (Fn+F4) button of the Thinkpad Compact USB Keyboard | |
# doesn't work out of the box as its keycode (248) is outside the | |
# range of the X server, therefore it is not recognizable with xev. | |
# | |
# This script enables the button by connecting to the acpid socket | |
# to catch the acpi event and then simulate the keypress on the X server. | |
# | |
# With this running at startup, we don't need to toggle the mic with | |
# alsa/pulseaudio, nor do we need to implement hacky workarounds | |
# to toggle the LED on the internal keyboard. | |
# | |
# Lucero Alvarado | |
# <https://github.com/lu0> | |
coproc acpi_listen | |
trap 'kill $COPROC_PID' EXIT | |
while read -u "${COPROC[0]}" -a event; do | |
[ "${event[0]}" = 'button/micmute' ] \ | |
&& xdotool key XF86AudioMicMute | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment