Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > KOReader

Notices

Reply
 
Thread Tools Search this Thread
Old 02-06-2025, 03:59 PM   #1
zeeyado
Junior Member
zeeyado began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Feb 2025
Device: Boox Page
Instructions for making menu items for plugins

Hello

I am writing a plugin for KOReader but I'm struggling to figure out

1. how to add settings for the plugin in the tools menu at the top of the KOReader UI

2. how to add an item in the long press menu in the file picker

I tried to have a look at the dev docs but the pages for apps.filemanager.filemanagerutil and ui.widget.touchmenu seem empty?

Thanks
zeeyado is offline   Reply With Quote
Old 02-06-2025, 06:10 PM   #2
zeeyado
Junior Member
zeeyado began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Feb 2025
Device: Boox Page
To be clear, I am writing a user plugin.

Does this mean I have to use a user patch to edit KOReader's main menu items?
zeeyado is offline   Reply With Quote
Advert
Old 02-06-2025, 08:05 PM   #3
pazos
cosiñeiro
pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.
 
Posts: 1,373
Karma: 2200075
Join Date: Apr 2014
Device: BQ Cervantes 4
Yup, dev documents are autogenerated from comments via luadoc. There're a bunch of undocumented functions.

At this time the best way to learn to write plugins and to hook into things is to have a look at upstream examples.

To add a sort hint have a look at https://github.com/koreader/koreader...in.lua#L33-L36

> how to add an item in the long press menu in the file picker

Not sure if we have a "shortcut" to address this, like we have to hook on the highlights menu. What's your plan?

There's `DocumentRegistry:addAuxProvider` that lets you handle filetypes in your own ways, but that just adds your implementation to the "Open with" in FM long press menu.
pazos is offline   Reply With Quote
Old 02-06-2025, 11:03 PM   #4
hius07
Wizard
hius07 ought to be getting tired of karma fortunes by now.hius07 ought to be getting tired of karma fortunes by now.hius07 ought to be getting tired of karma fortunes by now.hius07 ought to be getting tired of karma fortunes by now.hius07 ought to be getting tired of karma fortunes by now.hius07 ought to be getting tired of karma fortunes by now.hius07 ought to be getting tired of karma fortunes by now.hius07 ought to be getting tired of karma fortunes by now.hius07 ought to be getting tired of karma fortunes by now.hius07 ought to be getting tired of karma fortunes by now.hius07 ought to be getting tired of karma fortunes by now.
 
Posts: 1,136
Karma: 3592801
Join Date: Sep 2014
Location: Ukraine
Device: Kindle PW2, PW3, PW4, Voyage
2. https://github.com/koreader/koreader...ent-2517996584
hius07 is offline   Reply With Quote
Old 02-10-2025, 07:40 PM   #5
zeeyado
Junior Member
zeeyado began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Feb 2025
Device: Boox Page
Thanks to you both.

I managed to add a menu item to the tools menu (though in the second section along with "More tools" rather than in the main menu with Calibre, Wallabag, etc, but still).

But I still have a lot to figure out with how settings are managed.

My plugin uses a configuration.lua file for the main user configurable stuff. So I'm looking at how koreader handles settings (I guess G_reader_settings?) and how to make my settings work the right way.
zeeyado is offline   Reply With Quote
Advert
Old 02-11-2025, 04:17 AM   #6
Frenzie
Wizard
Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.
 
Posts: 1,726
Karma: 730679
Join Date: Oct 2014
Location: Antwerp
Device: Kobo Aura H2O
That's an instance of http://koreader.rocks/doc/modules/luasettings.html

Code:
LuaSettings:open(DataStorage:getSettingsDir() .. "/autostandby.lua")
Frenzie is offline   Reply With Quote
Old 02-26-2025, 09:03 PM   #7
zeeyado
Junior Member
zeeyado began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Feb 2025
Device: Boox Page
Thank you for your help and pointers.

I have managed to add my menu item to the Tools menu with sorting_hint = "tools" but I am struggling to figure out how to place it higher in the list. I'm only managing to place it last, after "More tools".

Any tips?
zeeyado is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Sage Odd menu items baursak Kobo Reader 4 06-18-2024 05:38 PM
Nia Hide menu items robbi Kobo Developer's Corner 1 08-30-2023 04:03 PM
Menu Items and Libraries Disappeared Tarana Calibre 4 07-01-2019 06:53 PM
adding items to menu iomari Calibre 2 09-26-2011 11:33 AM
Accessories How-to instructions for making Leonardo Leather Kindle case artsci Amazon Kindle 31 04-10-2010 12:45 PM


All times are GMT -4. The time now is 09:58 PM.


MobileRead.com is a privately owned, operated and funded community.