Tuesday, November 21, 2023

Using Wayland instead of X11 on Linux

      Wayland is the future communication protocol between a display server and its clients on Linux.  In simple terms, it's what allows applications to be shown, moved, resized, closed, etc.   Wayland replaces the aging and less maintained X11 with more modern technologies designed for computing methods today rather than 40 years ago.  It has been in development since 2008, although just now getting more widely used, mainly due to Nvidia gpu's not working well in the past. 

    I have tried using it several times but could only get it working reasonable well using Gnome or KDE environments since I have a Nvidia gpu.  It would also work using Weston, a compositor made by the wayland folks, but lack of hotkey support and virtual desktops, elimated this option.  Since I dont like using full desktop environments, the only other choice for wayland is a compositor that uses wlroots, which is a modular Wayland compositor library.   There are several compositors based on wlroots with the most popular being "sway" a i3 tiling window manager clone.  I tried out sway and river, and found them both working better than in the past but still a bit glitchy with graphics on Nvidia.  

     This brought me back to gnome and kde, could I use them without the full desktops?  I tried using the compositor of gnome without gnome-shell called "mutter".   Mutter did work fine with Nvidia but there wasn't any way to turn off the crazy desktop animations using dconf-editor.   So then I turned to kde, using "kwin" instead of the KDE plasma desktop.  

     Kwin works great, no glitches, no crazy animations, the hotkeys and virtual desktops work also.  There were three initial issues I ran into:  1. X11 apps would not load  2. Applications started very slow due to no notification daemon  3.  No desktop background.

     I solved issue 1 and 2 by installing "dunst" and starting kwin with the following command line:  "kwin_wayland --xwayland dunst"    This starts kwin with xwayland support for X11 apps and then loads dunst a notification daemon.   Issue 3 is still unresolved as kwin doesn't support a desktop background without plasma, but since I usually have a solid or black backgound it doesnt bother me.  

     Running kwin standalone seems to be the best solution for me for using wayland with a Nvidia gpu.   Nvidia support is getting better and I think eventually it will work great with wlroots.  For now, I'm enjoying using the future of linux while making my system work more like in the past :)

 


No comments: