Skip to content

[KOPlugin] Hotkeys, add custom keyboard shortcuts#12484

Merged
Frenzie merged 57 commits into
koreader:masterfrom
Commodore64user:hotkeyshortcuts
Dec 3, 2024
Merged

[KOPlugin] Hotkeys, add custom keyboard shortcuts#12484
Frenzie merged 57 commits into
koreader:masterfrom
Commodore64user:hotkeyshortcuts

Conversation

@Commodore64user
Copy link
Copy Markdown
Member

@Commodore64user Commodore64user commented Sep 8, 2024

what's new

This plugin allows users to configure and use hotkeys for various dispatcher actions/events.
It provides a flexible way to map keys to specific actions based on device and user settings.

features:

  • Configurable shortcuts for modifiers plus cursor keys, page-turn buttons, function keys, and alphabet keys.
  • Allows users to enable or disable the use of the press key for shortcuts (kindle NT only).
  • Provides a menu interface for configuring and managing shortcuts.

key functions:

  • init: Initializes the plugin, loads settings, and registers key events.
  • onHotkeyAction: Handles the action triggered by a hotkey press.
  • registerKeyEvents: Registers key events for the plugin based on hardware capabilities.
  • overrideConflictingKeyEvents: Resets existing key_event tables in various modules to resolve conflicts.
  • onFlushSettings: Flushes settings data if said data has been updated.
  • updateProfiles: Updates profiles when action names are changed.

usage:

  • The plugin is automatically initialised and integrated into the application for devices that have a physical keyboard or are non-touch kindles.
  • Users should not notice the existence of the plugin, as it mimics hardcoded events by default. There are no sacrifices or trade-offs.
  • Users can configure shortcuts through the main menu interface.
  • Hotkey actions are executed based on the configured key mappings.

screenshots:


This change is Reviewable

@Commodore64user Commodore64user marked this pull request as draft September 8, 2024 00:41
@yparitcher
Copy link
Copy Markdown
Member

It might help to take some inspiration from Custom Multiswipes in gestures where the user can record a custom gesture, same here instead of having to list every combination of keys, you can just allow a user to chose his own key shortcuts.

https://github.com/koreader/koreader/blob/master/plugins%2Fgestures.koplugin%2Fmain.lua#L390

The trick is to open a dialog and register a handler for every type of key press, like is done for every type of gesture in the snippet below. Not sure if our current key code can handle this.
https://github.com/koreader/koreader/blob/master/plugins%2Fgestures.koplugin%2Fmain.lua#L441

@yparitcher
Copy link
Copy Markdown
Member

This would probably need to be extended:
https://github.com/koreader/koreader/blob/master/frontend%2Fui%2Fwidget%2Fcontainer%2Finputcontainer.lua#L228

You can add a event for Input.group.Any

Also you need to deal somewhere with priorities (do shortcuts override default keybindings or not)?
Gestures extensively deals with this for touch.

@yparitcher
Copy link
Copy Markdown
Member

See this comment for how to store the key name in settings

function Key:getSequence()

Tldr, you can just cast the key object to a string and it will be sane

@Commodore64user
Copy link
Copy Markdown
Member Author

Commodore64user commented Sep 8, 2024

It might help to take some inspiration from Custom Multiswipes in gestures where the user can record a custom gesture, same here instead of having to list every combination of keys, you can just allow a user to chose his own key shortcuts.

as for this bit, great idea but i would prefer not to do that just now. I would be using this on kindle (3 and 4) so the 10 to 50-ish combinations are already plenty enough, for other devices that have keyboards though, it could be something to add in later.

Furthermore, I want to keep some key mappings (shift+alt+whatever) open in case of needing to hard code something. I also don't want to support single key shortcuts (besides press that is), as i want to implement a 'type to search' feature as well.

Also you need to deal somewhere with priorities (do shortcuts override default keybindings or not)?
Gestures extensively deals with this for touch.

now this, i am aware of and i'm currently thinking about this very issue. I wanted to simply do something like (i know it’s not handling all cases there, i.e plugin being removed)

