Provide a means to dump / export all currently active keyboard shortcuts #20474

Closed
opened 2026-01-31 07:14:50 +00:00 by claunia · 4 comments
Owner

Originally created by @sba923 on GitHub (Sep 13, 2023).

Description of the new feature/enhancement

It would be useful to be able to export / dump all currently active keyboard shortcuts (both the built-in ones and the ones defined by the user) to a file.

This would help, among others, in the following scenario:

  1. The user is running PowerShell within Windows Terminal
  2. The user wants to define a new keyboard shortcut using Set-PSReadLineKeyHandler, using the documentation at https://learn.microsoft.com/en-us/powershell/module/psreadline/set-psreadlinekeyhandler?view=powershell-7.3
  3. The user discovers that this doesn't work (e.g., the example that uses -Chord Ctrl+B)
  4. The user presumes that this might be related to Windows Terminal intercepting that shortcut
  5. The user looks for a "free" shortcut that is not used by Windows Terminal, and not already used by PSReadLine (the latter can be easily determined using (Get-PSReadLineKeyHandler).Key | Sort-Object -Unique)

Of course, this won't help determining shortcuts that are defined elsewhere than by Windows Terminal. But still, that would help IMVHO.

Proposed technical implementation details (optional)

Originally created by @sba923 on GitHub (Sep 13, 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 <!-- A clear and concise description of what the problem is that the new feature would solve. Describe why and how a user would use this new functionality (if applicable). --> It would be useful to be able to export / dump all currently active keyboard shortcuts (both the built-in ones and the ones defined by the user) to a file. This would help, among others, in the following scenario: 1. The user is running PowerShell within Windows Terminal 2. The user wants to define a new keyboard shortcut using `Set-PSReadLineKeyHandler`, using the documentation at https://learn.microsoft.com/en-us/powershell/module/psreadline/set-psreadlinekeyhandler?view=powershell-7.3 3. The user discovers that this doesn't work (e.g., the example that uses `-Chord Ctrl+B`) 4. The user presumes that this might be related to Windows Terminal intercepting that shortcut 5. The user looks for a "free" shortcut that is not used by Windows Terminal, and not already used by `PSReadLine` (the latter can be easily determined using `(Get-PSReadLineKeyHandler).Key | Sort-Object -Unique`) Of course, this won't help determining shortcuts that are defined elsewhere than by Windows Terminal. But still, that would help IMVHO. # Proposed technical implementation details (optional) <!-- A clear and concise description of what you want to happen. -->
claunia added the Issue-FeatureNeeds-TriageNeeds-Tag-FixNeeds-Attention labels 2026-01-31 07:14:51 +00:00
Author
Owner

@zadjii-msft commented on GitHub (Sep 20, 2023):

Here's a thought - would it just be easier to make the Actions page of the Settings UI be searchable by keybinding/? (ala #11630) That page obviously needs some love, but that seems like a more holistic solution then dumping to a file

@zadjii-msft commented on GitHub (Sep 20, 2023): Here's a thought - would it just be easier to make the Actions page of the Settings UI be searchable by keybinding/? (ala #11630) That page obviously needs some love, but that seems like a more holistic solution then dumping to a file
Author
Owner

@sba923 commented on GitHub (Sep 21, 2023):

Well, that would allow for a rather manual iterative process to find an available keybinding, where you would search for one, discover it's used, then make up another one, and loop until you find one that's not used.

Call me a script freak, but I was thinking about something that would consume the list of keybindings used by PSReadLine, and the list of keybindings used by Windows Terminal, and spit out the list of keybindings that are on neither...

@sba923 commented on GitHub (Sep 21, 2023): Well, that would allow for a rather manual iterative process to find an available keybinding, where you would search for one, discover it's used, then make up another one, and loop until you find one that's not used. Call me a script freak, but I was thinking about something that would consume the list of keybindings used by PSReadLine, and the list of keybindings used by Windows Terminal, and spit out the list of keybindings that are on neither...
Author
Owner

@carlos-zamora commented on GitHub (Sep 27, 2023):

Thanks @sba923. We've discussed this as a team and we're actually going to close this out. We hope to improve the Actions page in the Settings UI to make keyboard shortcuts searchable. That should help. With regards to making this work with PowerShell, you could theoretically get the JSON file and get the data that way, but you'll run into inheritance issues where the settings.json gets layered with the default settings saved in defaults.json. This could be an extension, but it's not something we're interested in shipping in Terminal.

@carlos-zamora commented on GitHub (Sep 27, 2023): Thanks @sba923. We've discussed this as a team and we're actually going to close this out. We hope to improve the Actions page in the Settings UI to make keyboard shortcuts searchable. That should help. With regards to making this work with PowerShell, you could theoretically get the JSON file and get the data that way, but you'll run into inheritance issues where the settings.json gets layered with the default settings saved in defaults.json. This could be an extension, but it's not something we're interested in shipping in Terminal.
Author
Owner

@sba923 commented on GitHub (Sep 30, 2023):

Point taken.

I have started to write a Get-WindowsTerminalShortcut.ps1 that gets the actions from both defaults.json and settings.json (BTW how does one determine their location for the currently running instance of Windows Terminal from PowerShell?).

I know this is getting off-topic, but this reveals that Ctrl+B is not bound to any action in Windows Terminal, so the reason why the example in the PSReadLine documentation doesn't work must be something else...

image

...confirmed by testing outside Windows Terminal (Task Manager / Ctrl+Run new task / pwsh --noprofile is how I managed to circumvent the fact I have set Windows Terminal as the default console).

@sba923 commented on GitHub (Sep 30, 2023): Point taken. I have started to write a `Get-WindowsTerminalShortcut.ps1` that gets the actions from both `defaults.json` and `settings.json` (BTW how does one determine their location for the currently running instance of Windows Terminal from PowerShell?). I know this is getting off-topic, but this reveals that `Ctrl+B` is _not_ bound to any action in Windows Terminal, so the reason why the example in the `PSReadLine` documentation doesn't work must be something else... ![image](https://github.com/microsoft/terminal/assets/12860484/694c09b9-d42f-41ec-ab47-21f41876e21f) ...confirmed by testing outside Windows Terminal (Task Manager / Ctrl+Run new task / `pwsh --noprofile` is how I managed to circumvent the fact I have set Windows Terminal as the default console).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#20474