raphamorim / rio

A hardware-accelerated GPU terminal emulator focusing to run in desktops and browsers.
https://raphamorim.io/rio
MIT License
3.21k stars 103 forks source link

Ability to overwrite / uninstall keybindings #460

Open mt-inside opened 4 months ago

mt-inside commented 4 months ago

Similar to #419 - currently adding a keybinding with the same keys as a built-in one doesn't replace it, it seems to add it to a list. I can see why this behaviour is useful, but I also think the ability to override built-ins in a must. I also plain want to remove some built-in ones, like cmd+W on the mac - just closes the window without confirmation, bang, work gone! It's so easy to hit it when you're going for Ctrl+W (readline delete word). I've lost so much work I've nearly stopped using Rio.

Maybe the solution is a config command that clears the current action(s) for a key { key = "w", with = "super", action = "Clear" }

I then have maximum flexibility to:

I someone wanted to build the partial feature quickly, just changing the behaviour to overwrite (maybe a config option for this) would let me re-configure cmd+W to type "idiot" or something for now 😅

raphamorim commented 4 months ago

Hey @mt-inside thanks for the issue,

Actions None or ReceiveChar doesn't fit for your case? https://raphamorim.io/rio/docs/key-bindings#overwriting

raphamorim commented 4 months ago

Regarding the configuration, if you don't use tmux or similar you can use navigation as plain https://raphamorim.io/rio/docs/navigation#plain

mt-inside commented 3 months ago

Hey @mt-inside thanks for the issue,

Actions None or ReceiveChar doesn't fit for your case? https://raphamorim.io/rio/docs/key-bindings#overwriting

Thanks for the reply!

Action="None" does indeed remove the keybinding. This is great, just what I needed, dunno how I missed that part of the docs.

However I think the docs are a little wrong. Because I hadn't seen Action=None, I was using text="Idiot" just to try to have something intercept Super+W and do something other than close the window. That does add to the existing binding - if I have Rio running tmux, and press Super+W, bang the window's gone, and when I reattach to that tmux, there's the text "Idiot". Is it possible that the overwrite behaviour is matching all three fields (key, with, and action) rather than just key and with ?

mt-inside commented 3 months ago

Regarding the configuration, if you don't use tmux or similar you can use navigation as plain https://raphamorim.io/rio/docs/navigation#plain

Ah cool, I'd missed that too. Do "tabbing" keybindings include Super+Q and Super+W though? I'm fine now because I have the action=None solution, but probably worth clarifying in the docs.