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

Dual screen on macOS doesn't work #56

Open
jalmeroth opened this issue Mar 2, 2024 · 26 comments
Open

Dual screen on macOS doesn't work #56

jalmeroth opened this issue Mar 2, 2024 · 26 comments

Comments

@jalmeroth
Copy link
Contributor

Hi,

I have two laptops and one external monitor. If I connect the monitor to the Linux-laptop, everything works as expected. I can move to all three screens: Linux-Laptop (DeskHop B) -> external monitor -> Mac (DeskHop A).

Unfortunately, if I connect the monitor to the macOS-laptop (using the same USB-C cable as with the other laptop), I can only control one screen on the Mac. It just doesn't allow me to use the second screen. Altough I can use the built-in trackpad to move between both screens. Either it's stuck to the primary screen, or if I use the trackpad to move the mouse to the secondary screen, it just allows this one. So it's: Mac (DeskHop B) or external monitor -> Linux (DeskHop A) but not Mac (DeskHop B) -> external monitor -> Linux (DeskHop A).

The Mac is running Sonoma 14.3.1. What information can I provide to narrow this problem?

@hrvach
Copy link
Owner

hrvach commented Mar 4, 2024

Hey, this issue has been reported - it seems like Mac maps the absolute report coordinates to the primary screen only, but if a relative motion is reported, it allows you to switch between screens. The workaround for this is under construction, albeit a bit slower than anticipated due to heavy workload on other fronts.

The idea is to define another, "relative" mouse and use that to switch between screens. The tricky thing is knowing where that screen is and how many are there, so I'm trying to figure out how to make it happen without config files and recompiling for every custom layout. Stay tuned.

@Fallingonion
Copy link

I would also be interested in a fix for this issue. My setup is a macbook with an extra monitor and a PC. Let;s call the laptop's built in monitor screen A, the extra Mac monitor screen B, and the PC monitor screen C. Reading from left to right the layout is A - B - C.
Switching between the Mac and the PC works, but it depends where the mouse is on the Mac. If the cursor is on B, then I can move from B to C and back again no problem, but cannot move the mouse from B to A. However I can use the trackpad on the Mac to move the cursor to A.
If I then use the external mouse and try to move from A to B, it jumps from A to C and back again. Hopefully that makes sense and I believe it matches the behaviour mentioned in the other thread.
It's not fatal for me as I do most work on B and C, and it's easy enough to use the trackpad should I need to adjust anything... butr it would be great to be able to seamlessly move across all three :)

@hrvach
Copy link
Owner

hrvach commented Mar 8, 2024

Multiple mac screens workaround should be easier to implement than multiple windows screens, will try once I'm back from my work trip.

@hrvach
Copy link
Owner

hrvach commented Mar 22, 2024

Ok, the updated codebase is out. You need to rebuild and define OUTPUT_A_OS/OUTPUT_B_OS to specify where your MACOS is, and define the corresponding screen_count in defaults.c

Will be moved to config file and supported by a keyboard shortcut for easy config.

Leaving this open until confirmed working OK by several folks.

@Fallingonion
Copy link

That's great, thanks, I'll give it a try and report back.
"You need to rebuild and define OUTPUT_A_OS/OUTPUT_B_OS to specify where your MACOS is, and define the corresponding screen_count in defaults.c" - sorry for the stupid question but can you clarify exactly what changes I would need to make for the A-B-C layout mentioned above? I'm very new to all this and would hate to make a mistake :)

@hrvach
Copy link
Owner

hrvach commented Mar 23, 2024

