I have simple script written in bash:
#!/bin/bash while true; do read -rsn1 input if [ "$input" = "a" ]; then firefox; fi done