Ginj-capture / Ginj

Ginj capture
GNU General Public License v3.0
26 stars 7 forks source link

Disable Capture hotkey #20

Open Creamers158 opened 4 years ago

Creamers158 commented 4 years ago

There is no option (at least I don't know) to disable the hotkey function so there is no key registered anymore.

Also when setting a bracket as hotkey I noticed this:

couldnotregister

vicnevicne commented 4 years ago

You're right about "undefining" the capture combination. Probably I should do it like Jing did: A field that can only be modified when it gets the focus and a "Clear hotkey" button. By the way, I just noticed Jing did forbit many keystrokes. It's proably wise to prevent things like single letter (just tried with P and it becomes impossible to type text ;-)). Probably either Alt or Ctrl should be mandatory in the combination. As to why the bracket is refused, no idea. Just to be clear, do you mean parenthesis ')', square bracket ']' or curly bracket '}' ? I cannot reproduce the above message on my international keyboard... And did you try combining it with alt or other modifiers ? Anyway I'm afraid I'm dependent on the JKeyMaster lib regarding what's rejected. However I'm wondering if I shouldn't switch to https://github.com/kwhat/jnativehook and see if it's better. The fact that it doesn't recognize the PrintScreen key (issue #18 ) is annoying for a screen capture software...

Creamers158 commented 4 years ago

I tried to set a key that wouldn't bother me so I set the close_bracket ]
There are alot of combinations possible and I agree that some should not be possible, but like another open issue, the PrtScr button would be nice as it sits there to be assigned ;)

Probably I should do it like Jing did: A field that can only be modified when it gets the focus and a "Clear hotkey" button

Agree

vicnevicne commented 4 years ago

The layout change is done, with a "Clear" button. It's much more intuitive (thanks) and it works :-) (silly bug)

But still I don't know how to make it accept the bracket. I checked JKeyMaster code and all it does is a Windows call to register the key, which fails; if (User32.INSTANCE.RegisterHotKey((HWND)null, id, KeyMap.getModifiers(hotKey.keyStroke), code)) ...

Note that, thinking more, it is very different from the PrintScreen issue:

Most probably something at Windows level prevents such an assignment. Did you try using that closing bracket in another app with global hotkey support ? Unfortunately I cannot replicate that issue because square bracket must be typed using a combination on my layout... Can you try other combinations, such as opening bracket, or Shift+closing bracket, etc ? Thanks.

vicnevicne commented 4 years ago

In v0.3.9, just released:

Creamers158 commented 4 years ago

Tried shift+closing bracket, alt+closing brack , ctrl+alt+closing bracket, ctrl+open bracket. Even Backslash, but doesn't work.' Dead acute doesnt work either. Strangly the Slash does work.

PRINTSCREEN by using the settings file works.

vicnevicne commented 4 years ago

OK. Thanks. I admit I'm out of options for the bracket key (Can you confirm all the cases above cause a "Could not register hotkey" message in the log ?). I'll leave the issue open but don't expect a solution for those keys, partly because all those keys (open/close brackets, dead acute and backslash) require a key combination on my keyboard so I cannot reproduce the issue, but also because Java handling of "special keys" seems to be clumsy. See for example this issue of TurboVNC.

Edit: I'm silly again: I don't need a keyboard to test if a hotkey is accepted: I just closed Ginj, edited ´settings.properties´, set capture.hotkey=CLOSE_BRACKET and restarted Ginj, and the log shows: INFO: Registering hotkey: HotKey{CLOSE_BRACKET} So it seems on my system there is nothing preventing the registration of the CLOSE_BRACKET key. If the same tests fails on your end, I would be tempted to think something on your system prevents using those keys... Maybe you could test on another computer ? Thanks for your help !

Creamers158 commented 4 years ago

I have a dualboot option and tested it there )dont have another pc on holiday: ) to see if it has something to do with my windows installation. On this second installation I have the same results 2020-08-05_18-37-54

Another 'potential' problem I found while testing cause it didnt remember my last settings. I couldnt find the settings.properties file, it appears that it's only created on the first capture and not at runtime.