remouseable icon indicating copy to clipboard operation
remouseable copied to clipboard

Automatically detect and support multiple displays

Open TheLastZombie opened this issue 3 years ago • 2 comments

When I connect my reMarkable to my two-monitor setup, everything is a bit stretched, probably because remouseable gets confused with the resolutions.

2021-03-11_21-08

It would be great to, perhaps, have a command-line argument like --monitor NUM (which is how remarkable_mouse does it), or something like --range left,top,width,height (in px).

TheLastZombie avatar Mar 11 '21 20:03 TheLastZombie

Currently, all of the scaling operations use the main display's resolution which would definitely cause skew or stretching when drawing on a second monitor if they aren't exactly the same resolution. In lieu of multi-monitor support, you should be able to override the resolution detection to match your second monitor with --screen-height=1080 --screen-width=1920 and setting the values to your set resolution. I don't have a multi-monitor setup and have never tried to use it that way. I assume you can't draw a line from one monitor to next. When drawing on your second monitor, do you first have to set the mouse within the second monitor and then start drawing for it to work?

If you're comfortable working with C and interested in making a PR then below are some thoughts on how you might improve the multi-monitor support. If not then I'll leave the issue open with these notes for myself but I can't guarantee if or when I'll have time to make the changes.

As for better multi-monitor support, remarkable_mouse has a bit of an advantage in being able to leverage the Python ecosystem which seems to have more mature bindings for all the native system libraries. The https://github.com/go-vgo/robotgo package I embedded in this project does the hard work of interfacing with the Windows, Linux/X11, and OSX native C APIs required for the monitor and mouse control. It is missing support for both static and dynamic monitor selection. There are a few open issues for robotgo related to this and the maintainer seems interested in someone contributing the feature.

The monitor size is determined by calling this method which internally switches between system specific API calls depending on the operating system. The method loads the "main" display which is defined differently by each OS. For example, the OSX main display changes based on mirroring settings. The windows section even has an attempt to handle multi-monitor already written by the robotgo maintainer. However, it's not clear to me if that is the right approach to use for this project because the GetSystemMetrics API documentation suggests that it treats all monitors as a single, combined screen.

The remarkable_mouse project uses a library called screeninfo to handle the multi-monitor resolution detection. screeninfo binds to some of the same native C APIs as this project and robotgo. I think the most straightforward way to add decent multi-monitor support is to port the screeninfo display enumeration code to C. This would be worth contributing to robotgo and/or creating a dedicated Go library given the complexity of the feature.

kevinconway avatar Mar 12 '21 12:03 kevinconway

the GetSystemMetrics API documentation suggests that it treats all monitors as a single, combined screen

Ah, turns out that's exactly what's happening (on Linux, anyway):

2021-03-12_14-40

See the default values - that explains the stretching.

I unfortunately don't know much about C, but setting screen-height and screen-width does the trick for me (it starts from the top left, so I can use 1080 and 1920 respectively to let it use my left monitor).

TheLastZombie avatar Mar 12 '21 13:03 TheLastZombie