Tips of XWayland with Sway?

I am using both Sway on Wayland, and i3 (X-Window based) in some cases on Fedora 36 on Framework Laptop. Recently I knew XWayland on the Framework community’s thread, and I consider using it. Because Firefox sometimes aborts silently, and I saw issues on Gimp (gimp), and Freeplane (freeplane) on Sway.

I am trying to find how to set up and the tips to use the XWayland. Are you using XWayland? How did you install it? What are the tips?

For the installation, the command below is enough?

$ sudo dnf install xorg-x11-server-Xwayland

Related documents I found:

2 Likes

As far as I know xwayland is installed by default with Fedora’s sway.

Is there something in particular you are trying to accomplish?

sudo dnf info firefox-wayland

You might have just to install this and run firefox with firefox-wayland link ?

xorg-x11-server-Xwayland is a dependency of sway package so it will be installed automatically when you install sway on Fedora. You can set and export MOZ_ENABLE_WAYLAND environment variable to make firefox use wayland instead of Xwayland.

1 Like

Guys, thanks for your helps!

No, I am just trying to use Sway normally.

I noticed I already have the installed xorg-x11-server-Xwayland package. :sweat_smile: As I saw the example of installing Sway and Xwayland separately in Ubuntu, I misunderstood that Xwayland was not installed on my local environment.

Here is my current status on my local environment.

$ rpm -q sway
sway-1.7-4.fc36.x86_64

$ rpm -qR sway | grep -i xwayland
xorg-x11-server-Xwayland

$ rpm -q xorg-x11-server-Xwayland
xorg-x11-server-Xwayland-22.1.5-1.fc36.x86_64

$ rpm -q firefox-wayland
package firefox-wayland is not installed

Thanks. There is no installed firefox-wayland package on my local environment. And I didn’t know it is required to run Firefox on Wayland. I will try it.

You are right. I noticed the
xorg-x11-server-Xwayland was already installed on my local environment. :sweat_smile:

I didn’t know the environment variable. Is it essential to run Firefox on Sway? I am still not sure about the behaviors of the environment variable and the firefox-wayland package.

1 Like

Now I found what these things are.

$ sudo dnf install firefox-wayland

$ rpm -q firefox-wayland
firefox-wayland-108.0.1-3.fc36.x86_64

$ rpm -ql firefox-wayland
/usr/bin/firefox-wayland
/usr/share/applications/firefox-wayland.desktop

$ file /usr/bin/firefox-wayland
/usr/bin/firefox-wayland: Bourne-Again shell script, ASCII text executable
$ cat /usr/bin/firefox-wayland
#!/usr/bin/bash
#
# Run Firefox under Wayland
#

export MOZ_ENABLE_WAYLAND=1
exec /usr/bin/firefox "$@"
1 Like

I updated the following files for sway and i3 cases. :smile:

.bashrc

+# Wayland
+# https://wiki.archlinux.org/title/Wayland
+if [ "${XDG_SESSION_TYPE}" = wayland ]; then
+    export MOZ_ENABLE_WAYLAND=1
+    # For Gimp
+    export GDK_BACKEND=x11
+else
+    unset MOZ_ENABLE_WAYLAND
+    unset GDK_BACKEND
+fi
+

~/.config/sway/config

-set $browser firefox
+set $browser firefox-wayland
1 Like

I am trying to run a Java Swing application called “The yEd Graph Editor”. I am setting the above in the .bashrc. But it is opened as a picture than a blank window as someone reported below on the project’s forum. Do you guess which setting I need to run it on Sway? The application yEd works on i3.

The yEd window remains blank under Wayland (with Sway) - The yEd window remains blank under Wayland (with Sway) - yEd Q&A

Here is the command log and the warning.

$ yEd &
[1] 420670
$
(java:420670): dbind-WARNING **: 18:46:47.645: Couldn't connect to accessibility bus: Failed to connect to socket /run/user/1000/at-spi/bus_0: No such file or directory
1 Like

For Java applications launching with blank window:

export _JAVA_AWT_WM_NONREPARENTING=1

The warning is about accessibility bus, I don’t think it is related to the window being blank.

1 Like

Thanks for the info, and it works! I updated my .bashrc below.

.bashrc

# Wayland
# https://wiki.archlinux.org/title/Wayland
# https://discussion.fedoraproject.org/t/tips-of-xwayland-with-sway/74757
if [ "${XDG_SESSION_TYPE}" = wayland ]; then
    export MOZ_ENABLE_WAYLAND=1
    # For Gimp
    export GDK_BACKEND=x11
    # For Java application
    export _JAVA_AWT_WM_NONREPARENTING=1
else
    unset MOZ_ENABLE_WAYLAND
    unset GDK_BACKEND
    unset _JAVA_AWT_WM_NONREPARENTING
fi

Okay.

1 Like