Skip to content

SimpleUI Configuration System#151

Draft
ananyatimalsina wants to merge 2 commits intodoctorhetfield-cmd:mainfrom
ananyatimalsina:main
Draft

SimpleUI Configuration System#151
ananyatimalsina wants to merge 2 commits intodoctorhetfield-cmd:mainfrom
ananyatimalsina:main

Conversation

@ananyatimalsina
Copy link
Copy Markdown

This PR introduces an underlying configuration system to SimpleUI, allowing
users to define custom tabs, actions, and screens natively via a
config/init.lua file.

Additions & Changes

1. User Configuration Loader (sui_config.lua)

  • Implemented getUserConfig() which securely loads config/init.lua using
    pcall and libkoreader-lfs.
  • Catches syntax errors or missing files gracefully, displaying an InfoMessage
    in the UI if the configuration file is malformed.
  • Automatically injects configured custom_actions into the global
    ALL_ACTIONS registry on boot, resolving relative icon paths to absolute
    plugin paths.
  • Allows users to entirely override the bottom bar tabs order.

2. GUI Menu Protections (sui_menu.lua)

  • If the user has hardcoded their tab layout in config/init.lua, the "Arrange
    tabs" GUI editor is safely disabled.
  • Tapping the menu item now shows an informative popup explaining that tabs are
    managed via configuration, preventing accidental conflicts between GUI
    settings and the config file.

3. Dynamic Action Routing (sui_bottombar.lua)

  • Refactored onTabTap and navigate to properly support dynamically
    registered user actions.
  • Introduced _isActionOnly helper to correctly identify custom quick actions.
  • Action-only tabs that are not is_in_place are correctly routed through
    navigate(). The homescreen and active menus are torn down, but the active
    tab indicator is preserved correctly on the previous tab instead of getting
    stuck on the quick action.
  • Action-only tabs that are is_in_place execute gracefully above the current
    view without changing the tab indicator or closing the homescreen.

4. Custom Fullscreen Widget Support (sui_patches.lua)

  • Modified UIManager.show monkey-patching to natively support injecting
    SimpleUI top and bottom navigation bars into user-defined custom widgets.
  • Iterates over ALL_ACTIONS on boot and registers any user action marked with
    is_fullscreen_view = true into the INJECT_NAMES table.
  • Relaxed the strict widget.title_bar requirement during widget injection. As
    long as a custom widget declares covers_fullscreen = true and its
    widget.name matches the action's ID, SimpleUI will successfully wrap it.

5. Configuration Examples (config/init.example.lua)

  • Shipped an example configuration file documenting the schema.
  • Includes custom_opds: A working example of a Quick Action tab that natively
    launches KOReader's OPDS catalog (dispatcher:execute).
  • Includes my_custom_screen: A working example of how to implement and route a
    completely custom Lua widget wrapped in SimpleUI's navigation context.

- 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`).
@ananyatimalsina ananyatimalsina marked this pull request as draft April 4, 2026 18:41
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.

1 participant