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

[multi-monitor] moveMouse wont move to negative position on mac #88

Closed
bradparks opened this issue Sep 17, 2015 · 18 comments · Fixed by #307
Closed

[multi-monitor] moveMouse wont move to negative position on mac #88

bradparks opened this issue Sep 17, 2015 · 18 comments · Fixed by #307

Comments

@bradparks
Copy link

@bradparks bradparks commented Sep 17, 2015

Hey... I use getMousePos to get the mouse position, and it returns negative values sometimes (multiple monitors above my laptop monitor).

I then try and use robot.moveMouse(800, -954) for example, and it only moves to 800, 0.

@Deltatiger
Copy link
Collaborator

@Deltatiger Deltatiger commented Sep 18, 2015

@bradparks The negative mouse coordinates happen in a multi monitor setup. Basically anything left of your primary display may have negative coordinates.
As for the failing moveMouse did you try anything less than -954 ? If you had got (500 , -300) then you can go negative only on the y axis. Also you can only go till the screen max.

If you could provide more details on what you got from moveMousePos , what your arguments for moveMouse and the screen sizes , you can get a better answer.

@octalmage octalmage added the bug label Sep 22, 2015
@octalmage
Copy link
Owner

@octalmage octalmage commented Oct 4, 2015

The issue is that the code doesn't have explicit multi-monitor support, so anything that works is kind of on accident. I don't think this is an issue on Windows, but for Mac I'll need to look into it.

@octalmage octalmage changed the title moveMouse wont move to negative position on mac [multi-monitor] moveMouse wont move to negative position on mac Nov 3, 2015
@Deltatiger
Copy link
Collaborator

@Deltatiger Deltatiger commented Nov 3, 2015

I think this should be made uniform across all platforms. As you said it is still a hack in Windows. Should probably get the monitor sizes before making the mouse move or throw some kind of error. That would be better.

@octalmage
Copy link
Owner

@octalmage octalmage commented Nov 4, 2015

I agree. I guess we'll need to start with adding c functions to get the number of monitors and their sizes.

@harrisrobin
Copy link

@harrisrobin harrisrobin commented Oct 29, 2016

Would be nice to have this!
Wish I could help.

@YanDevDe
Copy link

@YanDevDe YanDevDe commented Oct 11, 2017

any update of this?

@jareddgotte
Copy link

@jareddgotte jareddgotte commented Dec 24, 2017

I messed around with the code enough to get getPixelColor() working on Windows 10 with 2 monitors. However, in the process of doing so, I've discovered that getting multi-monitor support for every feature would be a massive undertaking. Just about everything in the src folder makes the assumption that the user only needs to operate within their primary display. In @octalmage's defense, though, it appears these files were forked from autopy—most of which haven't been updated in ~8 years.

@marcofugaro
Copy link

@marcofugaro marcofugaro commented Jan 29, 2018

This is the only really big issue I'm having with this library, really wish it was implemented

@friksa
Copy link

@friksa friksa commented Apr 11, 2018

+1

@marcofugaro
Copy link

@marcofugaro marcofugaro commented Apr 12, 2018

At the end I worked around this issue like this, after having done brew install cliclick (link)

const { exec } = require('child_process')
exec('cliclick c:.')

@Louis-7
Copy link

@Louis-7 Louis-7 commented Jul 10, 2019

This helps ->Does not support multiple monitors #26
I install the robotjs with npm install git+https://git@github.com:Toinane/robotjs.git --save- dev and rebuild for electron. Find it support multi-screen now.
Thanks, @romanrandom.

@Toinane
Copy link

@Toinane Toinane commented Jul 10, 2019

The real work was from @jdan as you can see here : https://github.com/Toinane/robotjs/commits?author=jdan from his fork https://github.com/jdan/robotjs
But yes my fork will work too @Louis-7 👍

@Louis-7
Copy link

@Louis-7 Louis-7 commented Jul 10, 2019

@Toinane thanks you for clarifying. Also like your color picker, it inspires me to build something for the designer.

@jdan, thanks!

@teaxio
Copy link

@teaxio teaxio commented Jan 31, 2021

Hi all, i truly love this library. I'm a little late to the conversation, but I ran into mouse movement issue for multiple external displays as well. I need to support it on multiple operating systems. Are we saying this is a limitation that needs to be accepted with RobotJS?

@jkeat
Copy link

@jkeat jkeat commented Aug 31, 2021

@teaxio Did you find any workarounds for the multi-monitor issue?

@amcneel
Copy link

@amcneel amcneel commented Aug 31, 2021

@jkeat Did you happen to find any workarounds for the multi-monitor issue?

@teaxio
Copy link

@teaxio teaxio commented Sep 1, 2021

@jkeat no my friend, I am suck at this point :( I was hoping that the creators/maintainers of RobotJS can add this ability :( If you or @amcneel find anything, please let me know. I will do the same

@oauo
Copy link

@oauo oauo commented Dec 17, 2021

I have this issue every time I use this library and it's very limiting.
I'd even just take an option to disable errors and to trust me that I'm doing things in bounds, it's only ever for personal projects and I don't need to be told that the coordinates are outside the main screen's area, trust me.

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

Successfully merging a pull request may close this issue.