littledivy/autopilot-deno

Feature Request: Detect multiple Screens

tionis opened this issue · 15 comments

A function to detect if there are multiple displays would be much appreciated. Maybe even the Orientation of these.

@tionis This is something I would want to implement. It would be hard for me to implement this as I don't use multi-displays. Although, I think .screenSize should give the size of both the screens.
Could you try .screenSize in a multi display env?

it returns the complete size - like if you made a screenshot of all screens at once at just got the size from it

I can verify this. This is also in line with the behaviour I experienced with other automation libraries

I think that's just how it was made. You would probably need to implement a different approach per system as I think win and linux will have a different system (in linux, you could probably just read xrandr config, don't know about windows)

Could you confirm moveMouse on a multi display env? (Try setting negative values)
It's hard for me to support dual screen as I don't use them. Any PR is appreciated :)

moveMouse works correctly, there's no need for negative values since the position is always positive.
I'm on Debian if that matters

Alright. So I guess there's no problem with Dual screens supporting autopilot. Just detecting it is an issue.

A nice think would be to have a method return array of screens (like with name, size etc)

But we don't actually have a way to do that. The low level C libs used don't provide that information.

I know you can get that info on linux from xrandr (this works almost on every distro)

So I've used xrandr to get the number of monitors (in Linux).
For Win and Mac, It returns 1.

pilot.getMonitors();

This will be available in the next release.

Now, the challenge is to make it cross-platform. Any suggestions and PRs are welcomed.

https://github.com/divy-work/autopilot-deno/releases/tag/v0.1.1 makes it cross-platform (hopefully). It's quite unstable and would require to cross-check from Windows and Mac users. Closing this issue as the feature is implemented