Skip to content

Instantly share code, notes, and snippets.

@bschulz87
Last active July 5, 2025 15:00
Show Gist options
  • Select an option

  • Save bschulz87/32e4673a5e6ae804a53da57a29485b85 to your computer and use it in GitHub Desktop.

Select an option

Save bschulz87/32e4673a5e6ae804a53da57a29485b85 to your computer and use it in GitHub Desktop.
Control OBS from Rodecaster Pro II MIDI pads using alsa and xdotool
#!/bin/bash
obsScene () {
xdotool key ctrl+shift+alt+$1
}
obsScript () {
xdotool key ctrl+shift+$1
}
obsMisc () {
xdotool key ctrl+alt+$1
}
typeset -A streamingHotkey
streamingHotkey[0]="a"
streamingHotkey[1]="b"
streamingHotkey[2]="c"
streamingHotkey[3]="d"
typeset -A recordingHotkey
recordingHotkey[0]="ü"
recordingHotkey[1]="ö"
recordingHotkey[2]="ä"
recordingHotkey[3]="ß"
aseqdump -p "RODECaster Pro II" | \
while IFS=" ," read src ev1 ev2 channel label1 controller label2 value rest; do
OBS_WINDOW=$(xdotool search --name "Profile: Twitch*")
#echo "obs window: $OBS_WINDOW controller: $controller value $value channel: $channel"
xdotool windowactivate $OBS_WINDOW;
case "$controller" in
1) case "$channel" in
0) obsMisc ${streamingHotkey[$value]} ;;
1) obsMisc ${recordingHotkey[$value]} ;;
esac ;;
2) obsScene $value; obsScript 1; # reset ready timer
if (($value == 2)); then # get ready scene
obsScript 2; # start
fi ;;
3) obsScript $value ;;
esac
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment