enigo
enigo copied to clipboard
Mouse on multiple monitors
Currently mouse_move doesn't take a screen parameter, which is necessary to be able to specify which monitor.
It seems to me that at the beginning we should consider how we approach this problem, personally I see 3 options.
-
Retrieve all monitors, their resolution, positions (if possible) and based on these parameters place the cursor. It seems quite difficult in the case of Windows, it's probably a bit easier in Linux, and I don't know about macOS. -> There is (probably) a problem with different approaches to managing monitors by various operating systems.
-
Extract an interface for setting up the monitors eg:
get_screens()
set_screen(num)
-
Combine both methods. If you don't set up the monitor manually
set_screen(num)
, scenario one will be implemented, which may facilitate navigation on the monitor. -> 2 Full HD monitors are already x 3840 and y 2160, so using the choice of a specific monitor may make life easier.
Is there update on this? Is it possible to control mouse on another screen now? @jD91mZM2 @nexthis
I became the maintainer of this project. No need to ping the others. If they are still interested, the subscribed to the issue and will be notified about any activity on this issue anyways.
There has not been an update on this and it will take at least a couple of months before I will find the time to look into it. Right now I am trying to provide the features we currently support on as many platforms as possible. All issues are updated whenever there is anything newsworthy. No need to ask for an update :-)
If you have a multi-monitor setup with screens of the same resolution, there is a simple workaround to control the mouse on another screen. You can just offset the coordinates by the width or height of your screen, depending on your setup.
For instance, let's say your first screen for enigo is on the left, and your second screen is on the right. By offsetting the x coordinates by 1920 (assuming a screen width of 1920 pixels, of course), you can interact with the second screen.
This allows you to navigate and interact with specific monitors without explicitly specifying the screen parameter in the mouse_move function. Hope this helps ❤️
If you have a multi-monitor setup with screens of the same resolution, there is a simple workaround to control the mouse on another screen. You can just offset the coordinates by the width or height of your screen, depending on your setup.
For instance, let's say your first screen for enigo is on the left, and your second screen is on the right. By offsetting the x coordinates by 1920 (assuming a screen width of 1920 pixels, of course), you can interact with the second screen.
This allows you to navigate and interact with specific monitors without explicitly specifying the screen parameter in the mouse_move function. Hope this helps ❤️
Thanks @FolfyBlue , but I can't make that assumption. There can be different screen sizes and they don't even align properly.
Multi-monitor setups work as expected for me. (Tested on Windows, please test on other systems.)
I can use coordinates that are relative to the main monitor. For example, if I have two monitors, arranged like this, then (0,0) is in the top left corner of the main monitor.
If I move the mouse more than 1920 px to the right, I'll end up on the right monitor. And from there, I can move the mouse up, giving me negative coordinates.
@stefnotch This works on Mac, but this require prior information on the position of screens, right? If we know their sizes and relative positions, then we can easily compute a screen parameter. Do you know if there is a library for this?
@HuakunShen I personally use https://github.com/nashaofu/display-info/ for that and was quite happy with it.