uno-q-rotary-knob-volume.sh
Bash script that intercepts rotation events from the Modulino to send volume commands to the Linux display server.
Install 'xdotool' and 'evtest'. Connect the Modulino Rotary Knob node. Adjust the device path (/dev/input/eventX) according to your configuration. Run the script in a graphical terminal (X11/Wayland with compatible xdotool). The script listens for EV_REL events and triggers volume keyboard shortcuts.
uno-q-rotary-knob-volume.sh
#!/bin/bash
# Script pour mapper le bouton rotatif Modulino sur le volume système
# Nécessite 'xdotool' et 'evtest'
# Identifiant du device du bouton rotatif (à vérifier avec evtest)
DEVICE_ID=$(evtest --query /dev/input/event4 1 1 | grep -o '[0-9]*' | head -n 1)
if [ -z "$DEVICE_ID" ]; then
echo "Erreur: Périphérique non trouvé. Vérifiez le chemin /dev/input/eventX"
exit 1
fi
echo "Contrôle du volume activé via le bouton rotatif. Ctrl+C pour arrêter."
# Lecture des événements de rotation (ABS_REL)
evtest /dev/input/event4 | while read line; do
if echo "$line" | grep -q "EV_REL.*REL_WHEEL"; then
if echo "$line" | grep -q "value 1"; then
xdotool key XF86AudioRaiseVolume
echo "Volume +"
elif echo "$line" | grep -q "value -1"; then
xdotool key XF86AudioLowerVolume
echo "Volume -"
fi
fi
done