![]() |
#1 |
Junior Member
![]() 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 |
![]() |
![]() |
![]() |
#2 |
Junior Member
![]() 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? |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
cosiñeiro
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,371
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. |
![]() |
![]() |
![]() |
#4 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,135
Karma: 3592801
Join Date: Sep 2014
Location: Ukraine
Device: Kindle PW2, PW3, PW4, Voyage
|
|
![]() |
![]() |
![]() |
#5 |
Junior Member
![]() 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. |
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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") |
![]() |
![]() |
![]() |
#7 |
Junior Member
![]() 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? |
![]() |
![]() |
![]() |
Thread Tools | Search this Thread |
|
![]() |
||||
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 |