B needs to be your main mac screen, A needs to be the extended one (that's defined under MacOS I believe).

Then in defaults.c for output A you would define screen_count = 2 instead of 1 and in user_defaults.h OUTPUT_A_OS as MACOS.

It's still not super user-friendly, as it's a work in progress, but should get there. I'll also try writing better instructions.

@jalmeroth
Copy link
Contributor Author

Ok, the updated codebase is out. You need to rebuild and define OUTPUT_A_OS/OUTPUT_B_OS to specify where your MACOS is, and define the corresponding screen_count in defaults.c

Will be moved to config file and supported by a keyboard shortcut for easy config.

Leaving this open until confirmed working OK by several folks.

My test setup:
A1 (left): Linux
B2 (center): external Monitor
B1 (right): macOS Laptop

First notice: my keyboard, as reported in #47 does not work with this build.

Other then that, it kinda work… 🎉 Sometimes, when you freshly connect deskhop and I try move from A1, I actually end up on B1 first (should be B2). Moving the mouse to the right edge of B1 seems to discover that the external monitor is on the left, not the right. After that, I can move the mouse from A1 to B2 to B1 as expected. 👍

Is there anything I can provide? Maybe logs from WireShark or something?

@Fallingonion
Copy link

Hm, I'm getting the following error when trying to build it:

C:\deskhop\deskhop\src\mouse.c: In function 'switch_desktop':
C:\deskhop\deskhop\src\mouse.c:139:13: error: a label can only be part of a statement and a declaration is not a statement
139 | mouse_report_t move_relative_one
| ^~~~~~~~~~~~~~
mingw32-make.exe[2]: *** [CMakeFiles\board_A.dir\build.make:173: CMakeFiles/board_A.dir/src/mouse.c.obj] Error 1
mingw32-make.exe[1]: *** [CMakeFiles\Makefile2:1587: CMakeFiles/board_A.dir/all] Error 2
mingw32-make.exe: *** [Makefile:90: all] Error 2

I thought it might be because I'm building on Windows but I tried on an Ubuntu machine and got the same error. Am I doing something wrong?

@hrvach
Copy link
Owner

hrvach commented Mar 24, 2024

Hm, I'm getting the following error when trying to build it:

C:\deskhop\deskhop\src\mouse.c: In function 'switch_desktop': C:\deskhop\deskhop\src\mouse.c:139:13: error: a label can only be part of a statement and a declaration is not a statement 139 | mouse_report_t move_relative_one | ^~~~~~~~~~~~~~ mingw32-make.exe[2]: *** [CMakeFiles\board_A.dir\build.make:173: CMakeFiles/board_A.dir/src/mouse.c.obj] Error 1 mingw32-make.exe[1]: *** [CMakeFiles\Makefile2:1587: CMakeFiles/board_A.dir/all] Error 2 mingw32-make.exe: *** [Makefile:90: all] Error 2

I thought it might be because I'm building on Windows but I tried on an Ubuntu machine and got the same error. Am I doing something wrong?

@Fallingonion can you please pull the latest version and try again? Initializing a struct within a switch/case doesn't seem to make some compiler versions happy. :-)

@hrvach
Copy link
Owner

hrvach commented Mar 24, 2024

Ok, the updated codebase is out. You need to rebuild and define OUTPUT_A_OS/OUTPUT_B_OS to specify where your MACOS is, and define the corresponding screen_count in defaults.c
Will be moved to config file and supported by a keyboard shortcut for easy config.
Leaving this open until confirmed working OK by several folks.

My test setup: A1 (left): Linux B2 (center): external Monitor B1 (right): macOS Laptop

First notice: my keyboard, as reported in #47 does not work with this build.

Other then that, it kinda work… 🎉 Sometimes, when you freshly connect deskhop and I try move from A1, I actually end up on B1 first (should be B2). Moving the mouse to the right edge of B1 seems to discover that the external monitor is on the left, not the right. After that, I can move the mouse from A1 to B2 to B1 as expected. 👍

Is there anything I can provide? Maybe logs from WireShark or something?

@jalmeroth do these do anything for your keyboard?

test-fw-enforce-ports.zip

@jalmeroth
Copy link
Contributor Author

jalmeroth commented Mar 24, 2024

Ok, the updated codebase is out. You need to rebuild and define OUTPUT_A_OS/OUTPUT_B_OS to specify where your MACOS is, and define the corresponding screen_count in defaults.c
Will be moved to config file and supported by a keyboard shortcut for easy config.
Leaving this open until confirmed working OK by several folks.

My test setup: A1 (left): Linux B2 (center): external Monitor B1 (right): macOS Laptop
First notice: my keyboard, as reported in #47 does not work with this build.
Other then that, it kinda work… 🎉 Sometimes, when you freshly connect deskhop and I try move from A1, I actually end up on B1 first (should be B2). Moving the mouse to the right edge of B1 seems to discover that the external monitor is on the left, not the right. After that, I can move the mouse from A1 to B2 to B1 as expected. 👍
Is there anything I can provide? Maybe logs from WireShark or something?

@jalmeroth do these do anything for your keyboard?

test-fw-enforce-ports.zip

@hrvach Yes, keyboard works with this.

But I can't move the mouse from A1 to B2 (from left [A] to right [B2]). I have to go to the left to land on B2 but can't reach B1 at all. 🤷

@hrvach
Copy link
Owner

hrvach commented Mar 24, 2024

Ok, the updated codebase is out. You need to rebuild and define OUTPUT_A_OS/OUTPUT_B_OS to specify where your MACOS is, and define the corresponding screen_count in defaults.c

Will be moved to config file and supported by a keyboard shortcut for easy config.

Leaving this open until confirmed working OK by several folks.

My test setup: A1 (left): Linux B2 (center): external Monitor B1 (right): macOS Laptop

First notice: my keyboard, as reported in #47 does not work with this build.

Other then that, it kinda work… 🎉 Sometimes, when you freshly connect deskhop and I try move from A1, I actually end up on B1 first (should be B2). Moving the mouse to the right edge of B1 seems to discover that the external monitor is on the left, not the right. After that, I can move the mouse from A1 to B2 to B1 as expected. 👍

Is there anything I can provide? Maybe logs from WireShark or something?

@jalmeroth do these do anything for your keyboard?

test-fw-enforce-ports.zip

@hrvach Yes, keyboard works with this.

But I can't move the mouse from A1 to B2 (from left [A] to right [B2]). I have to go to the left to land on B2 but can't reach B1 at all. 🤷

@jalmeroth Try parking cursor on mac output and pressing right shift + backspace + 2 and then right shift + backspace + 9. Any difference?

@jalmeroth
Copy link
Contributor Author

@hrvach yes, now I can move to B1 as well. But still the jump is on the wrong edge

@jalmeroth
Copy link
Contributor Author

@hrvach oh, and is moving windows on macOS (B1 <-> B2) supposed to work already?

@Fallingonion
Copy link

@Fallingonion can you please pull the latest version and try again? Initializing a struct within a switch/case doesn't seem to make some compiler versions happy. :-)

OK, so that now builds correctly and works perfectly for my setup! Amazing, thanks :)

@Fallingonion
Copy link

One side comment - on the Mac, I can't click+drag a window from one screen to the other using the mouse that goes through deskhop. The built-in trackpad works as you would expect. No idea if there's anything that can be done about that :)

@hrvach
Copy link
Owner

hrvach commented Apr 1, 2024

Hmmm, maybe ... I didn't think of the mouse buttons, the relative "helper" mouse should mimic the button presses from the absolute one, then it just might work

@hrvach
Copy link
Owner

hrvach commented Apr 1, 2024

@Fallingonion can you try this and let me know?
test_drag_macos.zip

@Fallingonion
Copy link

Hi - didn't work unfortunately: I was unable to move the mouse to screen A (the laptop's built-in screen.) Movement between B and C (Mac extra screen and Windows) works as expected...

@hrvach
Copy link
Owner

hrvach commented Apr 2, 2024

Did you configure that output as two screens (Right Shift + Backspace + 2), MacOS (Right Shift + Backspace + 9) ?

@Fallingonion
Copy link

Did you configure that output as two screens (Right Shift + Backspace + 2), MacOS (Right Shift + Backspace + 9) ?

Oops, no, I hadn't. I have now done that and can move the mouse to all three screens, but I still can't click+drag between the two Mac screens.
Thanks for all your help with this :)

@hrvach
Copy link
Owner

hrvach commented Apr 2, 2024

I think I know what else might be needed, will try looking into it...

@crablab
Copy link

crablab commented Apr 11, 2024

but I still can't click+drag between the two Mac screens.

++ Same.

I also notice that sometimes when moving from the second MacOS screen to the primary, the cursor gets stuck on the second screen 🤔 It's almost like it got stuck in a second layer, as moving it to the far left edge doesn't move the cursor to the other machine, but back into the secondary MacOS screen.

@hrvach
Copy link
Owner

hrvach commented Apr 11, 2024

It probably needs some tweaking to reliably move the "helper" mouse for the MacOS workaround. For the click-and-drag, I have an idea how it might be done, but still not 100% it will work... will try though! :)

@Ardakilic
Copy link

Ardakilic commented Apr 15, 2024

Hello, I didn't want to create a new issue since I believe my issue is related, so I wanted to add a comment here. I have a single external monitor, and my mac's main display and external monitor are placed vertically (On top, my external monitor (through a converter since there's no usb-c direct connection), and on the bottom my mac's main integrated display). I am using Deskhop like a KVM switch, and at this stage the second pc is shut down, and on the single machine the mouse does not pass from the bottom main display to external on the same OS.

image

My mouse is Steelseries Rival 3, and I'm utilizing 2.4 ghz usb dongle. It works, just does not go to the top external display.

@hrvach
Copy link
Owner

hrvach commented Apr 15, 2024

Hello, I didn't want to create a new issue since I believe my issue is related, so I wanted to add a comment here. I have a single external monitor, and my mac's main display and external monitor are placed vertically (On top, my external monitor (through a converter since there's no usb-c direct connection), and on the bottom my mac's main integrated display). I am using Deskhop like a KVM switch, and at this stage the second pc is shut down, and on the single machine the mouse does not pass from the bottom main display to external on the same OS.
My mouse is Steelseries Rival 3, and I'm utilizing 2.4 ghz usb dongle. It works, just does not go to the top external display.

You need to configure the output is a mac and there are two monitors there. Top/bottom still isn't implemented, so you need to configure displays as left-right.

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

No branches or pull requests

5 participants