Tell me more ×  I am making a notepad like program in Ubuntu. I
have this idea that If my notepad program is open but currently
not in focus that is may be I opened a folder or something and
my program is behind that window, If I want to paste some data
to my notepad, and I press CTRL+P , that data gets pasted to the
notepad file even when the notepad is behind that window.  The
problem is I don't know how to detect which keys are pressed
when my notepad is behind a window. How can I do it?I heard
there is a System call for this purpose. I am programming in C++
share|improve this question add comment  1 Answer  One (not
uncommon) solution is to make your program act a network server
and client. This way you can call your program with special
arguments that are interpreted as commands to send to the
currently running program. Then you can make a standard Ubuntu
Unity hotkey that calls your program with an argument that means
"connect to running program and send the command 'paste'".  Of
course, you can utili