Skip to content

NUB-KEYS: keyboard forwarding and action keybindings#9

Open
dskvr wants to merge 2 commits intomasterfrom
nub-keys
Open

NUB-KEYS: keyboard forwarding and action keybindings#9
dskvr wants to merge 2 commits intomasterfrom
nub-keys

Conversation

@dskvr
Copy link
Copy Markdown
Contributor

@dskvr dskvr commented Apr 9, 2026

Namespace: window.napplet.keys
Discovery: window.napplet.shell.supports("keys")
Status: draft

Summary

Bidirectional keyboard protocol for sandboxed napplet iframes. The shell proxies keyboard forwarding and action keybindings — napplets forward keystrokes to the shell for global hotkey processing, and register named actions that the shell can bind to keys.

Wire Protocol

Type Direction Description
keys.forward napplet → shell Forward a keystroke to the shell
keys.registerAction napplet → shell Declare a named action the shell can bind
keys.registerAction.result shell → napplet Registration result with assigned binding
keys.unregisterAction napplet → shell Remove a registered action
keys.bindings shell → napplet Push complete binding list on change
keys.action shell → napplet Trigger an action in the napplet

Key Design

Napplets register named actions (e.g., editor.save). The shell owns the keymap and binds keys to actions. The shell pushes binding updates to the napplet via keys.bindings. The napplet's shim maintains a local suppress list — bound keys trigger actions locally with zero latency instead of being forwarded to the shell.

References

  • NIP-5D: Core napplet protocol

Bidirectional keyboard protocol for sandboxed napplet iframes:
- Forwards unbound keystrokes to shell
- Napplet registers named actions; shell binds keys and pushes binding updates
- Smart forwarding: suppress bound keys locally, trigger actions with zero latency
- 6 message types: forward, registerAction, registerAction.result, unregisterAction, bindings, action
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