Skip to content

Book shortcuts: scripts support#13393

Merged
hius07 merged 2 commits into
koreader:masterfrom
hius07:script-shortcut
Mar 13, 2025
Merged

Book shortcuts: scripts support#13393
hius07 merged 2 commits into
koreader:masterfrom
hius07:script-shortcut

Conversation

@hius07

@hius07 hius07 commented Mar 10, 2025

Copy link
Copy Markdown
Member

Executes scripts by a gesture/profile.
Use case #13367.


This change is Reviewable

@hius07 hius07 added the Plugin label Mar 10, 2025
@mergen3107

Copy link
Copy Markdown
Contributor

Does that mean I can also use those in auto exec scenarios?

@hius07

hius07 commented Mar 10, 2025

Copy link
Copy Markdown
Member Author

Yes

@mergen3107

Copy link
Copy Markdown
Contributor

@hius07
Do you need to create a Dispatcher item for this? (For profiles and gestures)

I just had a quick look at the files changed, and dispatcher.lua is not one of them

@hius07

hius07 commented Mar 10, 2025

Copy link
Copy Markdown
Member Author

That's how the Book shortcuts plugin works: adding a shortcut means adding an action to Dispatcher.

@mergen3107

Copy link
Copy Markdown
Contributor

I think I found a bug when testing this: #7917 (comment)

I created Book shortcut pointing to the script.
This script is being used as action in a Profile, that trigger on book opening
I then remove the script from action and switch back and forth books - the script comes back again. It is again checked in the profile.
Weird!

@mergen3107

Copy link
Copy Markdown
Contributor

I then had to remove the book shortcut to prevent this behavior

@hius07

hius07 commented Mar 11, 2025

Copy link
Copy Markdown
Member Author

You are overwriting internal settings files while the program is running, not good.

@mergen3107

Copy link
Copy Markdown
Contributor

I was only touching gestures.lua, not profiles.lua though...

@hius07

hius07 commented Mar 11, 2025

Copy link
Copy Markdown
Member Author

Can you recheck? All actions are added/deleted to profiles in the same way.

@mergen3107

Copy link
Copy Markdown
Contributor

I'll double check soon.

My bet is KOReader tripped after I killed it :D

@hius07

hius07 commented Mar 11, 2025

Copy link
Copy Markdown
Member Author

On crash (or killing) the settings are not saved.

@mergen3107

Copy link
Copy Markdown
Contributor

Yeah, I remember this.

But the profile mishaps happened after I restarted

@mergen3107

Copy link
Copy Markdown
Contributor

@hius07
I double checked with an empty script file.
All good.

#13393 (comment)
The previous wrong behavior was probably related to re-writing files on the fly.

@hius07 hius07 merged commit 3f6e335 into koreader:master Mar 13, 2025
@hius07 hius07 deleted the script-shortcut branch March 13, 2025 06:13
@hius07 hius07 added this to the 2025.02 milestone Mar 13, 2025
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants