Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend key patterns and modifiers for command actions #18279

Closed
ridhwaans opened this issue Dec 3, 2024 · 3 comments
Closed

Extend key patterns and modifiers for command actions #18279

ridhwaans opened this issue Dec 3, 2024 · 3 comments
Labels
Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing.

Comments

@ridhwaans
Copy link

ridhwaans commented Dec 3, 2024

Description of the new feature

source: https://learn.microsoft.com/en-us/windows/terminal/customize-settings/actions#accepted-modifiers

currently, the accepted modifiers allow for ctrl+, shift+, alt+ followed by a single func or alphanumeric key
in settings.json, if i want to perform an action with the keys ctrl+t+n or win+t+q+q, I cannot do that because of the error "String does not match pattern{...}"

I ask for modifier key followed by a combination of function/alphanumeric keys pattern to work on actions

Also, can you make space+ an accepted modifier so patterns like space+g+g can be used?

thanks in advance!

Proposed technical implementation details

make space+ an accepted modifier. allow for an expression with multiple fn/letter/number keys associated with a terminal action

@ridhwaans ridhwaans added the Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. label Dec 3, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Tag-Fix Doesn't match tag requirements labels Dec 3, 2024
@zadjii-msft
Copy link
Member

So, you're asking for two things here:

  • part the first: "I want to combine multiple key chords to activate a keybinding" I think that's a /dupe of Support "Key Chords" in keybindings #1334
  • part the second: "I want to treat space" as a modifier key: That's probably not reasonably feasible. There's a material API difference in the way Windows thinks about something like Ctrl/Alt/Shift/Win, vs actual keys like space. It would be a non-trivial amount of work for us to treat space as a modifier key. There's a lot of gnarly edge cases there. When is the user pressing space as the start of a keychord vs just pressing and holding space to enter a lot of whitespace?

Copy link
Contributor

Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!

@microsoft-github-policy-service microsoft-github-policy-service bot added Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing. and removed Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Tag-Fix Doesn't match tag requirements labels Dec 3, 2024
@o-sdn-o
Copy link

o-sdn-o commented Dec 3, 2024

  • part the second: "I want to treat space" as a modifier key: That's probably not reasonably feasible. There's a material API difference in the way Windows thinks about something like Ctrl/Alt/Shift/Win, vs actual keys like space. It would be a non-trivial amount of work for us to treat space as a modifier key. There's a lot of gnarly edge cases there. When is the user pressing space as the start of a keychord vs just pressing and holding space to enter a lot of whitespace?

In fact, it is not impossible, and may even be quite feasible. Just relying on the standard system window messages WM_KEYUP/WM_KEYDOWN it is quite possible to distinguish between different key combinations outside the Ctrl/Alt/Shift-modifiers concept on Windows platform.

You can play around with this in vtm by assigning any keyboard chords available to your keyboard device and feel out any inconsistencies like an extra space being typed when using the Space+C chord. For example, you can run the following command to use the Space+C key chord to print a "<Space+C Action>" message in terminal:

vtm -c "<config><hotkeys><terminal><key='Space+C'><action=TerminalSendKey data='<Space+C Action>'/></key></terminal></hotkeys></config>" -r term
sdn@megasus_0.2024-12-03.22-33-36.mp4

You can get the available chords experimentally on the Info-page which is accessible by clicking on the bottom right of the vtm desktop.

Moreover, you can run this directly inside Windows Terminal (using vtm --tui option) and use Space+C chord there:

Command.Prompt.2024-12-03.23-19-45.mp4

Please note the following while running inside WT:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing.
Projects
None yet
Development

No branches or pull requests

3 participants