terminal
terminal copied to clipboard
Keybind disable mode
Description of the new feature/enhancement
There should be a way to allow "passthrough" of keybindings to the terminal session - for example, the keybinding Ctrl+Shift+↓ is used in Terminal to resize a pane, but it's also used by the Linux terminal multiplexer BYOBU to resize panes.
I envision something like a command in the palette to disable Terminal keybindings and allow then to pass through to the terminal itself. This command would automatically disable "focus mode" (since there'd be no way to exit focus mode again) and would be a toggle.
I searched around in existing open/closed tickets as well as the documentation to see if something like this already exists, and as far as I can tell it doesn't. #5790 is somewhat related, in that it could be a "workaround" for this feature.
Proposed technical implementation details (optional)
I imagine it'd be a fairly simple matter to have an early exit in the keybind handling code to check if this mode is enable, and if so act as if there are no keybindings.
You could try just disabling the keybindings that you don't want the terminal to use. I'm imagining that if you're using byobu, then you probably aren't using the panes in the Terminal. You could just unbind those specific keys:
{ "command": "unbound", "keys": "ctrl+shift+down" },
{ "command": "unbound", "keys": "ctrl+shift+up" },
wait hold up
for example, the keybinding Ctrl+Shift+↓ is used in Terminal to resize a pane
Resizing panes should be on Ctrl+Shift+{arrow}:
{ "command": { "action": "resizePane", "direction": "down" }, "keys": "alt+shift+down" },
{ "command": { "action": "resizePane", "direction": "left" }, "keys": "alt+shift+left" },
{ "command": { "action": "resizePane", "direction": "right" }, "keys": "alt+shift+right" },
{ "command": { "action": "resizePane", "direction": "up" }, "keys": "alt+shift+up" },
Disabling all keybindings seems like a pretty big hammer for this scenario
Hmm, then perhaps the solution is more in the issue I linked which would allow profiles to override keybindings. I use byobu on some WSL and SSH connections, but definitely not on all of my profiles. I use Terminal panes in some profiles. And regardless of whether my keybindings is default doesn't change that for some people the terminal keybindings are going to intersect with some client application keybindings at some point. Perhaps my approach is heavy-handed, but that doesn't mean the problem isn't valid.
Such a feature will also help with Midnight Commander. Either per profile setting, or a toggle, toggle passthrough on/off.
Crazy thought that's going to sound like half a thought:
I've toyed around in my head with having different keymaps in the past, and letting the user just set their keymap to one of a pre-defined set, then apply keybindings on top of that keymap. So what if there was just a keymap with no keys defined, and then an action for "setKeymap" or something, that would let you hot-swap between keymaps. But then you'd need two keybindings - one for setKeymap(keymap=empty), and another for setKeymap(keymap=default).
See also #2205
From #17055:
I use Vim in Windows Terminal and there's some keys conflicting. I know that I can unbind these keys so that I can use them in Vim, and I know that I can changes these keys binding to other if I still need these helpful actions provided by this amazing project.
However, if I don't want to disrupt the default key bindings (since I'm not able to manage so many keys and I'd believe the default key bindings are assigned more logically), then I hope there's a toggling key to allow me to disable any other key bindings defined default in Windows Terminal when I use Vim or other applications and then enable it again when I need these default bindings.
Sure, this may not be the best way. But this is the best alternative that I can imagine. So it'd be highly appreciated if there're better ways to achieve my will.