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

Add a shortcut action for executing multiple ShortcutActions #5970

Closed
zadjii-msft opened this issue May 18, 2020 · 10 comments
Closed

Add a shortcut action for executing multiple ShortcutActions #5970

zadjii-msft opened this issue May 18, 2020 · 10 comments
Labels
Area-Settings Issues related to settings and customizability, for console or terminal Issue-Task It's a feature request, but it doesn't really need a major design. Product-Terminal The new Windows Terminal. Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing.

Comments

@zadjii-msft
Copy link
Member

Dispatch a whole bunch of commands all at once.

{
    "action": {
        "command": "executeActions",
        "actions": [
            { "action": "newTab", "profile": "Ubuntu" },
            { "action": "splitPane", "split":"auto", "splitMode": "duplicate" },
        ]
    },
    "keys": []
}

We could probably use the same machinery we use for commandline args for this.

@ghost ghost 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 May 18, 2020
@DHowett DHowett added Area-Settings Issues related to settings and customizability, for console or terminal Issue-Task It's a feature request, but it doesn't really need a major design. Product-Terminal The new Windows Terminal. labels May 18, 2020
@ghost ghost removed the Needs-Tag-Fix Doesn't match tag requirements label May 18, 2020
@DHowett
Copy link
Member

DHowett commented May 18, 2020

[Needs-MiniSpec]

@DHowett
Copy link
Member

DHowett commented May 18, 2020

This will be part of Command Palette (#5400), I bet?

@DHowett DHowett removed the Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting label May 18, 2020
@DHowett DHowett added this to the Terminal Backlog milestone May 18, 2020
@damnskippy
Copy link

@zadjii-msft does this allow for mapping a key binding to a set of key input, as noted in #3799?

@zadjii-msft
Copy link
Member Author

@damnskippy Nah, the two issues are pretty atomic. This issue is more along the lines of "I want to press one keybinding and open a new tab, and split that tab into a bunch of panes, and open a couple other tabs, all at once". Theoretically, the two combined could be "open a tab, and send a bunch of input to it, then open another pane, and send input to that one too"

@digitalinfinity
Copy link
Member

@zadjii-msft this feature is ❤️ - in ConEmu, I have a jumplist task to open multiple shell tabs at once. If I understand this issue correctly, until this feature is implemented, that's not possible in terminal today (even if not from the jumplist)?

@carlos-zamora
Copy link
Member

Just a thought, what if we did it like this:

{
    "action": [
        { "action": "newTab", "profile": "Ubuntu" },
        { "action": "splitPane", "split":"auto", "splitMode": "duplicate" },
    ],
    "keys": []
}

Just override action to support an array.

@DHowett
Copy link
Member

DHowett commented Jun 2, 2020

If action supports an array, can you do this?

"action": [
   { "action": [
      { "action": [
         { "action": [
            { "action": [
...

@carlos-zamora
Copy link
Member

Sure, why not? That wouldn't break anything, right? It's just inefficient?

ghost pushed a commit that referenced this issue Jul 17, 2020
…A KEYBINDING (#6537)

## Summary of the Pull Request

Adds a execute commandline action (`wt`), which lets a user bind a key to a specific `wt` commandline. This commandline will get parsed and run _in the current window_. 

## References

* Related to #4472 
* Related to #5400 - I need this for the commandline mode of the Command Palette
* Related to #5970

## PR Checklist
* [x] Closes oh, there's not actually an issue for this.
* [x] I work here
* [x] Tests added/passed
* [ ] Requires documentation to be updated - yes it does

## Detailed Description of the Pull Request / Additional comments

One important part of this change concerns how panes are initialized at runtime. We've had some persistent trouble with initializing multiple panes, because they rely on knowing how big they'll actually be, to be able to determine if they can split again. 

We previously worked around this by ignoring the size check when we were in "startup", processing an initial commandline. This PR however requires us to be able to know the initial size of a pane at runtime, but before the parents have necessarily been added to the tree, or had their renderer's set up.

This led to the development of `Pane::PreCalculateCanSplit`, which is very highly similar to `Pane::PreCalculateAutoSplit`. This method attempts to figure out how big a pane _will_ take, before the parent has necessarily laid out. 

This also involves a small change to `TermControl`, because if its renderer hasn't been set up yet, it'll always think the font is `{0, fontHeight}`, which will let the Terminal keep splitting in the x direction. This change also makes the TermControl set up a renderer to get the real font size when it hasn't yet been initialized.

## Validation Steps Performed

This was what the json blob I was using for testing evolved into

```json
        {
            "command": {
                "action":"wt",
                "commandline": "new-tab cmd.exe /k #work 15 ; split-pane cmd.exe /k #work 15 ; split-pane cmd.exe /k media-commandline ; new-tab powershell dev\\symbols.ps1 ; new-tab -p \"Ubuntu\" ; new-tab -p \"haunter.gif\" ; focus-tab -t 0",

            },
            "keys": ["ctrl+shift+n"]
        }
```

I also added some tests.

# TODO
* [x] Creating a `{ "command": "wt" }` action without a commandline will spawn a new `wt.exe` process?
  - Probably should just do nothing for the empty string
@zadjii-msft
Copy link
Member Author

Oh my god this is a /dup #3992

@ghost
Copy link

ghost commented Sep 27, 2021

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!

@ghost ghost closed this as completed Sep 27, 2021
@ghost ghost added the Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing. label Sep 27, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Settings Issues related to settings and customizability, for console or terminal Issue-Task It's a feature request, but it doesn't really need a major design. Product-Terminal The new Windows Terminal. 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

5 participants