koreader icon indicating copy to clipboard operation
koreader copied to clipboard

FR: Keyboard moveable highlight (bounty to be set)

Open Ceynou opened this issue 1 year ago • 10 comments

Requires writing an entire plugin, I barely know how to code and... idk I guess I'm just not motivated to do it myself sorry:

Add an option in the Taps and Gestures menu to enable or disable the plugin. Start the highlight mode of the plugin when pressing the keyboard key "Press". Its initial "position" (the word it will highlight) can be approximated based on how long I was on that page compared to how long it takes me to read a page on average.

That highlight should be moveable: Moving on each word of the current page with the keyboard keys "Left", "Right", "Up" and "Down", assuming we can get a get "Up" and "Down" working.

You can look the highlighted word up with the keyboard key "Press" when you're already in highlight mode, so it would bring up the default pop up dictionary.

You can exit and stop the highlight mode of the plugin either with the "Backspace" keyboard key or after looking up a word.

Additional context That way I could use my 8BitDo without ever moving my hands, touching the screen to look up unknown words. Tell me what the minimum amount of the bounty should be, and what method to use for the bounty (a site in particular?)

Ceynou avatar Jul 07 '24 12:07 Ceynou

Actually this already exists, either nearly or entirely but I'm on my phone atm so I can't check. I think it may have still required some gamepad detection to be finalized for this specific use case.

For context, does this particular gamepad have a stick and a dpad or only a dpad? In the latter case things might be harder.

I don't think we have a bounty thing, nor that it would be very motivating one way or the other.

Frenzie avatar Jul 07 '24 12:07 Frenzie

Actually this already exists, either nearly or entirely but I'm on my phone atm so I can't check. I think it may have still required some gamepad detection to be finalized for this specific use case.

For context, does this particular gamepad have a stick and a dpad or only a dpad? In the latter case things might be harder.

I don't think we have a bounty thing, nor that it would be very motivating one way or the other.

The one I have only has a dpad (other models have a stick), it also has a keyboard mode I just need to bind the buttons to keyboard keys within the 8BitDo Ultimate application and it can act like any bluetooth keyboard device.

Is it harder because we're thinking about moving a cursor instead of a highlight?

Ceynou avatar Jul 07 '24 12:07 Ceynou

Is it harder because we're thinking about moving a cursor instead of a highlight?

No, but then the dpad isn't a bunch of free extra keys.

Relevant code here (rationale here): https://github.com/koreader/koreader/blob/e29901828610f91897d2a0f444e489cd4bd83107/frontend/apps/reader/modules/readerhighlight.lua#L377-L384

https://github.com/koreader/koreader/blob/e29901828610f91897d2a0f444e489cd4bd83107/frontend/apps/reader/readerui.lua#L526-L528

Frenzie avatar Jul 07 '24 16:07 Frenzie

Yeah but like I said the one I have (8BitDo micro) has a keyboard mode, I can bind any button to shift, Ctrl, qwerty, whatever key is in a keyboard, so I think we can ignore the gamepad support

Ceynou avatar Jul 07 '24 16:07 Ceynou

Okay I tried the linux app, it's "h" to activate the highlight indicator. I'll see if I can write the plugin with that, I'd rather have a moving highlight tho, that cross feels clunky tbh

Ceynou avatar Jul 09 '24 14:07 Ceynou

Note that it has seen some minor tweaks since the last release.

Frenzie avatar Jul 09 '24 14:07 Frenzie

Is this what you have https://www.amazon.co.uk/dp/B0CDG5HCCH ?

I think you could get away with pretending to be a K4 when you connect the gamepad. That would reduce your workload to, faking being a K4 as the rest of the work is already done.

Commodore64user avatar Aug 10 '24 15:08 Commodore64user

Is this what you have https://www.amazon.co.uk/dp/B0CDG5HCCH ?

Yes this is what I use, I don't understand what you mean by K4 (kindle 4?), is it for the keybinds part of the plugin?

Ceynou avatar Aug 10 '24 18:08 Ceynou

yes, kindle 4. Essentially you want to give the gamepad some attributes (see below) so when it connects to KOReader you gain them, once you have those 5 things, you are a kindle 4 as far as the code is concerned.

isTouchDevice = no,
hasDPad = yes,
useDPadAsActionKeys = yes,
hasKeys = yes,
hasScreenKB = yes,

I am not sure what else you would need, but I think this could make your adventure a lot easier than writing everything from scratch.

edit: you'd want to replicate all the key mappings from the kindle 4, including a key named ScreenKB.

Commodore64user avatar Aug 11 '24 10:08 Commodore64user

@comphilip Is the highlight indicator supposed to work on anything else but text from the book ? (seems like it can also pick images) I was wondering if I should try (if I can) to replace the indicator instead of making a separate plugin

Ceynou avatar May 28 '25 15:05 Ceynou