function ReaderToc:registerKeyEvents()
    local hotkey_plugin = self.ui.hotkeyshortcuts and not self.ui.hotkeyshortcuts.disabled
    if Device:hasScreenKB() and hotkey_plugin then
        self.key_events.ShowToc = { { "ScreenKB", "Up" } }
    elseif Device:hasKeyboard() and hotkey_plugin then
        self.key_events.ShowToc = { { "T" }, { "Shift", "Up" } }
    end
end

@yparitcher
Copy link
Copy Markdown
Member

yparitcher commented Sep 8, 2024

We can either do it easy or do it right :)
To manual hardcode a few codes is easy but is asking for long term kludges as people add in new one esp with regards to priorties.

The right way would be to duplicate a lot of the gesture handling in input esp _ordered_touch_zones for priorities.
This would allow converting the module specific handlers to registering with this plugin and calling events which simplifies code everywhere and automates the priorities. (Kind of the evolution gestures went through during its history)
Instead of just adding to an array of key_events you would call something like registerTouchZones and co, but for keys and set a priority etc.
This would then also allow you to unregister the key solving an issue you mentioned in one of the comments.

function InputContainer:registerTouchZones(zones)

It will probably be a bunch of effort of reading the Gestures, Input, InputContainer, Key & DepGraph stuff and seeing which to adapt and tweek for key based input

@Commodore64user
Copy link
Copy Markdown
Member Author

Commodore64user commented Sep 8, 2024

We can either do it easy or do it right :)

we? are you somehow suggesting that you are going to help get this to be the best it can possibly be? Because if that is the case, okay, we can try, you have the know-how. But if you are expecting me to figure it out by myself, and implement every single lesson learned by everyone that has ever worked on the gestures plugin here, well... you're setting yourself up for disappointment as that is just not going to happen.

If it comes to go big or go home, I am going home. But don't get me wrong, I am not saying that we should release something bad, what I am saying is, that I am not going to do all that work that has happened over many years and by many people (including yourself), either alone, or now (for this PR). So as I said, if anyone really wants to custom-create shortcuts (instead of using pre-defined ones), they can either wait, until I can get there some time in the future (post-this-PR) or grab a keyboard and help out.

It will probably be a bunch of effort of reading the Gestures, Input, InputContainer, Key & DepGraph stuff and seeing which to adapt and tweek for key based input

this is a very tall order (for me at least, a non developer I must add in case you don't know) for one man and little time, Rome was not build in one day. What I have here in this PR so far, is far more than what I personally need. So if worst comes to worst, I'll just run it locally and we can all go from having some sort of shortcut support to nobody having any, (except for me, because I will be running this) for better or worse.

So, making that clear, what are legitimate things that could be reasonably implemented here?

@Commodore64user
Copy link
Copy Markdown
Member Author

To manual hardcode a few codes is easy but is asking for long term kludges as people add in new one esp with regards to priorties.

I don't think anyone (besides me) has in very many years hardcoded any type of key_events besides the bare minimum functionality. I also very much doubt that anyone is going to do so in future, especially with something like this PR. Now all one needs is to add more events to dispatcher. So I am not truly concerned about more modifier events and their potential future priority (although I might be wrong and it might bite me in the ass later).

@Commodore64user Commodore64user marked this pull request as ready for review October 9, 2024 11:55
@Commodore64user
Copy link
Copy Markdown
Member Author

Commodore64user commented Oct 10, 2024

[  ERROR  ] spec/front/unit/filemanager_spec.lua:24: FileManager module should show error on non-existent file
[  ERROR  ] spec/front/unit/filemanager_spec.lua:39: FileManager module should not delete not empty sidecar folder
[  ERROR  ] spec/front/unit/filemanager_spec.lua:77: FileManager module should delete document with its settings

@Commodore64user
Copy link
Copy Markdown
Member Author

@poire-z sorry to bring you back from hibernation. I was wondering if you had any idea why CI is giving those errors and how to solve them. Also, have a look around.

@poire-z
Copy link
Copy Markdown
Contributor

poire-z commented Oct 11, 2024

You'll have more info for the why of these error above the bottom where they are summarized, using Ctrl-F to find the filename:linenumber ie.:
image

Also, have a look around.

Well, I have not enough brain bandwidth to dig into and appreciate your work.
I'm somehow just happy it is fully contained in a plugin, and whatever you do in it won't bother most non-key-device users :)
I also can't really estimate how much hack is happening with disabling core modules key registration, how much care/maintenance we'll have to give to it when tweaking the core stuff, etc...

