Extend key patterns and modifiers for command actions #22618

Closed
opened 2026-01-31 08:18:40 +00:00 by claunia · 3 comments
Owner

Originally created by @ridhwaans on GitHub (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

Originally created by @ridhwaans on GitHub (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
claunia added the Issue-FeatureResolution-Duplicate labels 2026-01-31 08:18:40 +00:00
Author
Owner

@zadjii-msft commented on GitHub (Dec 3, 2024):

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 #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?
@zadjii-msft commented on GitHub (Dec 3, 2024): 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 #1334 * part the second: "I want to treat <kbd>space</kbd>" 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?
Author
Owner

@microsoft-github-policy-service[bot] commented on GitHub (Dec 3, 2024):

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[bot] commented on GitHub (Dec 3, 2024): 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! <!-- Policy app identification https://img.shields.io/static/v1?label=PullRequestIssueManagement. -->
Author
Owner

@o-sdn-o commented on GitHub (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

https://github.com/user-attachments/assets/d71a8383-0902-416a-a67e-3e57989fdf15

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:

https://github.com/user-attachments/assets/5585018f-cc15-412b-b389-94367d43ff44

Please note the following while running inside WT:

@o-sdn-o commented on GitHub (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 ``` https://github.com/user-attachments/assets/d71a8383-0902-416a-a67e-3e57989fdf15 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: https://github.com/user-attachments/assets/5585018f-cc15-412b-b389-94367d43ff44 Please note the following while running inside WT: - https://github.com/microsoft/terminal/issues/18223 - https://github.com/microsoft/terminal/issues/18120
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#22618