Feature Request: Ability to change what key/key sequence reopens or closes a profile session #21120

Open
opened 2026-01-31 07:33:42 +00:00 by claunia · 4 comments
Owner

Originally created by @datdamnmachine on GitHub (Jan 21, 2024).

Description of the new feature/enhancement

This feature request is related to this feature request:

https://github.com/microsoft/terminal/issues/4379

Essentially, the ability to customize what key/key sequences reopens or closes a profile session. Currently Ctrl+D will close the terminal after exit and "Enter" will restart it. I would like to customize it so that "r" will restart the session and "" or "" will close the session for good. This is what MobaXterm uses and it would be nice to have it consistent as I use both regularly.

Proposed technical implementation details (optional)

Something like this in the json file:

"closeOnExit": "never",
{
"closeKey": "",
"reopenKey": "r"
}

Originally created by @datdamnmachine on GitHub (Jan 21, 2024). # Description of the new feature/enhancement This feature request is related to this feature request: https://github.com/microsoft/terminal/issues/4379 Essentially, the ability to customize what key/key sequences reopens or closes a profile session. Currently Ctrl+D will close the terminal after exit and "Enter" will restart it. I would like to customize it so that "r" will restart the session and "<Return>" or "<Enter>" will close the session for good. This is what MobaXterm uses and it would be nice to have it consistent as I use both regularly. # Proposed technical implementation details (optional) Something like this in the json file: "closeOnExit": "never", { "closeKey": "<Enter>", "reopenKey": "r" }
claunia added the Issue-FeatureHelp WantedProduct-TerminalArea-TerminalControl labels 2026-01-31 07:33:43 +00:00
Author
Owner

@carlos-zamora commented on GitHub (Jan 24, 2024):

Good catch! Thanks for filing this.

@carlos-zamora commented on GitHub (Jan 24, 2024): Good catch! Thanks for filing this.
Author
Owner

@skywalker290 commented on GitHub (Jan 26, 2024):

Can i help on this one?

@skywalker290 commented on GitHub (Jan 26, 2024): Can i help on this one?
Author
Owner

@zadjii-msft commented on GitHub (Feb 1, 2024):

@skywalker290 We probably won't get to this ourselves, so we'd definitely appreciate the help!

I'd caveat all this with the fact that we'll need to brainstorm what the settings would look like in the actual json, so we may change how the setting is parsed on review. I'd guess something like the following would be a good start:

    "profiles": 
    {
        "defaults": 
        {
            "closeOnExit": "never",
            "closeKey": "ctrl+alt+q",
            "reopenKey": "r"
@zadjii-msft commented on GitHub (Feb 1, 2024): @skywalker290 We probably won't get to this ourselves, so we'd definitely appreciate the help! I'd caveat all this with the fact that we'll need to brainstorm what the settings would look like in the actual json, so we may change how the setting is parsed on review. I'd guess something like the following would be a good start: ```json "profiles": { "defaults": { "closeOnExit": "never", "closeKey": "ctrl+alt+q", "reopenKey": "r" ``` * `MTSM_PROFILE_SETTINGS` in https://github.com/microsoft/terminal/blob/main/src/cascadia/TerminalSettingsModel/MTSMSettings.h#L78 already contains all the per-profile settings. * That'd need to get plumbed down to ControlCore: https://github.com/microsoft/terminal/blob/c669afe2a06c6db9a103e81a48cdc5b040d6fcff/src/cascadia/TerminalControl/ControlCore.cpp#L480-L497 * More tricky: we'd have to find a way to also plumb those keys (or the stringification of them) into: https://github.com/microsoft/terminal/blob/c669afe2a06c6db9a103e81a48cdc5b040d6fcff/src/cascadia/TerminalConnection/ConptyConnection.cpp#L457-L470 which is where the message is actually printed
Author
Owner

@skywalker290 commented on GitHub (Feb 23, 2024):

Json format would help with this we can put data into one json structure and send it.

@skywalker290 commented on GitHub (Feb 23, 2024): Json format would help with this we can put data into one json structure and send it.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#21120