@Commodore64user
Copy link
Copy Markdown
Member Author

hoping @NiLuJe joins the dark side and has a look around here.

@NiLuJe
Copy link
Copy Markdown
Member

NiLuJe commented Oct 11, 2024

Extremely unlikely ;).

@Commodore64user
Copy link
Copy Markdown
Member Author

should I assume that the lack of interest means I should put it to rest?

@poire-z
Copy link
Copy Markdown
Contributor

poire-z commented Oct 15, 2024

No. The fact that you managed to make it a standalone plugin (without touching core) is good.
With the side effect that we don't really need to be involved and interested and looking for sabotage :)
It just needs one of us to find the time and interest to give it an eye.

@Frenzie
Copy link
Copy Markdown
Member

Frenzie commented Oct 15, 2024

At a quick glance it looks a lot more appealing than the previous version. ^_^

@@ -0,0 +1,117 @@
-- typed on my Commodore 64 ;)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Too Much Information :)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

too bad. ;)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still there.

Copy link
Copy Markdown
Member Author

@Commodore64user Commodore64user Oct 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, and we are still talking about it. How’s that for a conversation starter?

Comment on lines +6 to +10
modifier_plus_up = nil,
modifier_plus_down = nil, -- keep nil.
modifier_plus_left = nil,
modifier_plus_right = nil,
modifier_plus_left_page_back = nil, -- keep nil.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the difference between lines with = nil, and those with = nil, -- keep nil..
If there is one, write about it so one newcomer like me can get it. If none, remove it so I won't ask the question again :)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My reading would be something like "already assigned outside the plugin." Which if correct is probably a better comment. ^_^

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that is exactly the case, i was originally going to write it differently but apparently never got around it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still don't get the differences.

        modifier_plus_down               = nil, -- keep nil, already assigned outside this plugin.
        modifier_plus_left               = nil,
        modifier_plus_right              = nil,
        modifier_plus_left_page_back     = nil, -- keep nil, already assigned outside this plugin.

How I am supposed to understand the differences between those with that comment and those without ?

Copy link
Copy Markdown
Member Author

@Commodore64user Commodore64user Oct 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the difference is, one is nil because I don't want to assign anything to it (let the three people that will use it decide for themselves), the other other one is nil with -- keep nil to indicate that nothing should ever be assigned to it because something is already using them. More importantly though, there is no real reason to touch those default values ever again...

for example:

modifier_plus_press              = nil, -- keep nil, already assigned outside this plugin.
modifier_plus_menu               = nil, -- keep nil, already assigned outside this plugin.

modifier_plus_press is assigned to long-press or hold, so we don't want to mess with that. It happens to be free inside the reader, so we can in fact use it there. modifier_plus_menu is used globally for screenshots on K4, so again, don't mess with it. and so forth...

Comment thread plugins/hotkeyshortcuts.koplugin/defaults.lua Outdated
Comment on lines +269 to +270
local fm_do_not_press = { press = true }
util.tableMerge(reader_only, fm_do_not_press)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is it named "do_not" ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because you are not suppose to press it... i guess, i can't remember exactly why i named it that. Nevertheless it is never used again.

return G_reader_settings:isTrue("press_key_does_hotkeyshortcuts")
end,
callback = function()
G_reader_settings:flipNilOrFalse("press_key_does_hotkeyshortcuts")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this press_key_does_hotkeyshortcuts already exists ? Is it used by core ?
If not, and you're adding it, can't it be stored in your hotkeyshortcuts.lua, so all is in one place?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it doesn't exist elsewhere, it is crreated here and used here only.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why can't i have something nice though?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Because you just haven't earned it yet, baby.)
Seriously: what ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can't we just leave it with the G_settings? they have some too... (points at gesture plugin).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's just a matter of storing it as:

self.hotkeyshortcuts.press_key_does_hotkeyshortcuts
-- which ends up stored as:
self.settings_data.data["press_key_does_hotkeyshortcuts"]

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can if you really don't want to bother (but you won't have something "nice").

Mmm… didn’t you say it was fine?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this PR will wait for after next release, so you still have time to try making something nice :)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But it is already nice.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You indeed made it nice by making it a standalone plugin.
The only non-standalone thingy left is the use of G_reader_settings for that single internal setting. So, there's room to make it even nicer.

Comment thread plugins/hotkeyshortcuts.koplugin/main.lua Outdated
Comment on lines +419 to +422
function HotKeyShortcuts:overrideConflictingFunctions()
local ReaderBookmark = require("apps/reader/modules/readerbookmark")
ReaderBookmark.registerKeyEvents = function(readerbookmark)
end
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overrideConflictingFunctions() seems to be called always when the plugin is enabled ?
And when the user is not interested by this plugin, you will just remove the original key registration, and plug back an equivalent/identical mapping, right ?
Feels a bit strange, but probably easier than detecting if needed and restoring when the assignment gets back to be similar to the defaults. So... ok.

Anyway, would read simpler with these on a single line when the func is a no-op:
ReaderBookmark.registerKeyEvents = function(readerbookmark) end

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is called as part of registerKeyEvents() during init so it is only enabled if the plugin is actually active. If someone decides to have the plugin off, it reverts back to core's keyEvents()

Comment on lines +544 to +546
function HotKeyShortcuts:updateProfiles(action_old_name, action_new_name)
for _, section in ipairs({ "hotkeyshortcuts_fm", "hotkeyshortcuts_reader" }) do
local hotkeyshortcuts = self.settings_data.data[section]
for shortcut_name, shortcut in pairs(hotkeyshortcuts) do
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not familiar with profiles, so it probably needs a quick reading by @hius07 (even if probably copy & pasted from the gestures plugin.)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, no changes here.

Comment on lines +128 to +129
local exec_props = { hotkeyshortcuts = hotkey }
Dispatcher:execute(action_list, exec_props)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May be needs a quick reading by @yparitcher for the dispatcher re-using.

Comment thread plugins/hotkeyshortcuts.koplugin/main.lua
Copy link
Copy Markdown
Member

@yparitcher yparitcher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty good overall, i do not have my dev computer for the next bit, but i would have added in custom shortcut support (like multi swipe) which would help make this a bit simpler.

- FileSearcher: Customizes `ShowFileSearchBlank` key event for devices with keyboards.
- FileManagerMenu: Customizes `ShowMenu` key event for devices with keys.
]]
function HotKeyShortcuts:overrideConflictingFunctions()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this plugin appears to be actually handling key input, these registerKeyEvents in all the modules should be removed and folded in to the plugin, much less of a maintenance headache. Similar to how many of the module gestures were moves to the plugin. As @poire-z said nilling them to register the same ones in the plugin doesn't make much sense

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually don't mind that. I'd rather keep having the default key behaviour in each core module, and not have to care about this plugin (which may be disabled - and NT users could be left with no key working at all :)).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the other thing is, there is really no reason to change those functions as I don't expect new devices will release with spare keys (out of your usual page-turn keys and perhaps menu etc) that would require adding new key mappings. therefore, there should be no headaches at all.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gamepads, BT page turners and the like remain "new" devices from the code's perspective that have always been planned to be combined with any work on keyboard shortcuts how @yparitcher stated. That remark was remarkably successful at introducing worry where there was essentially none. ;-)

@Commodore64user
Copy link
Copy Markdown
Member Author

would anyone like to have a look at the Full refresh event, it doesn't appear to work... with shortcuts (at least)

@Frenzie
Copy link
Copy Markdown
Member

