Skip to main content

How to get focus to my application when is not selected?

1 reply [Last post]
Joined: 2006-02-17


Does anybody know if it?s possible to get the focus to a Java application, when it is not selected, using a keyboard shortcut key?

I?ve written a java application that provides shortcuts keys (like CTRL-M?) for accessing to some operations. For using those keys combinations my application has to be focused between the other opened applications on the operating system (Linux 7.3), as it should be in a normal behaviour? but, I would need that the operation associated to the shortcut key could be executed even if another application had the focus?

Is it possible? How this could be done?

Thanks in advance four your interest and your answers.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2003-06-13

The thing you ask is something the WindowManager can only do; KDE (for example) has a running server that processes the global keyboard shortcuts.
If you can register your action with KDE you are set. Unfortunately Java does not provide such close interaction with the underlying windowing toolkit. You could probably do it when you write a jni dcop client...