-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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
Triggers(Including Text Strings) and Actions (internal or external calls) #5916
Comments
This sounds like a dupe of some other issue dealing with clickable links and scripts...a great extension idea though if it's done like it is in Iterm2. |
x-linking with #12366. Maybe it needs to be closer to "triggers": [
{
"type": "matchRegex",
"match": " git push --set-upstream origin (.*)",
"command": { "action": "sendInput", "input": "git push --set-upstream origin ${match[0]}" }
}
] From iterm2 docs
so that would cover
<hackathon thoughts> But, there's also the concept of the right-click context menu that likely needs to evaluate the actions json when the right click happens, to populate entries accordingly. I suppose these would come with caveats that "using many triggers may substantially impact performance" |
But maybe it shouldn't just be all actions. Cause, the control and the actual terminal core are[1] separated across a process boundry. So, anything that processes raw output from the connection should be handled within the core itself, or be pretty substantially throttled. So for something like: "triggers": [
{
"type": "matchRegex",
"match": "[Ee][Rr][Rr][Oo][Rr]",
"command": { "action": "addMark", "color": "#ff0000" }
}
] the action would either need:
After typing that up, the first seems easier, but comes with some limitations. Like, you wouldn't be able to request a new tab on a trigger. Probably fine, but meh. Cause [1]: will be* technically, but whatever I'm almost done with that work so let's work on that assumtion. |
<showerthought> A trigger action could be "turn the matched text into a clickable link". The tricky bit is that those issues have lots of variations:
#9583 could help power this though |
Even if we bubble up "we hit trigger 5" to the pane, and the pane generate the "experimental.triggers": [
{
"type": "matchRegex",
"match": "Terminate batch job \\(Y/N\\)",
"command": { "action": "sendInput", "input": "y\n" }
}
] then we've got a background pane that triggers it, and oh no! the active pane gets some I wonder if there's a non-dumb way to refactor actions s.t. we could have certain actions that operate on a pane, and call a dispatch with a pane context. Hmm. |
Oh, that's annoying though, cause this doesn't work nicely with
|
This would surely cause a definite perf hit, but hey maybe you're the kind of person who doesn't care about that too much? This is at the very least, a pretty compelling PoC "experimental.triggers": [
{
"type": "matchRegex",
"match": "Terminate batch job \\(Y/N\\)",
"command": { "action": "sendInput", "input": "y\r\n" }
},
{
"type": "matchRegex",
"match": "[Ee][Rr][Rr][Oo][Rr]",
"command": { "action": "addMark", "color": "#ff0000" }
},
{
"type": "matchRegex",
"match": "'(.*)' is not recognized as an internal or external command,",
"command": { "action": "sendInput", "input": "winget-install ${match[1]}" }
},
] |
Note from trying to fall asleep last night:
A Could I be even crazier: {
"match": "[Ee][Rr][Rr][Oo][Rr]",
"action": "addMark",
"color": "#ff0000"
},
{
"match": "Terminate batch job \\(Y/N\\)",
"action": "sendInput",
"input": "y\r\n"
},
{
"match": "git push --set-upstream origin ([^\\w]*)",
"action": "sendInput",
"input": "git push --set-upstream origin ${match[1]}\r"
},
{
"match": "'(.*)' is not recognized as an internal or external command,",
"action": "checkWinGet",
"commandline": "${match[1]}"
},
{
"match": "This will open a new Terminal tab",
"action": "newTab"
},
And we can probably reuse some of the macros in
If We find that the I put the spec into |
Description of the new feature/enhancement
A Trigger system that will monitor several types o events, including text strings on the screen, that will be able to call several types of actions, like scripts, commands, or any resources possible of Windows Terminal.
Proposed technical implementation details (optional)
"Nothing is created, everything is copied."
As you you may see, I'm a fan of iTerm2, my buddy for several years.
But I like this new Microsoft Style, so I'm trying to help.
The Suggestion her is a bit bold.
Provide an complementar Framework that will allow user execute almost any possible predefined action based on almost any event on the Windows Terminal.
A sub-system the will be monitoring events, and if it matches with some pre-activated event, it will trigger the action.
The triggers could be a simple match with a string on the text, or even something like an server-ended-session if it was an SSH/Telnet connection.
The actions could be the automatic highlight of the text, a long beep, open a new tab, or call an external app passing some parameters and receiving back some answer.
As I'm not a developer, and also not good with descriptions like these, I will bring the description of this Feature in iTerm2:
https://www.iterm2.com/documentation-one-page.html#documentation-triggers.html
The text was updated successfully, but these errors were encountered: