Hacker News new | past | comments | ask | show | jobs | submit login
The sad state of screen sharing on desktop Linux (som.codes)
98 points by signa11 on Jan 29, 2020 | hide | past | favorite | 78 comments



Spoiler alert: the author of the article is using Wayland. Lots of things aren't working on Wayland yet. (I'm also being pretty handwavy here about Wayland. Wayland "the protocol" isn't a piece of software you use -- lots of problems are not specific to Wayland, but to a particular compositor).

Screen sharing works OK on Linux under X11. I can't remember the last time that was a problem. I was definitely doing it on a daily basis back when KDE was somewhere at a 3.x release, so before 2008. At least single-monitor setups work fine, I can't say I've tried it on multi-monitor setups in a very long time. When I did (that was so long ago my two monitors were bulky CRTs) it was OK but who knows, maybe it got broken in the meantime.

I mean yes, once in a blue moon I run into a system that has a weird glitch, but that's just as true with Windows and TeamViewer. Every once in a while you run into a machine that just won't budge and you need to ask Google. That's true on any OS.

(Before you tell me how you've had no problem with Wayland on your Thinkpad running Fedora 87 or Arch, yes, I get that. Making it work on everyone's laptop, and getting it to do what everyone needs, is a real hurdle in software development, and Wayland isn't even halfway there when it comes to this particular hurdle).


Aren't working yet in Wayland, or never?

Afaik they don't want programs to see each others pixels or input for security reasons (but thereby also breaking your own control over programs) so the following useful things will never be possible by design except with specific solutions on case by case basis (so: brittle)

Screenshots, video capturing, automating mouse and keyboard input (autoclicking), screen sharing, ssh with graphics, clipboard in scripts, ...

Or are those things planned anyway?


There's nothing inherently preventing any of these things from working on Wayland. I mean yes, the protocol (and its implementations) are meant to disallow programs from seeing each others pixels and input events by default and/or without authorization, which isn't a stupid idea at all. But you can certainly implement screenshots, video capturing, automatic input, screen sharing and whatever in Wayland compositors. I think Sway implements most of these things, in fact.

(FWIW, X11's approach to program isolation isn't ideal for everything, either. The same things that make it so convenient to automate mouse and keyboard input make it very hard to write a good screen locker, for example.)

Whether or not we'll see free (as in freedom and beer) compositors that conveniently implement all these things is a whole different story. A lot of XFree86's (and later Xorg's) feature set was developed by well-paid teams of experienced engineers, who benefited from a lot of work done by other well-paid teams on other platforms, and the architecture and licensing of the whole thing meant that everyone could benefit from their work. That's not really the case with Wayland. There's actually a lot of work, and a lot of money being poured into Wayland compositors. Lots of car infotainment systems run one, for example, and Wayland support has been pretty much a standard requirement for virtually every BSP I've worked on in the last four years. But most of that work is very system-specific, platform-specific, and its substantial part -- the code -- never gets upstreamed, because "upstream" is just a protocol spec. A lot of the Wayland protocol has been standardized that way, but it's still up to every compositor to implement it.

There's some hope due to projects like wlroots and Drew de Vault, its lead developer, is one of those people who seem like they can pull anything off. (Oh yeah: https://drewdevault.com/donate/ ). But -- unlike twenty years ago -- there's very little commercial backing for Linux on the desktop. I don't know if the FOSS community will be able to keep up with these things.


> There's nothing inherently preventing any of these things from working on Wayland.

In theory that is correct. In practice, the Wayland protocol fails to address the required access control policy interfaces necessary for a modern Desktop to work. A Desktop is not a phone interface or a car entertainment system. Resource sharing that enables basic things like push-to-talk, remote work or full screen streaming are absolutely essential for a Desktop computing environment. Wayland developers push such functionality down as a particular "implementation detail" of a Wayland compositor, which is a huge mistake. Donating to braindead projects like wlroots will not solve the problem at all. Access control policy needs to be made part of the core protocol ASAP or Wayland will have no chance to succeed in any meaningful way in the future.


That's really not how Wayland development works. Except for resource management and data transfer (wl_compositor, wl_shm_pool etc.), pretty much everything in the "core" Wayland protocol has originated in compositor implementations that were then standardized. "Donating to braindead projects like wlroots" is exactly how this problem is going to be solved. There's no Wayland cabal where people just sit around a table writing specifications in the hope that they'll eventually get implemented somewhere.

This is pretty much how X11 was built, too, by the way.


> That's really not how Wayland development works

Maybe then Wayland should change "how Wayland developement works" because after 10 years of developement the results are disappointing to say the least. Projects like the Arcan display server show that even a single dude writing stuff in his spare time can easily be more productive.


It's a development model that worked reasonably well for the X protocol. Wayland isn't great now but it's not much worse than X was in 1994, after 10 years of development (and the first version of X11, which saw the light of day in 1987 or so, was pretty different from the early drafts of the X protocol). There was no ICCCM back then (ok, there was ICCCM 1.0 but that wasn't anywhere near great or universal), no session management, no xkb, no xdamage, no Xinerama, no hotplug, no glx, no randr...

It helped that there were a bunch of big players sinking lots of money into it, and the documentation was good enough that it was easy to get started -- way easier than it is with Wayland. So after 1993 or so things really started picking up speed. But Xfree cca. 1994 wasn't great.


> It's a development model that worked reasonably well for the X protocol.

The development of early X11 didn't work very well at all. Even Keith Packard himself says so [1].

1.: https://www.youtube.com/watch?v=cj02_UeUnGQ


Most of the bad parts that Keith Packards covers are about the pre-X11 days. But yeah, Wayland is developed more or less like X11 was developed after the mid '90s or so.

The difference is that there isn't much commercial involvement on the desktop side. SGI, DEC, HP, Sun, IBM, and later Red Hat & friends, sank quite some money into X's development, and a non-zero amount of that money ended up going into a particular implementation (XFree, later Xorg) and in developing desktop solutions on top of it.

Most of that money stream is flowing towards other things than desktops now. Desktop Wayland development is largely a hobby effort (there are some exceptions, but nowhere near as many as in the heyday of X11, and not all of these efforts apply throughout the Wayland "universe").

That may eventually change as Xorg's maintenance will eventually stop, since no one really wants to do that anymore...


Wayland doesn't have a chance anyhow because

* Very few actually interesting programs run natively on it * As such the push to improve is largely political * Leading to low effort commitment outside the orgs that push it * Which deters developers for actually porting stuff to it

As such you end up with half baked PoCs that doesn't incentivize anybody to move them forward while X is still working better by far.

In short, there is no compelling reason for anybody to switch platforms. It's a solution looking for a problem.


Sway 1.4 (wayland window manager), just released, has this in the changelog: Support for VNC via wayvnc.

https://github.com/swaywm/sway/releases

Wayland/wl-roots compatible screen-recorder: https://github.com/ammen99/wf-recorder


Already planned and/or working. See waypipe, screen sharing in gnome etc. .

What is true is that you don't want any random app to also log everything for security reasons. Instead it will have to ask for permission first.


Big conspiracy time: Wayland is just Google pushing for everything to go into browser.


Sharing a single window does not work on X11 either via Chrome screen capture, though.

We have resorted to custom tooling that uses VNC via the company VPN, which works decently with better quality.


Google Hangouts on Firefox used to be able to share a single window on X11 (Ubuntu). It broke or was removed at some point, and we've moved over to Zoom at work since then (so I don't know the current state).