Frenzie commented Oct 18, 2024

The event is simply one that comes from Dispatcher?

@Commodore64user
Copy link
Copy Markdown
Member Author

The event is simply one that comes from Dispatcher?

Yes, but even if you hardcode it (so it doesn't go through dispatcher), still won't work. I think i might have mentioned that early on the development of this idea (when it was just moving the bottom menu to the top, remember that? Feels like light years away)

@Frenzie
Copy link
Copy Markdown
Member

Frenzie commented Nov 30, 2024

I can change them, i thought you only wanted the name (shown to users) renamed.

Discrepancies are "intended" to arise from changing the user-facing string while the underlying code and settings are already long established. :-)

@poire-z
Copy link
Copy Markdown
Contributor

poire-z commented Nov 30, 2024

why does it offend you so much to have a single line that brings so much joy and amusement to my heart? surely I've earned the right to add one fun line

Consistency ? There is currently not a single "irrelevant funny line" (there are a few relevant funny lines by @NiLuJe though).
The code isn't and should not be a funny clown or a christmas tree with irrelevant stuff. Github is for that :)

(typed on my Casio toy piano - hoping to bring joy and amusement to your little broken heart)

@Commodore64user
Copy link
Copy Markdown
Member Author

Commodore64user commented Nov 30, 2024

Consistency ? There is currently not a single "irrelevant funny line" (there are a few relevant funny lines by @NiLuJe though). The code isn't and should not be a funny clown or a christmas tree with irrelevant stuff. Github is for that :)

(typed on my Casio toy piano - hoping to bring joy and amusement to your little broken heart)

Are you seriously going to go full Grinch on me?, You're supposed to be the fun one... ;)
I want to make it clear that I specifically chose the defaults file because I genuinely thought it would be "inappropriate" to have it in the actual code base.

besides, my hilarious quip (-- Easy access for "@NiLuJe, and for people that do like him." -- @poire-z (2024)) where your animosity towards NiLuJe was finally revealed was removed... I demand a fun line.

@poire-z
Copy link
Copy Markdown
Contributor

poire-z commented Nov 30, 2024

surely I've earned the right to add one fun line... in a defaults file, that none will ever see.

Well, I was trying to not have to go that far and hurtful :/ but if I must go there:

-- typed on my Commodore 64 ;)

This is not funny.

@Commodore64user
Copy link
Copy Markdown
Member Author

This is not funny.

I said fun, not funny. Besides the winky, smiley face at the end of the comment begs to disagree...

@Commodore64user Commodore64user changed the title [KOPlugin] Hotkey Shortcuts, add custom keyboard shortcuts [KOPlugin] Hotkeys, add custom keyboard shortcuts Dec 1, 2024
@Commodore64user
Copy link
Copy Markdown
Member Author

I went ahead and risked all, renamed everything to just 'hotkeys'.

@mergen3107 if you update your code to this (all three files have changed since), you are going to need to manually rename the settings/hotkeyshorts.lua file to just hotkeys.lua and also the two instances of hotkeyshortcuts_xx (inside the file) to just hotkeys_xx

@Frenzie and how do we arbitrate our defaults.lua line 1?

@Frenzie
Copy link
Copy Markdown
Member

Frenzie commented Dec 3, 2024

"I tried to read a book on my C64, but it kept saying press play on tape"

@Commodore64user
Copy link
Copy Markdown
Member Author

Commodore64user commented Dec 3, 2024

"I tried to read a book on my C64, but it kept saying press play on tape"

Line 2?

@Frenzie
Copy link
Copy Markdown
Member

Frenzie commented Dec 3, 2024

But I don't quite understand why you're so recalcitrant about one little comment line. Removing it is not an unreasonable request. It's just kind of there otherwise, which is the crux of the argument.

@Commodore64user
Copy link
Copy Markdown
Member Author

Because I want to have a little eater egg, we all want to leave a little mark somewhere; it is both homage to the machines of yesteryear and a little nod to the plugin's author ;). It's fun and kinda hidden from everybody, that's why I thought it wouldn't be a big deal.

