Repository navigation
Let a plugin view claim its keys the way Paseo's terminal does #7669
stevecastaneda
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
What I'm trying to do
My plugin Shell Yeah runs shell commands in the chat, and you can type into a running one the way you would in a terminal. That covers a password prompt, a 2FA code, or a setup wizard. A hidden input inside the output box takes the keys and sends them to the command.
Where Paseo gets in the way
On Linux and Windows, Paseo's Ctrl shortcuts fire before the plugin's input sees the key. Two of them collide with keys people press in a terminal:
The plugin can't stop this. Paseo's listener runs in the capture phase on
window(packages/app/src/hooks/use-keyboard-shortcuts.ts) and stops the event. Paseo's own terminal avoids the problem becauseresolveKeyboardFocusScopetreats anything inside[data-testid='terminal-surface']or.xtermas the terminal scope, and those Ctrl shortcuts are gated withterminal: false.@getpaseo/pluginhas nothing for shortcuts or focus scopes.Putting
testID="terminal-surface"on the box while it takes keys fixes it. I tested that and didn't ship it, because it's a test ID rather than a contract, and a later version could hang other terminal behavior on it.I hit this on 0.11.2. The same check is still there in v0.13.0-beta.1.
What a better workflow would look like
A supported way for a plugin to say that keys inside a view belong to it, the way they belong to Paseo's terminal. Either of these would work:
data-paseo-terminal, thatresolveKeyboardFocusScopereads next toterminal-surface.@getpaseo/plugin/client, for example<TerminalScope>.The terminal scope's current rules already fit. Cmd shortcuts on the Mac keep working inside it, and only the Ctrl shortcuts that collide stand aside.
Related: #5979 asks for plugin shortcuts and mentions clashes with Paseo's focus scopes. This is the other direction.
All reactions