Quickly replying to myself, Zoom on X11 also currently has no problem sharing a single window (just tested it).


Single window works fine with Chrome, too, the only feature missing is single screen.


This one isn’t because of any inherent problem with Xorg but because Chrome doesn’t have the feature to select a specific client and instead is just capturing the root window always. Nothing is really preventing Chrome or any other app from doing this.

A workaround would be to launch a second Xorg instance and point Chrome and the app you want to share at that server.


To be clear - the state of screensharing on Wayland is fairly interesting, and integrates a handful of new components.

One of them is Pipewire, which is shaping up to be the replacement for things like Pulseaudio and JACK - it's a daemon and tooling for slinging audio and video streams around between processes.

The other is xdg-desktop-portal - designed for use with Flatpak, it has now become a set of standard dbus APIs for interacting with your desktop manager and window manager on any Linux system. Specifically, org.freedesktop.portal.ScreenCast[0] gives you a Pipewire handle to the screen, possibly after asking for permission. This is supported in recent Firefox versions.

There are xdg-desktop-portal implementations for GNOME, KDE, and wlroots-based compositors, although the wlroots implementation only supports screenshots so far, and does not yet implement screencasts.

[0] https://flatpak.github.io/xdg-desktop-portal/portal-docs.htm...


The sad state of Discord and Jitsi?

The following all work perfectly on my 3 monutor setup:

* google meet

* skype for linux

* slack

* a standard, from tutorial, webrtc screen share and chat

I also use turboVNC to do control between my own devices (it has decent graphics support).

I can't see what those three huge players are missing that the author needs. They've tried two smaller players and are decrying it as a platform issue. Plenty of other non hacker suggestions in this thread as well.


I add TeamViewer to your list but Skype doesn't work well anymore on Ubuntu 19.10. I can see only the top left part of the screen of the person I'm talking to. Resizing Skype doesn't help. Luckily none of my customers are using it anymore. MS managed to kill it by making it too business unfriendly. Everybody moved either to meet or slack or both.


Isn't discord supposed to be audio focused anyway?

I thought it was GenZ's version of Ventrilo and Teamspeak


It's actually a bit more like a hybrid of slack and ventrilo, but for fandoms and gaming. I primarily use discord for group chats and playing TTRPGs online. but I'm also in several podcast fan servers (official and unofficial) where a community of folks with common interests congregates.

Creators have really begun to actively use it to manage and engage with their fan-bases, and I bet there are some companies that use it as a slack alternative.

This isn't even mentioning the wide variety of bots and integrations for Discord, or how private text chats can enable/switch to audio or video communication.


Google meet and slack have the same issue with multimonitor setups. It works great with a single monitor but not multiple. This is not just Wayland but X as well.

You can cheat it by starting the session with a single monitor activated, xrandr-ing the other one active after you start sharing, but that shouldn't be required.

The single screen sharing application I've had success with on Linux+XOrg and multimonitor is Zoom. No other application properly allows me to share just one screen.


Discord screen share works fine for me on Ubuntu 19.10


Slack doesn’t. Only allows all screen sharing and not specific windows. Meet is perfect though.


It can share specific monitors, just not windows. This satisfies the authors stated gripe (though they may be able to do window specific shares with Discord)


Is even that much new? Last time I tried it shared everything, which is completely useless.


TL;DR: make sure you have pipewire and xdg-desktop-portal installed, look up how to enable pipewire for your browser. It might help.

Well, this blog post barely scratches the surface.

The Linux userspace display stack is currently undergoing a big overhaul, following the changes that happened in the kernel a few years ago (DRI3, KMS, atomic modesetting, etc).

All of this made Wayland possible. That, plus the fact that apps rasterize their surfaces themselves nowadays (GPU-accelerated trough OpenGL/Vulkan).

So, here comes Wayland with a new security model: you can't spy on other windows, so you cannot hack together a desktop sharing solution. A proper, cross-desktop solution is actually being worked on: pipewire[1].

Pipewire aims to replace both pulseaudio and jack for audio, and bring video in as well. So you will be able to direct which video feed goes where, use the same webcam for multiple applications, and have applications take a video feed, transform it, and plug it elsewhere. You can see where this is fitting with desktop sharing: one feed per window, one feed per screen, one feed for the whole desktop, plus variants. Want to overlay a webcam? No problem. Everything is backed by Gstreamer for realtime hardware-accelerated video encoding/decoding.

And the icing on the cake: Flatpak spearheaded the development of "portals"[2]: cross-desktop interfaces for individual programs to ask the user when accessing restricted resources (like a microphone, or a folder on your computer).

So, what's needed here is:

* Finish up pipewire and have it shipped on most distributions (should be installed in fedora 31, optional for sound in 32, default for sound in 33)

* Have compositors talk to pipewire [3]

* Have browsers and other software talk to pipewire [4]

* ???

* Profit

Good progress is being made on these points, except maybe the last? I expect support to start working out-of-the-box in some distros/browser/compositor combinations in 2020. Actually, support seems further along than I thought it was. But it seems that wlroots-based compositor haven't yet decided to support the xdg screensharing portal, and rely instead on a custom wayland extension. I wouldn't be surprised if such a portal is implemented for those.

