1. 51

Emacs now has a pure GTK frontend (at least on master), which means native Wayland support and WSLg support by association! I’ve tested this today and it works great! See this presentation for more details about the implementation https://www.youtube.com/watch?v=LPwr8WeE8jU

  1. 5

    Yay, I’ve been using this branch for months to get the Wayland scaling and I’ve had zero problems.

    1. 7

      I think that Wayland support is so important that they should cut ASAP Emacs 29 just for it, but probably we’ll have to wait a couple more years for a “stable” release.

      1. 3

        Curious what your use case for Wayland is?

        1. 21

          I am a Wayland user with a boring desktop use case. I like the:

          • Fractional DPI scaling (I have a 27” 4K monitor that I like to have somewhere between 1.25x and 1.5x)
          • Handling of multiple monitors (I have monitors with different desired DPIs and refresh rates)
          • Lack of screen tearing even with the aforementioned refresh rate mismatch (X11 multihead gives you a single Screen with numerous Displays that view the screen, so you can’t really do VSync with mismatched refresh rates that aren’t simple multiples of each other)
          • (What feels like?) lower latency: Compositors on X seem to do a lot of copies but Wayland applications seem to have a culture of dmabuf and it seems to make my experience of wayland much snappier when compared to X11 with compton/picom or something.
          1. 2

            I feel that last point. When using X11, it feels like I have a choice between no compositor (and the lack of features and slightly buggy rendering that entails) and compton (with the very bad performance that entails). Workspace switching with i3 would make the every OpenGL window look initially blank before it pops in half a second later when using compton.

            Sway, on the other hand, Just Works.

            Everything else on that list is important too of course.

            1. 3

              Curious: what specific features do you like about the compositors? I’ve personally found them completely useless.

              1. 2

                I don’t remember 100% since it’s a long time ago, but IIRC, a compositor was necessary for reducing screen tearing, and parts of the screen would sometimes fail to update properly without a compositor.

                1. 2

                  Screen tearing is easier to avoid with a compositor (nothing to do) than without. And in my case, true transparency (this helps me to check if a window is focused, but also for eye candy).

                  1. 1

                    Even if you don’t care about shiny stuff like shadows, you don’t need damage.

                2. 2

                  X can do all those things too, except maybe the refresh rate thing though, I’m not sure about that. It is a pity that applications are just rewriting in Wayland instead of fixing their bugs on X and maintaining full compatibility.

                  1. 5

                    X11 can’t really avoid screen tearing. There are lots of different hacks which each somewhat reduce tearing in certain situations, but I’ve yet to see an X11 system which doesn’t have at least some screen tearing in at least some circumstances – while I’ve yet to see a Wayland system with screen tearing issues.

                    Fractional scaling on X11 is a hack which partially works sometimes but doesn’t work perfectly.

                    We’re long overdue for an X11 replacement. We’ve been adding hacks upon hacks upon hacks for far too long, and the fundamental limitations are really starting to show. It’s not enough to “just fix application bugs on X”. Screen tearing by itself is enough reason to throw X11 in the garbage and start fresh with something that’s actually reasonably well designed.

                    1. 1

                      As far as I understand, X cannot have different fractional scaling factors for different monitors, while Wayland can. It’s the main motivation for me to use Wayland, given I have a 1440p 25’ and 2160p 27’.

                    2. 1

                      I was always curious about fractional scaling. I thought that Wayland didn’t handle it (see https://gitlab.freedesktop.org/wayland/wayland-protocols/-/issues/47). From my understanding, you are rendering at 2x, then downscaling. If you happen to have two monitors, this can be a lot of pixels to render.

                      1. 1

                        From my understanding, you are rendering at 2x, then downscaling.

                        This is how macOS does it, IIRC.

                        1. 1

                          I think there are non-mainline GDK protocols for it. At least all the non-XWayland applications I use look perfectly crisp

                      2. 12

                        For me personally, I use Wayland because it’s the only thing supported on my hardware (MNT Reform).

                        The only thing I use it for is to run XWayland so I can immediately launch Emacs and exwm, and then I run Firefox inside that.

                        At first glance it appears slower than using Wayland directly, but that’s only before you factor in the time you have to spend retrieving your laptop because you threw it out the window in rage because Firefox’s keybindings (when running outside exwm) are so bad and holding down C-n opened seventeen windows again instead of scrolling down.

                        1. 1

                          Doesn’t Firefox run directly with Wayland now?

                          1. 1

                            Probably, but if you run Firefox outside exwm there’s no way to fix the key bindings. The Firefox extension mechanism bans rebinding C-n and C-p for “security reasons”, making it completely unusable for me.

                            1. 1

                              Supposedly it does https://twitter.com/omgubuntu/status/1379818974532280321?s=20, but I guess exwm doesn’t.

                              1. 1

                                Yeah. I guess exwm is the problem and not Firefox.

                                1. 2

                                  No, the problem is that Firefox doesn’t allow the user to change some keybindings, like C-n. EXWM is the solution to that problem.

                                  1. 1

                                    It’s exactly this.

                              2. 1

                                For a while now already. Gotta define the MOZ_ENABLE_WAYLAND=1 env variable and it will start in Wayland mode. Have been doing this for 2(?) years now on Sway without issue. (Maybe the env thing is a thing of the past…)

                                1. 2

                                  Sway + Firefox here as well. MOZ_ENABLE_WAYLAND=1 is no longer needed. Rejoice!

                            2. 8

                              I’m surprised by your question. My (perhaps naive?) understanding is that the Xorg maintainers decided years ago that they don’t like the X protocol anymore for modern graphics stacks, that the stuff that was added on top of it is painful to design/implement/maintain, and that they wanted to start with something fresh with a more solid design. Wayland, as I understand it, this is “something fresh with a more solid design” (but its own protocols are still evolving and probably imperfect, as everything is.)

                              With this understanding, if I have the choice to use both (that is, I’m not depending on worklows that are not supported on Wayland for fundamental reason (no support for easy forwarding) or due to lack of maturity), it seems natural to use Wayland. I want to use the new stuff that is the future and benefits from a growing userbase to mature (and benefit more users that currently have fewer options), and not the old stuff that keeps working but people dread maintaining.

                              So: my use case is “moving to the new software stack that was designed from the start to be a better, more robust successor than the old software stack”.

                              1. 6

                                From my PoV Wayland is still in “second system redesign” territory like the early days of PulseAudio. Some people find it useful, some people like to help test the bleeding edge, but it’s not the default in anything I set up and since I’ve never had any issues with X I don’t currently go through the extra work to set it up. The only time I’ve worked with Wayland was to help my mom switch her computer back to X because some app was misbehaving under her Wayland setup.

                                But if it’s working for you, that’s great of course. Just providing my PoV so hopefully my question is less surprising now.

                                1. 3

                                  There is always a bias towards “not fixing what aint broken” so once you know a tool you’re likely to stick to it.

                                  That being said I don’t think wayland represents enough progress to consider it a successor to X, it’s a competitor for sure but I think by the time I move off X it won’t be to wayland.

                                  1. 5

                                    With most Linux distros gradually switching to Wayland and Windows adopting it as well for WSL, I think it’s fairly certain that Wayland is going to (mostly) replace X in the next 3-5 years. I doubt some other alternative will emerge before the transition to Wayland is complete.

                              2. 5

                                Desktops built on Wayland are amazing compared to desktops built on X11. I couldn’t go back anymore.