Skip to content

Instantly share code, notes, and snippets.

@xy124
Last active August 29, 2015 14:21
Show Gist options
  • Save xy124/f45804d659e1eb6cea36 to your computer and use it in GitHub Desktop.
Save xy124/f45804d659e1eb6cea36 to your computer and use it in GitHub Desktop.
midi pitch wheel as pageup/down on xpdf server
#!/bin/bash
# Script to perform next / prev page on note screen when midi-pitch-weel is turned
# Assuming:
# - notes are displayed on a $server in the only open xpdf session
# - $user can log into server via ssh without password authentification.
# - $dump returns when executed the hex-midi dump of the used midi-device
# Dependencies:
# sudo apt-get install xdotool xpdf/epdftool
user=user123
server=123.123.123.123
dump="amidi -p hw:2,0,0 -d"
while true; do
res=`$dump | grep E1 -m1 | sed -e "s/E1 .. \(..\)/\1/g"`
if [[ "0x$res" -lt "0x40" ]]; then
ssh 172.17.9.89 -l$user DISPLAY=:0.0 xdotool search xpdf key Page_Down
echo "Down"
else
ssh 172.17.9.89 -l$user DISPLAY=:0.0 xdotool search xpdf key Page_Up
echo "Up"
fi
# delay... anti double page switch
# empty dump
timeout 1s $dump > /dev/null
done;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment