SkipCommand and SendSequence like vscode? #20127

Closed
opened 2026-01-31 07:04:23 +00:00 by claunia · 10 comments
Owner

Originally created by @leolbyy on GitHub (Jun 21, 2023).

Description of the new feature/enhancement

Currently Windows Terminal does not allow arbitrary keybindings when connecting to linux server or using WSL2 on Windows. For example, currently I don't see a way to set alt+d / win+d to logout when connecting to linux CLI. VSCode however can achieve that by SkipCommand and SendSequence (set alt+d to send sequence of text "\u0004"). Would be nice if Windows Terminal can do the same. (For SkipCommand, just let the system handle the keybindings)

Originally created by @leolbyy on GitHub (Jun 21, 2023). <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 I ACKNOWLEDGE THE FOLLOWING BEFORE PROCEEDING: 1. If I delete this entire template and go my own path, the core team may close my issue without further explanation or engagement. 2. If I list multiple bugs/concerns in this one issue, the core team may close my issue without further explanation or engagement. 3. If I write an issue that has many duplicates, the core team may close my issue without further explanation or engagement (and without necessarily spending time to find the exact duplicate ID number). 4. If I leave the title incomplete when filing the issue, the core team may close my issue without further explanation or engagement. 5. If I file something completely blank in the body, the core team may close my issue without further explanation or engagement. All good? Then proceed! --> # Description of the new feature/enhancement Currently Windows Terminal does not allow arbitrary keybindings when connecting to linux server or using WSL2 on Windows. For example, currently I don't see a way to set alt+d / win+d to logout when connecting to linux CLI. VSCode however can achieve that by SkipCommand and SendSequence (set alt+d to send sequence of text "\u0004"). Would be nice if Windows Terminal can do the same. (For SkipCommand, just let the system handle the keybindings)
claunia added the Issue-QuestionNeeds-TriageResolution-AnsweredNeeds-Attention labels 2026-01-31 07:04:23 +00:00
Author
Owner

@lhecker commented on GitHub (Jun 21, 2023):

Both of these already exist. For SendSequence you can use:

{
  "command": {
    "action": "sendInput",
    "input": "\u0004"
  },
  "keys": "alt+d"
}

For SkipCommand you can use:

{
    "command": "unbound",
    "keys": "alt+d"
}

They're documented here: https://learn.microsoft.com/en-us/windows/terminal/customize-settings/actions

@lhecker commented on GitHub (Jun 21, 2023): Both of these already exist. For SendSequence you can use: ```json { "command": { "action": "sendInput", "input": "\u0004" }, "keys": "alt+d" } ``` For SkipCommand you can use: ```json { "command": "unbound", "keys": "alt+d" } ``` They're documented here: https://learn.microsoft.com/en-us/windows/terminal/customize-settings/actions
Author
Owner

@leolbyy commented on GitHub (Jun 21, 2023):

Both of these already exist. For SendSequence you can use:

{
  "command": {
    "action": "sendInput",
    "input": "\u0004"
  },
  "keys": "alt+d"
}

For SkipCommand you can use:

{
    "command": "unbound",
    "keys": "alt+d"
}

They're documented here: https://learn.microsoft.com/en-us/windows/terminal/customize-settings/actions

Hi, thanks a lot for the reply. The "sendInput" command works just as I expected and have solved many of my problems, but seems like the unbound is still different from what I wanted.

In the document you provided, it seems what "unbound" function do is to skip system shortcut so that shorcut can be handled by WSL, while what SkipCommand in VSCode do is skip sending shortcut to WSL and let VSCode (system) handle the shortcut. (In windows terminal cannot disable ctrl+c for command interruption in WSL).

Maybe any other information I'm missing?

@leolbyy commented on GitHub (Jun 21, 2023): > Both of these already exist. For SendSequence you can use: > > ```json > { > "command": { > "action": "sendInput", > "input": "\u0004" > }, > "keys": "alt+d" > } > ``` > > For SkipCommand you can use: > > ```json > { > "command": "unbound", > "keys": "alt+d" > } > ``` > > They're documented here: https://learn.microsoft.com/en-us/windows/terminal/customize-settings/actions Hi, thanks a lot for the reply. The "sendInput" command works just as I expected and have solved many of my problems, but seems like the unbound is still different from what I wanted. In the document you provided, it seems what "unbound" function do is to skip system shortcut so that shorcut can be handled by WSL, while what SkipCommand in VSCode do is skip sending shortcut to WSL and let VSCode (system) handle the shortcut. (In windows terminal cannot disable ctrl+c for command interruption in WSL). Maybe any other information I'm missing?
Author
Owner

@DHowett commented on GitHub (Jun 21, 2023):

There is no concept of a "system" shortcut here. Everything is handled by either the terminal emulator or the console infrastructure underneath it :)