@poire-z doesn't like it, I do. I expect you will use your wisdom to settle the matter. I will abide by it.

@Frenzie
Copy link
Copy Markdown
Member

Frenzie commented Dec 3, 2024

Is there some alternative phrasing in the same spirit both of you might agree on? "typed on a Commodore 64" as a minimal change for example.

@poire-z
Copy link
Copy Markdown
Contributor

poire-z commented Dec 3, 2024

If you think some alternative phrasing of something irrelevant would just be ok, go ahead with merging the original :)
Let's have this little mark, irrelevant homage and nod - archeologists will be able to find here that some of his congeners found it stupid, but were kind enough to allow this caprice.

@Frenzie Frenzie merged commit f5921ee into koreader:master Dec 3, 2024
@Frenzie
Copy link
Copy Markdown
Member

Frenzie commented Dec 3, 2024

Sometimes you have to take a risk. Hopefully it'll pay off rather than come back to bite. ;-)

@Commodore64user Commodore64user deleted the hotkeyshortcuts branch December 3, 2024 20:40
@Commodore64user
Copy link
Copy Markdown
Member Author

As always, thank you all for the help provided along the way (@poire-z as always a star) @mergen3107 thank you as well for testing (even though it made me quite angry at some point 🤣), I am also glad we could come to an agreement. See you on the next one, I guess. Oh, and don’t forget the little PR with the profiles bit…

Let it be known that this whole plugin came about because I didn’t want the press key to activate the bottom menu but @Frenzie thought we were crossing the Technical Debt line with my simplistic original idea… it goes to show, inspiration can come from anywhere.

@mergen3107
Copy link
Copy Markdown
Contributor

@Commodore64user
I dusted my K4NT from the shelf today and updated KOReader to v2024.11-131-g5cd9494ae.
I noticed that hotkeys assignements were default again.
There were two plugins:
hotkeys.koplugin (new, doesn't work)
hotkeyshortcuts.koplugin (old, but works!)

Here is the attached archive with both.
K4NT_hotkeys_again.zip

Is there something wrong with the nightly or my config?

@mergen3107
Copy link
Copy Markdown
Contributor

Ah, I guess, settings/hotkeyshortcuts.lua is now just settings/hotkeys.lua.
Structure is a little different, I guess I need to transfer it carefully?
K4NT_hotkeys_again_SETTINGS.zip

Shouldn't there be a proper migration?

@mergen3107
Copy link
Copy Markdown
Contributor

FWIW when I tried OTA update, it downloaded it, but then failed and offered to download the full archive, so I did. Installed OK.
This is the same as I recently had on Kindle Scribe by the way, so I don't think this is related to K4NT.

@mergen3107
Copy link
Copy Markdown
Contributor

Ah, I see. Commits show that folder and plugin name got changed before merging.
so the version I was testing never made it to KOReader :D
I guess I’ll just move the hotkeys from one lua to another by hand.
No migration needed

@Commodore64user
Copy link
Copy Markdown
Member Author

@mergen3107 #12484 (comment) ;)

@mergen3107
Copy link
Copy Markdown
Contributor

Thanks! All worked

@Commodore64user
Copy link
Copy Markdown
Member Author

I am trying to rewrite the opening bit, see here:

https://github.com/koreader/koreader/compare/master...Commodore64user:KOReader_fork:hotkeys-ref?expand=1

but I am getting an error WARN Error when loading plugins/hotkeys.koplugin/main.lua plugins/hotkeys.koplugin/main.lua:55: attempt to call local '_' (a number value) but I am not sure what the issue is... any help greatly appreciated

@Frenzie
Copy link
Copy Markdown
Member

Frenzie commented Feb 6, 2025

It's the for _, char right above. Make it for dummy, char.

0xstillb pushed a commit to 0xstillb/koreader-thai that referenced this pull request May 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FR: [Kindle NT] "Gesture manager" equivalent for Non-Touch devices FR: Quick Exit from KOReader FR: Provide keybindings to zoom in and out

7 participants