feat: make keyboard shortcuts extensible through entrypoints - #10589
Draft
peter-gy wants to merge 8 commits into
Draft
feat: make keyboard shortcuts extensible through entrypoints#10589peter-gy wants to merge 8 commits into
peter-gy wants to merge 8 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
All contributors have signed the CLA ✍️ ✅ |
Contributor
There was a problem hiding this comment.
All reported issues were addressed across 25 files
Architecture diagram
sequenceDiagram
participant Plugin as Extension Package
participant EP as EntryPoint Registry
participant Server as Marimo Server
participant API as Assets API
participant Template as HTML Template
participant Client as Browser (Marimo App)
participant Config as Jotai Store
participant Hotkey as OverridingHotkeyProvider
participant Bar as Shortcut Extension Handler
participant Document as DOM/Window
Note over Plugin,Server: Server-side: Extension Loading
Plugin->>EP: Register "marimo.keyboard_shortcuts" entry point
Server->>EP: Discover installed extensions
EP-->>Server: Registry with extension metadata
Note over Server,API: Request time: Serve index.html
Client->>API: GET /
API->>EP: load_keyboard_shortcuts()
EP-->>API: Namespaced shortcut map (extension.<provider>.<id>)
API->>Template: Render with keyboardShortcuts data
Template-->>Client: HTML + inline mount config (keyboardShortcuts)
Note over Client,Config: Client-side initialization
Client->>Config: Parse mount options (zod validation)
Config->>Config: Validate extension action keys (extension.*)
Config->>Config: Store keyboardShortcutExtensionsAtom
Client->>Hotkey: Create provider with built-in + extension hotkeys
Note over Hotkey,Document: Runtime: Keyboard handling
Document->>Hotkey: keydown event (e.g., Ctrl+Shift+Y)
Hotkey->>Hotkey: Match against merged shortcut map
Hotkey->>Bar: Trigger extension action callback
Bar->>Document: Dispatch CustomEvent("marimo:keyboard-shortcut")
Document->>Document: Listeners receive { action: "extension.x.y" }
Note over Hotkey,Document: UI Integration
Client->>Hotkey: Query hotkey info for command palette/settings
Hotkey-->>Client: Display name, key binding, group
alt Invalid extension metadata
API->>API: Catch exception, log warning
API-->>Template: Skip invalid extension
end
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
Contributor
There was a problem hiding this comment.
All reported issues were addressed across 6 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
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.
📝 Summary
Adds a
marimo.keyboard_shortcutsentry point so installed Python packages can contribute editor shortcuts with a plain dictionary.marimo validates and namespaces contributed actions, then exposes them in the command palette and Shortcuts dialog with existing overrides and duplicate detection. Triggering an extension action dispatches
marimo:keyboard-shortcut, which package widgets or panels can handle in the browser.Invalid entries are skipped individually, and installed entry points are loaded once per process. Includes focused Python and frontend coverage for discovery, validation, caching, UI registration, and event dispatch.
Demo
Built-in.Retina.Display.Area.2026-08-19.09_47.AM.mp4