mud_server.admin_tui.keybindings
User-configurable keybindings for the Admin TUI.
This module defines a small configuration layer for Textual keybindings so users can customize navigation without editing source code. It supports: - A default keybinding set (Tab, hjkl, Space select, etc.) - Optional JSON overrides via a config file - Safe fallback to defaults if the file is missing or invalid
Design Goals: - Keep the format simple (JSON) - Merge overrides on top of defaults - Validate and normalize key strings - Avoid crashing the TUI if config is malformed
Attributes
Classes
Immutable keybindings container. |
Module Contents
- mud_server.admin_tui.keybindings.logger
- mud_server.admin_tui.keybindings.ENV_KEYBINDINGS_PATH = 'MUD_TUI_KEYBINDINGS_PATH'
- mud_server.admin_tui.keybindings.DEFAULT_KEYBINDINGS_PATH
- class mud_server.admin_tui.keybindings.KeyBindings
Immutable keybindings container.
- bindings
Mapping of action -> list of keys (Textual key syntax).
- get_keys(action)
Return the list of keys for an action, defaulting to empty list.
- classmethod load(path=None)
Load keybindings from JSON, merged with defaults.
- Priority:
Explicit path argument (if provided)
ENV_KEYBINDINGS_PATH
DEFAULT_KEYBINDINGS_PATH
- The JSON file can be either:
{ “bindings”: { “next_tab”: [“tab”] } }
- or:
{ “next_tab”: [“tab”] }
Invalid or missing files fall back to defaults.