[SOLVED] Keyboard shortcuts if application is not focused?

Discuss here any questions about the WebLaF library.
Bugs can be posted directly to GitHub issues tracker.

[SOLVED] Keyboard shortcuts if application is not focused?

Postby Endogen » Wed Jul 22, 2015 12:15 pm

Hi,

i didn't want to add this as a github issue since i don't know if this is something that you would consider adding into weblaf.

Here is what i want to do: I'm writing an app where it is important to me that i can hide (minimize or setVisible(false)) my app but still have the possibility to show it again when the user uses a keyboard shortcut.

Till now, i'm using jintellitype for that. But that thing only recognizes some shortcuts, works only on windows and has some issues. I guess it's not possible to implement this feature for all platforms but maybe there is a way and if there is, then i'm sure you know how to do it :)

Cheers,
Endo
Endogen
 
Posts: 14
Joined: Tue Jan 22, 2013 12:48 pm

Re: Keyboard shortcuts if application is not focused?

Postby mgarin » Wed Jul 22, 2015 2:04 pm

Unfortunately global hotkeys is a native feature. It is implemented and functions differently on each OS. Also standard JDK doesn't allow you to register them. It is only possible to do through using native API.

I can recommend you to try out this library:
https://github.com/tulskiy/jkeymaster
It provides simple cross-platform API to use global system hotkeys.
I tested it on Windows, Mac OS X and Ubuntu and it worked perfectly on each of those.
Though it wasn't updated for some time so I'm not sure how will it function on newer OS versions.
User avatar
mgarin
Site Admin
 
Posts: 223
Joined: Mon Apr 16, 2012 1:01 pm
Location: Russia, Saint-Petersburg

Re: Keyboard shortcuts if application is not focused?

Postby Endogen » Wed Jul 22, 2015 11:52 pm

Thanks for the hint with jkeymaster. I will try it :)
Endogen
 
Posts: 14
Joined: Tue Jan 22, 2013 12:48 pm

Re: [SOLVED] Keyboard shortcuts if application is not focuse

Postby mgarin » Sun Sep 13, 2015 4:07 pm

I've marked this question solved for now.
I'll also move this topic into questions forum.
User avatar
mgarin
Site Admin
 
Posts: 223
Joined: Mon Apr 16, 2012 1:01 pm
Location: Russia, Saint-Petersburg


Return to Questions

Who is online

Users browsing this forum: No registered users and 1 guest

cron