ShayBox / Mon2Cam

Workaround for multi-monitor Discord screensharing
MIT License
337 stars 33 forks source link

mon2cam immediately returns #83

Closed iTrooz closed 2 years ago

iTrooz commented 2 years ago

When I run mon2cam, it immediately returns image

Output of uname -a : Linux arch-3306 5.17.5-arch1-2 #1 SMP PREEMPT Fri, 06 May 2022 18:29:03 +0000 x86_64 GNU/Linux

I'm using KDE with X11, I installed mon2cam using AUR

EDIT : output of xrandr :

eDP connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 355mm x 200mm
   1920x1080     60.00*+
   1680x1050     60.00  
   1280x1024     60.00  
   1440x900      60.00  
   1280x800      60.00  
   1280x720      60.00  
   1024x768      60.00  
   800x600       60.00  
   640x480       60.00  
HDMI-A-0 disconnected (normal left inverted right x axis y axis)
DisplayPort-0 disconnected (normal left inverted right x axis y axis)
DisplayPort-1 disconnected (normal left inverted right x axis y axis)
iTrooz commented 2 years ago

I'm not so sure about this, but I found this in the code : image Which I think translates into "exit if there's one monitor or less"

iTrooz commented 2 years ago

I'm not so sure about this, but I found this in the code : image Which I think translates into "exit if there's one monitor or less"

I edited the condition with if (monitors.length < 1) {, and now mon2cam seems to work.

Why was the condition made like this ?

EDIT : Just realised what mon2cam was made for (fixing screenshare for multiple screens), and that I tried to use it incorrectly. Still, I think that would be a nice change to make, in case people just want to use their webcam to share their unique screen.

What do you think ?

ShayBox commented 2 years ago

I'm not sure who wrote that, but my guess is nobody using mon2cam has 1 screen to hit that bug, and discord fixed their screen sharing, so less people use mon2cam now, it is supposed to work for single monitor users

iTrooz commented 2 years ago

Hello ! Sorry it's my first time dealing with typescript projets, I did not realise the code I edited (I directly edited /usr/bin/mon2cam directly on my system) is not the actual code, but compiled typescript

The line in question is in x11.ts : https://github.com/ShayBox/Mon2Cam/blob/0919db53322b46879d41e0c7e39775f9d03e4429/src/backends/x11.ts#L41

I'm going to submit a PR for it