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

Trigger: Window shown #702

Closed
vegardlarsen opened this issue Feb 8, 2021 · 5 comments
Closed

Trigger: Window shown #702

vegardlarsen opened this issue Feb 8, 2021 · 5 comments
Assignees
Labels
feature Feature suggestion for MaxTo.
Milestone

Comments

@vegardlarsen
Copy link
Member

Describe the solution you'd like
It should be possible to trigger recipes based on when windows are shown or hidden. "Window opened" (which should really be "Window created") does not trigger if the window is created hidden and then shown later.

Additional context
E.g. Notepad does not trigger the "Window opened" trigger today, as the window is created invisible, and then shown later.

@vegardlarsen vegardlarsen added the feature Feature suggestion for MaxTo. label Feb 8, 2021
@vegardlarsen vegardlarsen added this to the 2.2.0 milestone Feb 8, 2021
@vegardlarsen vegardlarsen self-assigned this Feb 8, 2021
@vegardlarsen vegardlarsen modified the milestones: 2.2.0, 2.2.0-beta.2 Feb 16, 2021
@vegardlarsen
Copy link
Member Author

I have implemented a new "Window shown" trigger, which works well. I elected not to do the same for "Window hidden", as I can't really see the use case after thinking it through.

@vegardlarsen vegardlarsen changed the title Trigger: Window shown/hidden Trigger: Window shown Feb 17, 2021
@xairoo
Copy link

xairoo commented Aug 9, 2021

Doesn't seem to work @ 2.2.0.

Tried it with windowsterminal*, works.
windowsterminal.exe didn't worked.

Also using titles like Window PowerShell and so on didn't worked.

Staring a windows terminal worked to trigger the recipe for a few times. Then it stopped.
Now it won't get triggered anymore.

I also launch a few terminals using a simple batch script. The first terminal will benefit from the recipe (move). The others won't.
Now nothing happens. Restarting MaxTo didn't helped.

{
  "enabled": true,
  "name": "terminal auto resize",
  "id": null,
  "triggers": [
    {
      "type": "window:shown",
      "Window": "\\windowsterminal*\\\\"
    }
  ],
  "ingredients": [
    {
      "command": "window:move",
      "parameters": {
        "region": "95%,50%",
        "window": "\\\\\\"
      }
    }
  ]
}

@vegardlarsen
Copy link
Member Author

Hi there, when trying to reproduce this in version 2.2.1; the following recipe works:

{
  "enabled": true,
  "name": "Auto-resize Terminal",
  "id": null,
  "triggers": [
    {
      "type": "window:shown",
      "Window": "\\WindowsTerminal\\\\"
    }
  ],
  "ingredients": [
    {
      "command": "window:move",
      "parameters": {
        "region": "center left"
      }
    }
  ]
}

The only real difference I can see to your recipe, is that I've removed the window parameter to the command.

@xairoo
Copy link

xairoo commented Sep 7, 2021

Currently using this and it's working too:

{
  "enabled": true,
  "name": "autoplace wt",
  "id": null,
  "triggers": [
    {
      "type": "window:shown",
      "Window": "\\\\CASCADIA_HOSTING_WINDOW_CLASS\\"
    }
  ],
  "ingredients": [
    {
      "command": "window:move",
      "parameters": {
        "window": "\\\\CASCADIA_HOSTING_WINDOW_CLASS\\",
        "region": "90%,0"
      }
    }
  ]
}

Your recipe works too.

But the problem still exists if you start multiple terminals using a batch script (guess that will happen with all programs):

start wt.exe -d .
timeout /t 1
start wt.exe -d .
timeout /t 1
start wt.exe -d .
timeout /t 1
start wt.exe -d .

But... message "prevent infinite loops" get's fired.
Timeout has to be 2 seconds to prevent this notice.
Also sometimes the window gets resized - although the notices comes up.
No chance to get all windows resized without the timeout.

@vegardlarsen
Copy link
Member Author

Thanks for the feedback on this. The infinite loops message is a bit annoying, but necessary. It shouldn't trigger in your case though, as it should allow 10 executions before triggering (you are spot on with the timeout, though, it is 2 seconds).

If you can reliably reproduce this with the above recipe and batch scripts, let me know, and I will take a closer look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Feature suggestion for MaxTo.
Projects
None yet
Development

No branches or pull requests

2 participants