The main issue here is everyone waiting on everyone else before enabling/implementing it. But it looks like we're 80% there, and it just needs to be enabled in some cases (and pipewire installed). Then it will trickle down to most distros and electrons apps.

However, I don't think legacy X apps will be able to continue sharing the desktop (they can still be shared by wayland capture programs, or capture the desktop if they implement the new interface). I guess pipewire might be able to create a virtual webcam for these, though.

Valve might be working on their own stack with their "Gamescope" wayland compositor[5], for their streaming solution.

And in the end, this should work much better, with hardware encoding, actual security, zero copy, etc. Hopefully there won't be a "next big thing" that breaks everything in just a few years.

[1] https://pipewire.org/

[1] https://wiki.archlinux.org/index.php/PipeWire

[2] https://flatpak.github.io/xdg-desktop-portal/portal-docs.htm...

[2] https://flatpak.github.io/xdg-desktop-portal/portal-docs.htm...

[3] http://jgrulich.cz/2018/03/06/screen-sharing-in-plasma-wayla...

[3] https://jgrulich.cz/2018/07/04/how-to-enable-and-use-screen-...

[3] https://wiki.gnome.org/Projects/Mutter/RemoteDesktop

[3] https://www.reddit.com/r/linux/comments/8le7rm/first_steps_f...

[3] https://github.com/emersion/xdg-desktop-portal-wlr/issues/1

[4] https://bugzilla.mozilla.org/show_bug.cgi?id=1496359 (looks disabled by default at compile time)

[4] https://bugs.chromium.org/p/chromium/issues/detail?id=682122 (pipewire disabled in chrome://flags until v81 due to waiting on https://github.com/flatpak/xdg-desktop-portal-gtk/issues/204 "dialog hell" it seems)

[4] zoom currently uses a gnome-specific screenshot API as a workaround: https://www.reddit.com/r/swaywm/comments/dr8yld/zoom_screens...

[5] https://www.gamingonlinux.com/articles/valve-give-a-little-m...


You speak as though Wayland is some super new bleeding-edge tech that just needs some time to come around, but the reality is that it is over 10 years old and still people revert to X11 to get things done because of its issues.

Compared to when Windows overhauled its entire display server, network, and sound driver architecture back in Vista, Wayland's pace is downright glacial. I suppose one can expect it will be ready for prime time by 2030, just in time for the next paradigm to make it obsolete.


That's right.

> still people revert to X11 to get things done

To me, that's the reason right here: X11 still works. Microsoft has more control over its software (as you can't fork and maintain it if you don't like where it's going).

If you want a more apt comparison, transitioning to Wayland is blazing fast compared to going to how long it takes for IPv6 to gain marketshare. Or for everyone to transition to electric vehicles. Once again, dynamics are different since the old tech still works. At least with Wayland, some advantages are immediately tangible compared to the IPv6 transition.

A friend of mine would likely describe it as potential wells with some energy barriers (ecosystem not mature) to overcome :)

Wayland has gained some momentum lately, in no small part thanks to sway. As a result, I feel the XDG initiative and cross-desktop coordination is stronger nowadays, so further evolutions of the Linux desktop could happen faster. In any case, I encourage you to give Wayland a go, and report/fix bugs :)

I've been using sway as my daily driver for 2 years now; one of the rare things I have to fire up X11 for sometimes is Steam remote play or screen sharing.


BTW, I just wrote a comment to this effect on this post, though I am not a fan of Discord: https://support.discordapp.com/hc/en-us/community/posts/3600...


Hacker news, where everyone proves the point by recommending a dozen different solutions.


“Z doesn’t work on Linux. Sad”

“That can’t be true because there are literally dozens of applications that can do Z, just not the ones your using.”

At best you can say that companies making popular apps don’t bother with good Linux support which has pretty much always been true.


That doesn't make any sense. How does the existence of multiple solutions prove there aren't any solutions?


Where are you getting "prove there aren't any solutions" from?


If there was a solution, there would be only One. If multiple competing suggestions are offered, then obviously none of them can be the One.


The sad state of wayland on Linux.


A colleague of mine streams one of his screens through VLC and then to Skype to have proper one-screen sharing.


Just said this in my own post, but yeah, you can stream any arbitrary amount of screen with VLC


I've had good success with krfb / krdc -- but on both sides of that it's been one monitor only.