That means:

  1. If something is bound, Terminal handles it. Always.
  2. If something is unbound, Terminal passes it down to the console infrastructure. Always.
    • The console infrastructure gets the first say in what happens after this.
    • It handles translating, e.g. turning a Right Arrow key into VK_RIGHT or \e[C
    • It handles the termination signal, which cannot be changed from 0x03 (Ctrl+C)

Perhaps somewhat puzzlingly, I think you can effectively disable Ctrl+C by putting it in the first category... with an action that does nothing (such as sendInput with no input (!))

@DHowett commented on GitHub (Jun 21, 2023): There is no concept of a "system" shortcut here. Everything is handled by either the terminal emulator or the console infrastructure underneath it :) That means: 1. If something is bound, Terminal handles it. Always. 2. If something is `unbound`, Terminal passes it down to the console infrastructure. _Always._ * The console infrastructure gets the first say in what happens after this. * It handles translating, e.g. turning a Right Arrow key into `VK_RIGHT` or `\e[C` * It handles the termination signal, _which cannot be changed_ from `0x03` (<kbd>Ctrl+C</kbd>) Perhaps somewhat puzzlingly, I think you can effectively disable <kbd>Ctrl+C</kbd> by putting it in the first category... with an action that does nothing (such as `sendInput` with no input (!))
Author
Owner

@zadjii-msft commented on GitHub (Jun 21, 2023):

(we might reject sendInput without input... but there's gotta be some action that will always noop. If there isn't, maybe this should be converted into a request for one)

@zadjii-msft commented on GitHub (Jun 21, 2023): (we might reject `sendInput` without `input`... but there's gotta be _some_ action that will always noop. If there isn't, maybe this should be converted into a request for one)
Author
Owner

@leolbyy commented on GitHub (Jun 21, 2023):

Yeah.. sendInput without input (null) is exactly the thing I tried but get rejected as input is a required parameter.

Actully "Ctrl+C" is bounded to copy in default setting.json but it still get passed down to WSL.

Seems like it's being handled both by terminal and WSL. (But maybe terminal only handle it when under text selection? I'm not sure just guessing)

@leolbyy commented on GitHub (Jun 21, 2023): Yeah.. `sendInput` without input (null) is exactly the thing I tried but get rejected as input is a required parameter. Actully "Ctrl+C" is bounded to copy in default setting.json but it still get passed down to WSL. Seems like it's being handled both by terminal **and** WSL. (But maybe terminal only handle it when under text selection? I'm not sure just guessing)
Author
Owner

@zadjii commented on GitHub (Jun 21, 2023):

maybe terminal only handle it when under text selection

That's exactly correct ☺️

@zadjii commented on GitHub (Jun 21, 2023): > maybe terminal only handle it when under text selection That's exactly correct ☺️
Author
Owner

@DHowett commented on GitHub (Jun 21, 2023):

If there isn't, maybe this should be converted into a request for one

Fair enough.

I would not be too inclined to have a "disable this key forever" key binding. I can't see a use case for it and I wouldn't necessarily take a pull request that added it. It would be a special case (we don't want to show it in the command palette, for example...) for little gain.

@leolbyy what specific thing are you trying to accomplish?

@DHowett commented on GitHub (Jun 21, 2023): > If there isn't, maybe this should be converted into a request for one Fair enough. I would not be too inclined to have a "disable this key forever" key binding. I can't see a use case for it and I wouldn't necessarily take a pull request that added it. It would be a special case (we don't want to show it in the command palette, for example...) for little gain. @leolbyy what specific thing are you trying to accomplish?
Author
Owner

@leolbyy commented on GitHub (Jun 22, 2023):

I want it just for customized keyboard shortcut. I grow up with Windows XP and ctrl+c is simply the shortcut the use the most.

Therefore I want to change interruption to alt+c and disable ctrl+c and meantime it helps keep the layout roughly the same as Mac.

If there is such functionality, it will allow user to arbitrary keybindings.

@leolbyy commented on GitHub (Jun 22, 2023): I want it just for customized keyboard shortcut. I grow up with Windows XP and ctrl+c is simply the shortcut the use the most. Therefore I want to change interruption to alt+c and disable ctrl+c and meantime it helps keep the layout roughly the same as Mac. If there is such functionality, it will allow user to arbitrary keybindings.
Author
Owner

@carlos-zamora commented on GitHub (Jun 28, 2023):

Hi @leolbyy. Thanks for filing and the continued discussion. After a bit of discussion on the team, we're ok with the idea of making the keyboard shortcuts configurable, but not with the SkipCommand action aspect.

We're going to track making all of the line discipline keybindings configurable in a different issue. @lhecker will create it and post the link in this issue :)

@carlos-zamora commented on GitHub (Jun 28, 2023): Hi @leolbyy. Thanks for filing and the continued discussion. After a bit of discussion on the team, we're ok with the idea of making the keyboard shortcuts configurable, but not with the `SkipCommand` action aspect. We're going to track making all of the line discipline keybindings configurable in a different issue. @lhecker will create it and post the link in this issue :)
Author
Owner

@lhecker commented on GitHub (Jun 28, 2023):

I opened #15629 now. 🙂

@lhecker commented on GitHub (Jun 28, 2023): I opened #15629 now. 🙂
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#20127