My experience on Wayland so far (Sway)

manjaro_sway_screenshot

About a couple weeks ago I made the switch from i3 to Sway, and tl;dr the experience is mostly the same for me and I don’t plan on leaving Sway anytime soon.

First thing, Sway does not officially support being launched from a display manager. I used Sway from LightDM and it worked fine for the most part, but I did occasionally have issues where it would just start into a black screen. So I disabled the lightdm service and added this to my ~/.bash_profile:

if [[ ! $DISPLAY && $XDG_VTNR -eq 1 ]]; then
        echo "Enter '1' for lightdm, '2' for startx, 'q' for nothing, or anything else for sway"
        read selection && case $selection in
                1)
                        sudo systemctl start lightdm
                        ;;
                2)
                        startx
                        ;;
                q)
                        ;;
                *)
                        export QT_QPA_PLATFORM=wayland-egl
                        export QT_WAYLAND_DISABLE_WINDOWDECORATION=1 # Qt adds titlebars under Wayland, this gets rid of them
                        #export SDL_VIDEODRIVER=wayland # causes issues with lots of games
                        export CLUTTER_BACKEND=wayland
                        export BEMENU_BACKEND=wayland
                        export KITTY_ENABLE_WAYLAND=1
                        sway
                        ;;
        esac
fi

This will only run on login when there is no X server or Wayland compositor running. The environment variables you see here tell various applications to run under Wayland. For me they still worked w/o the environment variables (as long as XWayland is installed of course) so if you’re following along, feel free to remove any you don’t want. Most are taken from here so you should probably look there first to see if any of these variables have changed.

The KITTY_ENABLE_WAYLAND and BEMENU_BACKEND variables are specific to the Kitty terminal emulator and the bemenu dmenu replacement. I’m not sure if BEMENU_BACKEND is necessary at all, but I put it there just in case. KITTY_ENABLE_WAYLAND is definitely necessary if you don’t want to run Kitty under XWayland, but I read on one of their GitHub issues that this isn’t necessary on the master branch, so it probably won’t be necessary in future releases. You can also run Firefox under Wayland with MOZ_ENABLE_WAYLAND=1 but for me, at the time of writing, this caused some graphical issues and crashed.

Another one of the first things I noticed was the fact that I couldn’t take screenshots with either gnome-screenshot or xfce4-screenshooter. So instead I switched to a program called grim, which has all of the functionality that I require from a screenshot tool.

The next problem I had; XFCE’s “Clipman” clipboard manager wasn’t working. This is my preferred clipboard manager, so this bummed me out. The main downside to this is I can’t send my screenshots directly to the clipboard (so I just save them into my Pictures folder instead, and copying images from a browser seems to work just fine), and the other downside is I lose whatever is in the clipboard once I close the application I copied from. So for now I’m just living without a clipboard manager, which is fine.

I did try out bemenu as a dmenu replacement, since it has a Wayland backend. And it was just as functional as I needed. However, the CLI is not compatible with dmenu (i.e. –nb instead of -nb), and I couldn’t get most of the theming options to work at all. So I’m just going to continue using dmenu through XWayland for now.

Speaking of XWayland, I was a little confused about what that was when I first got into this. The most important thing to know is you need to install it yourself if you’re installing Sway on Arch-based distributions (package name is xorg-server-xwayland, it’s not required by sway but it is required by mutter from GNOME and plasma-wayland-session from KDE, so KDE/GNOME users need not worry). I also read that applications running under XWayland may cause some issues, like grabbing the keyboard and not letting go. But I haven’t ran into anything like that yet, so maybe it’s more polished now.

I’ve also had a small issue with some icons not showing up in the system tray. This might be a big deal for some people, but for me this doesn’t really change much. The Sway team is aware of this, hopefully there will be a fix in the near future.

Steam is also fairly messed up under Wayland. I need to use the Enter key in order to “click” on many elements. I tend to use Lutris though, so this doesn’t bother me too much.

I wanted to try out Polybar but it would just run inside of an actual window in Sway (instead of appearing at the top), so I just used Waybar instead and it works great, aside from this issue which is just an occasional nuisance.

Also Dunst works great, aside from transparency. Not a big problem for me though. There’s another project called mako some Dunst/Wayland users may want to check out, but it seems there’s no way to filter out notifications with mako right now, which is kind of the main reason I use Dunst, so it’s a no-go for me.

All in all, Sway is a pleasant experience and I’m going to be sticking with it for now. Reading issues and opinions from years ago regarding Wayland, it’s really awesome to see how far the experience has come. With the very active development from Sway, GNOME, and KDE regarding Wayland, I think it will be a very polished experience a few years from now. Right now it’s just a little rough around the edges.

Written on June 7, 2019