TeamViewer is good, but ohmy is it expensive if you want to use it for commercial purposes. I've evaluated it for family support, and it's certainly robust -- they're not joking about the claims of very cross platform. But I haven't tested it with multiple monitors on either side.

I haven't run Zoom on any of my computers, and after last year's revelations I'm unlikely to feel I should.

x11vnc looks neat and seems to be relatively popular, but I've never had to dive into it.


I use TeamViewer for family support as well and it works fine, can't tell about multiple monitors. What revelations regarding Zoom are you getting at?



best way to find out about a backdoored software I never used I guess


Zoom installed a backdoor into their software.


On what Linux distros do you have TeamViewer working well?


Debian - stable, testing, and unstable - consistently, if somewhat infrequently, over about 9 years.

Compare VMware Workstation, which costs non-trivial monies, and typically breaks in difficult-to-fix ways every few months if you're on bleeding edge kernels, and unfixable ways no matter what you're doing after a couple of years, requiring more monies to upgrade for a functionally identical experience.


Thanks!


NoMachine works well.


The multi screen sharing problem in Chromium is a known one. I've been following this patch for some time, and it seems to be close to release now: https://webrtc-review.googlesource.com/c/src/+/165724

As other commenters say, latest Fedora has Wayland and Pipewire properly configured and by enabling a flag in Chrome/Chromium (search by "pipewire") it will run smoothly and allow you to choose which screen to share.


AnyDesk works flawlessly on Linux. It's used at my company for customer support, in a mix of Linux, Mac and Windows workstations. It supports multiple monitors and provides packages for major distros.


Could you use an external capture device like an elgato which is about $100 And use it with obs to transmit your screen? Sorry speaking from ignorance about true nature of issue just a guess.


Maybe, through only for external monitor and potentially with limitations.

Anyway compared to what technically it's possible (i.e. some clicks heard and there and it works), it's not really a acceptable solution.


The Elgato 4k HDMI capture card at least has no linux support and cannot be made to work. I believe the non-4k version can be made to work.


https://whereby.com/ works for me. No login required.


Same here on debian, but only if I use chrome - doesn't work well on firefox for me.


I'm waiting for Tuple to launch their Linux version, but wonder if they ever will or this will just be a major blocker.

Half my team uses Mac, the other half Linux and one Windows guy. Zoom works pretty well for calls, but I'd like something better for pairing.


I seem to have no issues with Zoom


Annotate on zoom still doesn't work, although it's rarely used in my teams workflows.

Basic screen sharing does work as you said.


> But, given the productivity boost felt when given extra screen real-estate

Really? Every time I've tried, I just end up hurting my neck so I'm pretty used to single screen and switching between the terminal and the browser.


GNU screen and tmux have screen sharing. That should be enough, right?


I wonder if anyone has tried using xpra for screen sharing. It does provide a watt to view the same application on multiple computers according to the documentation.


Not sure if it works for Wayland, but you can stream any arbitrary amount of pixels to through VLC when on X11.

Slack, zoom, Hangouts all work too.

So maybe the problem is discord.


VLC or VNC?



Off topic comment: If the blog author reads this; it's very hard to read the blog with that background (reader view helps though).


Can’t they create a virtual webcam device somehow



This is actually a good idea. You could then route the video signals from the application you want (including the real webcam) to the virtual webcam. THis should be possible with pipewire already, but I don't know yet of a proper GUI mixer?

That will appear soon enough, I guess?


I have no experience with this, but does anyone know how MS Teams work with screen sharing now that it is available for Linux?


Had the exact same journey with discord and jitsi. Google meet is not bad but it won't do full screen.


I have used Skype, Zoom, Slack, Google Hangout, TeamViewer without any issue many many times on Ubuntu.


On Linux Mint, I've had great success with Zoom, and Microsoft Teams of all things.


Worth looking into winswitch and x2go, I never used them for collaboration though.


well, for me, using zoom kinda solves the problem


no screen sharing is terrible on x11 too. like accesing it from remote box unlocks local session for anybody around ti hijack.


Zoom works well enough.


Just don't try to annotate the screen (or let a viewer do it). I ended up with a blank screen over everything (even the task switcher) and no way to quit. Fortunately I had a keyboard shortcut to launch a new terminal, so used that then typed "killall zoom<enter>". It worked :D




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: