Skip to content

Add Enable/Disable actions alongside "Toggle pane read-only mode" #14415

@ev-dev

Description

@ev-dev

Description of the new feature/enhancement

Two additional terminal actions:

  • Enable pane read-only mode
  • Disable pane read-only mode

Reasoning

I make use of the Read-Only mode occasionally, usually whenever I have multiple terminal windows open and a long-running command running in one which prevents me from accidentally hitting "Ctrl+C" in the unintended window.

Read-Only mode has the nice feature of showing a padlock icon next to the pane's title whenever Read-Only mode is active, but of course this helpful hint is not visible if the terminal is in Full-Screen mode.

Whenever that scenario (toggling read-only mode in a fullscreen window) comes up for me, I'll usually just hit space, which will show a pop-up if the pane is in Read-Only mode, and if no pop-up is shown, I'll know to run the action to toggle read-only mode.

I think it would be helpful to have the 2 actions I proposed above, neither of which should care whether Read-Only mode is already active or not, and then internally either perform the toggle of read-only mode, or noop. These actions would provide a more assured method of setting the intended mode for a pane and don't need to prompt the user.

Proposed technical implementation details (optional)

My current workaround is a custom terminal action (defined in my settings.json):

"actions": [
    {
        "name": "Toggle pane read-only mode (w/check)",
        "keys": "alt+r",
        "command": {
            "action": "multipleActions",
            "actions": [
                { "action": "toggleReadOnlyMode" },
                { "action": "sendInput", "input": " " }
            ]
        }
    },
]

This gives action provides an indication of the Read-Only mode state of a pane by forcefully showing the "Read-only mode is enabled" pop-up after sending a space, and if nothing happens when I run the action, I know I need to run it again.

I couldn't find any mechanism of setting/retrieving the current state of a pane's read-only mode, so I wasn't able to figure out an alternative solution for myself (for instance, defining a PowerShell function to check/toggle the read-only mode state, which could maybe be used in a Terminal action)

Given that the "Toggle pane read-only mode" is a pretty stable feature, it may be pretty simple to add these additional actions within the source code here. I'll give it my best shot and report back but I wanted to see if anyone had an opinion/suggestion as well.

Thanks to all the contributors for all the great work you do on this project!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-SettingsIssues related to settings and customizability, for console or terminalHelp WantedWe encourage anyone to jump in on these.In-PRThis issue has a related PRIssue-TaskIt's a feature request, but it doesn't really need a major design.Needs-Tag-FixDoesn't match tag requirementsProduct-TerminalThe new Windows Terminal.good first issueThis is a fix that might be easier for someone to do as a first contribution

    Type

    No type

    Projects

    Status

    Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions