rampaa / JL

JL is a program for looking up Japanese words and expressions.
Apache License 2.0
198 stars 4 forks source link

Selecting words with keyboard shortcuts #61

Closed Connormgs closed 1 year ago

Connormgs commented 1 year ago

I have really messed up hands and often use voice dictation and foot controls to use my computer and I was wondering if it would be feasible to add an option to highlight and select words for lookup using keyboard shortcuts. It would make using your software much easier for people with limited use of their hands.

You've written a great piece of software keep up the great work.

rampaa commented 1 year ago

I was wondering if it would be feasible to add an option to highlight and select words for lookup using keyboard shortcuts.

Do you have anything specific in mind?

Windows let's you control the mouse with NumPad keys (Settings->Ease of Access->"Turn on Mouse Keys to use the numeric keypad to move the mouse pointer"), this allows you to control the mouse position with Numpad2, Numpad4, Numpad6, Numpad8 and allows left clicks with Numpad5. If you choose the "Mouse click/Touch" lookup mode through Preferences->General->Lookup mode, then you can lookup words by getting the mouse cursor over the beginning of the word you want to lookup and clicking Numpad5. Does this help, or are you using a similar setup already and it's not very helpful?

Alternatively, you can select the "Mouse click/Touch" lookup mode like mentioned above and I can add a hotkey for doing a lookup and add an option to make main window textbox's caret visible even when it's read only. This way you can change the caret position with arrow keys* to the start of the word you want to lookup and simply press the new lookup hotkey. Do you think this would make it easier for you to use JL?

*: Though currently left and right arrow keys are used for backlog navigation, so you would need to change those hotkeys first. But even then changing the caret position will require main window textbox to have focus. This can be achieved by multiple ways, there's "Preferences->Main Window->Focus on hover", but it would require (simulated) mouse movement and thus might not be preferable. I can also add a new "focus main textbox" hotkey but neither of those options would play nicely with a Magpie setup because they would steal the focus from Magpie. So maybe I can add hotkeys for changing the caret position (the default left arrow etc. won't work because they cannot be used as global hotkeys, see https://github.com/rampaa/JL/issues/53#issuecomment-1575140732 for the accepted global hotkeys) and you can use them to change the caret position after enabling the "Preferences->Advanced->Global hotkeys" option.

Connormgs commented 1 year ago

I'm actually unable to use a keyboard at all so one of my main input methods is an arcade stick on the floor with buttons and the stick bound to keyboard keys. I can use the stick to move the cursor but it's not precise and it gets awkward moving the cursor to a word and then clicking on the reading to mine a word. When my hands are acting up it's better for me to avoid using a mouse at all which is why I'm looking at alternate methods to be able to easily mine words with JL.

As far as I can tell using a caret to navigate and select text seems like it would work well and using the same hotkeys to move through the word list to select the reading I wish to mine.

rampaa commented 1 year ago

https://github.com/rampaa/JL/commit/428badf1af4e9896dcf24517abc6c084cc10f779 implements the following:

Hopefully these additions will be enough to make using JL less awkward for you. Aforementioned additions will be included in the next version of JL.

Connormgs commented 1 year ago

Absolute legend, can't wait to try out these changes.

rampaa commented 1 year ago

The new version is out, please give it a try and let me know what you think.

rampaa commented 1 year ago

Assuming you're happy with the new features as is.

Connormgs commented 1 year ago

Apologies for the late response, the only problem I've noticed so far is if I hit the button to mine a word without having one selected in the dictionary it makes the program crash. Other than that it's been working extremely well for me, I greatly appreciate you implementing this functionality for me.

rampaa commented 1 year ago

if I hit the button to mine a word without having one selected in the dictionary it makes the program crash

Fixed by https://github.com/rampaa/JL/commit/e6d9df45686545f895c6f59910b5f48c49e08941, the fix will be included in the next version of JL.

Other than that it's been working extremely well for me

I'm glad to hear it worked out well for you!