tulskiy / jkeymaster

A library for registering global hotkeys in java with JNA. The goal is to support X11-based platforms, Windows and MacOSX
GNU Lesser General Public License v3.0
234 stars 45 forks source link

PrintScreen (and SysRq) not being detected #39

Open vicnevicne opened 4 years ago

vicnevicne commented 4 years ago

I'm the author of Ginj, a screen capture application in Java, and I've selected JKeyMaster 1.3 for hotkey capture because it's easy to integrate and provides all the functionality I need. Thanks for the great project!

However, a user reported that the PrintScreen key isn't being captured.

I just tried JKeyMaster's AWTTest sample on my laptop (W10 64b, OpenJDK14) and indeed PrintScreen (obtained with FN key + Home) is not captured. Same for SysRq (FN + End). I was thinking the laptop's FN combination could be the culprit, but it doesn't seem so, as Pause (FN+PageUp) and Break (FN+PageDown) are detected correctly. I noticed that even with AWTTest active, PrintScreen still triggers the default Windows behaviour (copy screen to clipboard), so I tried with modifiers. "Alt + PrintScreen" and "Win + PrintScreen" are natively captured by Windows, but "Ctrl + PrintScreen", "Shift + PrintScreen" and any combination of modifiers should be "free" but they all go unnoticed by JKeyMaster too.

What's weird is that there was a previous issue ( #9 ) about that specific key not working and it looks like it was fixed 8 years ago...

Is PrintScreen still supported in JKeyMaster 1.3 ? Is there something special I should do to enable that key ?

vicnevicne commented 4 years ago

OK, after digging more, it's not an issue with JKeyMaster, it's just an issue with the AWTTest sample : the PrintScreen key is not detected by the JTextField and thus cannot be assigned, but if changed manually via the code, JKeyMaster handles it OK.

Any idea how to capture that keystroke (which I need for the configuration UI of course) ?