I want to detect a key combination like alt+g in an application that runs as a background process (other keypresses/combinations should be executed normally) ,
 if the combination is pressed i want to block all keypresses and send them via serial to another linux pc instead of executing them. I cannot find a solution for detecting the key combination and recording the keys within a background process. 

I'd prefer to use a bash script, but c is ok aswell. 
I just cant find a starting point. Any directions or help are appreciated.