That is a surprising result. I would double-check for a mistake.
Alternatively, a simple and effective way for setting environment variables when launching Sway is to create a wrapper script as described in the greetd wiki:
How to set XDG_SESSION_TYPE=wayland/…?
While you could set this in your
.profile
, the recommended way to handle this is with a wrapper script. Doing it this way allows you to start multiple login environments without having weird env vars mess with things.
- /usr/local/bin/sway-run (should be made executable)
#!/bin/sh # Session export XDG_SESSION_TYPE=wayland export XDG_SESSION_DESKTOP=sway export XDG_CURRENT_DESKTOP=sway # Wayland stuff export MOZ_ENABLE_WAYLAND=1 export QT_QPA_PLATFORM=wayland export SDL_VIDEODRIVER=wayland export _JAVA_AWT_WM_NONREPARENTING=1 exec sway $@ # # If you use systemd and want sway output to go to the journal, use this # instead of the `exec sway $@` above: # # exec systemd-cat --identifier=sway sway $@ #
Simply use
sway-run
instead ofsway
to log in.
You don’t need to be using greetd to use this method, the important thing is to launch Sway with the script (instead of just sway
) with whatever method you use to start the session.