Hello, yesterday I officially released Louvre v1.0.0, a C++ library designed for building Wayland compositors with a primary focus on ease of development. It provides a default method for handling protocols, input events, and rendering, which you can selectively and progressively override as required, allowing you to see a functional compositor from day 1.

It supports multi-GPU setups, multi-session (TTY switching), and offers various rendering options, including a scene and view system that automatically repaints only the damaged (changing) regions during a frame. Because it uses multiple threads, it can maintain a high FPS rate with v-sync enabled when rendering complex scenarios. In contrast, single-threaded compositors often experience a rapid drop in FPS, for example, from 60 to 30 fps, due to “dead times” while waiting for a screen vblank, leading to the skipping of frames.

The library is freely available, open source, thoroughly documented, includes examples, and features a detailed tutorial.

You can find it here: https://github.com/CuarzoSoftware/Louvre

I hope it proves useful for you. If you decide to use it and encounter any doubts or wish to contribute to its development, please don’t hesitate to reach out.

Greetings!

  • LeFantome@programming.dev
    link
    fedilink
    arrow-up
    17
    ·
    1 year ago

    Many people have predicted the death of the small, independent window manager with the coming of Wayland. I have heard multiple times that only large projects like GNOME and KDE would be able to take on the burden of making a compositor.

    Now, I do think that lots of no longer actively developed window managers could get left behind. But the idea that it will be too complicated to create a window manager now is turning out to be wrong.

    First, fewer desktop environments are getting left behind than feared. XFCE, Cinnamon, and MATE all seem to have Wayland plans now.

    The big change is the appearance of not one but multiple compositor libraries designed to make it easier to create a window manager for Wayland. Some of them look like they might make it easier than it was under X. The approach taken by this one makes the idea of hacking around with it very inviting.

    Although having to create a compositor has made things difficultly until now, I think the idea of decoupling the compositor for Wayland is going to look smart in the long run.

    Being separate from Wayland, compositor devs are free to experiment and window manager authors can select the one that best maps to their goals.

    I was reading up on Oasis Linux yesterday. It comes with a Wayland compositor ( SWC ) and tiling window manager ( Velox ) that are less than 20,000 lines of code combined!

    It would not be practical for a light-weight distro to trim down Xorg like that. But I the compositor is separate, it can be either smaller or feature rich. SWC is XWayland compatible but obviously that is going to add more size if you need it.

    Looking forward to the window manager innovation that projects like Louvre enable.

    • ExLisper@linux.community
      link
      fedilink
      English
      arrow-up
      1
      arrow-down
      3
      ·
      edit-2
      1 year ago

      People using X window manage will just keep using them. Wayland doesn’t offer anything valuable to most users so people will just keep using the managers they like. In 10-20 years we will get some nice, new managers that naturally will support Wayland and people will switch because of the features, not because ‘X insecure, Wayland awesome’ BS.

      • merthyr1831@lemmy.world
        link
        fedilink
        arrow-up
        1
        ·
        1 year ago

        Wayland is already a lot nicer to use over X. Better gestures, better animations, better performance, and that’s if you use Wayland today, not in a year’s time.

        Like I get why people are defensive over X but it literally isn’t being developed anymore - And if it’s really worth keeping over Wayland the time to get contributors to support it is passing quickly.

      • LeFantome@programming.dev
        link
        fedilink
        arrow-up
        1
        ·
        1 year ago

        I agree with your overall sentiment with the caveat that 20 years will be closer to 5. Early adopters are enjoying Wayland only benefits today. For example, the Steam Deck just launched with HDR and mainline support for Linux gamers in general will not be far behind.

        Also, the list of window managers being left behind is starting to look less appealing than the list of window managers that are Wayland only. Hyperland is probably already more popular than WindowMkaer. As GNOME and KDE go Wayland only, they will continue to add features that regular users will want. I see more announcements for new Wayland compositors than I do for new X window managers.

        Another factor that gets missed is that the main dev support for X comes from Red Hat. RHEL9 is already Wayland based. When RHEL8 comes off support in 5 years, Red Hat will abandon X. How long will X stay viable after that?

        As the number of X users dwindle, we will see toolkits drop support for X. GTK5 for example. 5 years may be too soon for that but I cannot see it taking 20 years.

        Wayland being “valuable to most users” will come faster than you think.

        • ExLisper@linux.community
          link
          fedilink
          English
          arrow-up
          1
          ·
          1 year ago

          Sure, maybe it will be 5 years. I’m definitely not going to rewrite my awesome wm config just because Wayland is hip now. I will have to get some really nice features out of that.

  • lily33@lemm.ee
    link
    fedilink
    arrow-up
    12
    ·
    1 year ago

    There’s desperate need to a library that’s simpler to use than wlroots or smithay - but unless it supports more protocols (later shell, gamma control, session lock), I don’t think this is a real a alternative yet.

    • ehopperdietzel@lemmy.worldOP
      link
      fedilink
      arrow-up
      12
      ·
      1 year ago

      I completely agree. I invest time in implementing protocols within the library, allowing it to handle many tasks autonomously, thus relieving developers from manually wiring everything themselves—without compromising flexibility oc. Regarding “later shell,” did you mean “layer shell”? Developers can certainly still implement protocols not included with Louvre on their own, but that’s not quite the intended approach.

    • insomniac_lemon@kbin.social
      link
      fedilink
      arrow-up
      1
      ·
      edit-2
      1 year ago

      I was thinking similar, though I’m also still on X with nVidia and XFCE and am in a weird way* with programming.

      I have my own custom XFWM theme that is really minimal (12px title with 8px tall buttons with some being wider to compensate, somewhat outdated example) and I’d like to expand upon it (floating titles, inset window buttons, dynamic button width, media integration) but I’ve looked at examples and don’t understand enough to even get just a rectangle for a titlebar (though X I assume for something basic, X would probably still be the easiest).

      *= the only language that I’m interested in (due to it being easy in a style I like while still having performance/capability/flexibility etc) is not popular, and worse is I have lost a bit of hope/confidence in its future (as well as its bus factor reducing further because the person who made the package manager+installer and a book walked away) so I still haven’t really done much with it.

  • drwankingstein@lemmy.dbzer0.com
    link
    fedilink
    English
    arrow-up
    13
    arrow-down
    1
    ·
    edit-2
    1 year ago

    ngl Im more interested in the dock and what protocols it uses. I’ve been missing latte dock since I migrated to wayland

    • ehopperdietzel@lemmy.worldOP
      link
      fedilink
      arrow-up
      14
      ·
      1 year ago

      The dock is rendered directly by the compositor in one of the examples; it’s not an external application as it ideally should be. It doesn’t rely on any intricate protocols or systemd services to monitor the states of apps. I added it solely for demonstration purposes.

    • ehopperdietzel@lemmy.worldOP
      link
      fedilink
      arrow-up
      18
      ·
      edit-2
      1 year ago

      Yes (kinda), that is a screenshot of one of the example compositors I included called “louvre-views” which implements server side decorations for apps that support the XDG Decoration protocol.

  • wiki_me@lemmy.ml
    link
    fedilink
    English
    arrow-up
    4
    ·
    1 year ago

    You mentioned it being easier then wlroots, but wayfire and phoc reportedly act as high level abstractions on top of wlroots that could be used to make it easier to create window managers (wayfire author explicitly mentioned it), Maybe it will be good to create a comparison with these projects? or even divert your future efforts to one of them?

    • ehopperdietzel@lemmy.worldOP
      link
      fedilink
      arrow-up
      5
      ·
      1 year ago

      I’m not sure if I explicitly mentioned that it’s easier than wlroots, but I believe its design can considerably ease the learning curve for newcomers. While I’ve read about those projects, I haven’t had the chance to try them myself. Although I’d be interested in contributing to their development, I don’t intend to abandon Louvre. I find it beneficial that there are different alternatives, as each can bring unique and clever ideas to enhance various aspects, ultimately improving the overall design across the board.

  • russjr08@outpost.zeuslink.net
    link
    fedilink
    English
    arrow-up
    4
    ·
    1 year ago

    Wow, that looks stunning! I am no where near skilled enough to be able to even begin wrapping my head around making a compositor, even with a library - but I do know that like the other commenter mentioned we certainly need more libraries aside from the two that we currently have (but I understand why that’s a very tall order) so major props to you!

    • ehopperdietzel@lemmy.worldOP
      link
      fedilink
      arrow-up
      8
      ·
      1 year ago

      The idea of single, double, and triple buffering revolves around how many framebuffers we use for display rendering. Typically, we go with double buffering, displaying one framebuffer while rendering happens on the other. Swap them, and the cycle continues. The goal is to prevent screen tearing and glitches from popping up on the screen.

    • ehopperdietzel@lemmy.worldOP
      link
      fedilink
      arrow-up
      6
      ·
      edit-2
      1 year ago

      Honestly, I haven’t explored Vulkan yet. I initially chose GLES 2.0 as the primary renderer to ensure compatibility with a wide range of hardware. Introducing Vulkan myself would be a time-consuming task unless I receive assistance.

      Regarding XWayland, Louvre doesn’t currently support it, so it’s naturally excluded. Well, it technically can run in rootful mode, but that is somewhat pointless. To enable independent window management, I believe I would need to create a mini X server, a task I haven’t tackled as of now.

      • ijhoo@lemmy.ml
        link
        fedilink
        arrow-up
        3
        ·
        edit-2
        1 year ago

        It looks very interesting.

        I might be wrong, but it seems to me like Vulkan Support in hw is better than opengl:

        • amd since at least Polaris (there is a project to Bring vulkan to really old terrascale graphics, but is jot yet there)
        • Intel since idk broadwell Skylake
        • Nvidia proprietary for sure don’t know since when and it seems that focus on nvk (new open source driver) is going to be on vulkan
        • android since version 7 - Eighty-five percent of active Android devices support Vulkan (this is better than android Version Rollout) https://developer.android.com/games/develop/use-vulkan
        • rpi, not sure which versions

        Probably all of them have better Vulkan than opengl drivers (due to drivers being simpler). David Arlie rather quickly implemented first Vulkan driver for AMD once Vulkan was first released. Just in case you need incentive.

        I was thinking of starting something similar as a learning exercise, but I’m really limited in time and not skilled as much in c++, so it would probably lead nowhere. Now I can just build on top - if I get any time for this, will come probably with questions.

        Anyway, this idea was to make something modern. Without the legacy crap. Actual goals were:

        1. Vulkan only (move gfx API Info the future)
        2. no x/xwayland (most of the apps in newer toolkits already support Wayland, the others I’d rather avoid)
        3. Multithreaded
        • ehopperdietzel@lemmy.worldOP
          link
          fedilink
          arrow-up
          3
          ·
          1 year ago

          Interesting, I don’t recall where I read about Vulkan support still being experimental in many Mesa drivers; it might have been an outdated post. I’ll look into it, and perhaps I’ll decide to dive into learning Vulkan. Additionally, there are buffer-sharing mechanisms that already work smoothly with GLES, so I need to explore if the situation is similar for Vulkan. Thanks for your response, and if you have the time and inclination to help include it, feel free to do so! 😄

  • TCB13@lemmy.world
    link
    fedilink
    English
    arrow-up
    5
    arrow-down
    11
    ·
    edit-2
    1 year ago

    Lets see if I got this right, you (the OP), the creator of Louvre, managed to create an example compositor that looks like a better desktop experience than the entire KDE and GNOME teams could ever develop with their infinite wisdom and funding? Fucking amazing. :)

    I know this is an example, but seriously following the “copy apple down to the last pixel” approach you should consider creating a DE for Linux that doesn’t have themes or any user tweaks, just a simple and pixel-perfect copy of macOS. The problem with GNOME and KDE is that they both fail in simple design principals such as proportions, item spacing and whatnot while Apple, and you by extension, excels in that aspect.

    Furthermore my personal opinion is that GNOME tries to reinvent everything and ends up fucking things up and creating situations like the lack of desktop icons going into the activities view by default etc. KDE however does some other stuff right but they fail really badly in terms of proportions and item spacing. Their taskbar is also a shame, for a group that says they want to copy Windows’ style they aren’t doing that well.

    Desktop experiences when it comes to design peaked with macOS Monterey (after that Apple did changes to the settings that are still not polished) and in terms of usability they peaked with the release of Exposé, Spaces and later their integration on Mission Control (initially bad but now they seem better).

    If you do create a 1:1 copy of macOS desktop experience (and keep it updates) as a new DE you’ll most likely become very popular in no time. It doesn’t need themes, customization and all the personalization that would make it really hard to create, just a simply pixel perfect copy of macOS.

    • ehopperdietzel@lemmy.worldOP
      link
      fedilink
      arrow-up
      9
      ·
      1 year ago

      Thanks! While I may have nailed server-side decorations in that example, as you know, there is too much other stuff to take into account to make a DE actually functional. So, I respect a lot what KDE and GNOME do and the innovations they make. I actually want to create a macOS clone, hahaha. That is one of the reasons I started this project. I will soon continue working on a library for exposing global menus in Wayland/X11. Qt allows defining a custom platform plugin, enabling us to plug external systems for managing global menus. Sadly, I think GTK4 no longer supports that, so I believe an approach would be to display a standard menu with basic functions for apps that don’t support it.

      • 2xsaiko@discuss.tchncs.de
        link
        fedilink
        arrow-up
        3
        ·
        1 year ago

        Ohh, that’s cool. How far do you want to go with this? I had the idea of using a custom wayland protocol to make per-app global menus instead of per-window so you can have an app open without any windows, like on macOS, in the compositor I wanted to write. However writing a compositor using wlroots is still incredibly difficult if you have no prior experience so the whole thing didn’t get very far yet. If that’s something you want to do too, I’d be very interested in this.

        (Speaking of, why did you decide not to build this on top of wlroots?)

        • ehopperdietzel@lemmy.worldOP
          link
          fedilink
          arrow-up
          6
          ·
          1 year ago

          I actually already created a library for that called Heaven (https://github.com/CuarzoSoftware/Heaven), but I want to rewrite it to make it simpler and add backends for different IPC mechanisms (Unix domain sockets and D-Bus).

          It allows apps to create as many menu bars as they want. The idea is that when one of its toplevel windows is activated, it can notify the “topbar app” to display a specific menu bar. The compositor also informs the “topbar app” about the currently active client. So, it has three APIs: one for apps, another for the “topbar app,” and another for the compositor. Apps are identified by their PID.

          Now, with respect to the second question, a long time ago, I tried to create a compositor using QtWayland, which had the most documentation at that time. However, it had some problems with certain interfaces that made the compositor crash. So, I then looked for wlroots but could find no documentation whatsoever, so I decided to start from scratch. As time passed, I began to learn and understand how protocols work, realizing that one of the most challenging things was implementing protocols correctly, as there are too many interfaces that depend on each other, and you need to implement them all before you can see results and validate that it works. That’s why I decided to create this lib, even as my university thesis, with the focus of offering a default and basic implementation of each protocol so that developers can see a functional compositor from the start and then gradually and specifically override whatever they need, being able to validate each feature they add immediately. Of course, there are many other complicated things I had to learn, such as the DRM/KMS API, buffer sharing through DMA, among other stuff. I really appreciate wlroots, though. I learned a lot by analyzing its source code, and surely today I would be able to create a compositor with it, hahaha.

      • TCB13@lemmy.world
        link
        fedilink
        English
        arrow-up
        2
        ·
        1 year ago

        I actually want to create a macOS clone, hahaha. That is one of the reasons I started this project.

        Well it seems I’m not the only one then :P