SimpleUI Configuration System#151
Draft
ananyatimalsina wants to merge 2 commits intodoctorhetfield-cmd:mainfrom
Draft
SimpleUI Configuration System#151ananyatimalsina wants to merge 2 commits intodoctorhetfield-cmd:mainfrom
ananyatimalsina wants to merge 2 commits intodoctorhetfield-cmd:mainfrom
Conversation
- Introduce `config/init.lua` to define custom tabs, quick actions, and fullscreen views natively. - Fix dynamic action routing to properly support `is_action_only` and `is_in_place` behaviors. - Enable automatic SimpleUI navbar injection for user-defined widgets using `is_fullscreen_view = true`. - Safely disable the GUI tab arrangement menu when a custom configuration file is active. - Include fully functional examples for quick actions (OPDS catalog) and custom screens (`my_custom_widget.lua`).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR introduces an underlying configuration system to SimpleUI, allowing
users to define custom tabs, actions, and screens natively via a
config/init.luafile.Additions & Changes
1. User Configuration Loader (
sui_config.lua)getUserConfig()which securely loadsconfig/init.luausingpcallandlibkoreader-lfs.in the UI if the configuration file is malformed.
custom_actionsinto the globalALL_ACTIONSregistry on boot, resolving relative icon paths to absoluteplugin paths.
tabsorder.2. GUI Menu Protections (
sui_menu.lua)config/init.lua, the "Arrangetabs" GUI editor is safely disabled.
managed via configuration, preventing accidental conflicts between GUI
settings and the config file.
3. Dynamic Action Routing (
sui_bottombar.lua)onTabTapandnavigateto properly support dynamicallyregistered user actions.
_isActionOnlyhelper to correctly identify custom quick actions.is_in_placeare correctly routed throughnavigate(). The homescreen and active menus are torn down, but the activetab indicator is preserved correctly on the previous tab instead of getting
stuck on the quick action.
is_in_placeexecute gracefully above the currentview without changing the tab indicator or closing the homescreen.
4. Custom Fullscreen Widget Support (
sui_patches.lua)UIManager.showmonkey-patching to natively support injectingSimpleUI top and bottom navigation bars into user-defined custom widgets.
ALL_ACTIONSon boot and registers any user action marked withis_fullscreen_view = trueinto theINJECT_NAMEStable.widget.title_barrequirement during widget injection. Aslong as a custom widget declares
covers_fullscreen = trueand itswidget.namematches the action's ID, SimpleUI will successfully wrap it.5. Configuration Examples (
config/init.example.lua)custom_opds: A working example of a Quick Action tab that nativelylaunches KOReader's OPDS catalog (
dispatcher:execute).my_custom_screen: A working example of how to implement and route acompletely custom Lua widget wrapped in SimpleUI's navigation context.