Sway Edition - General Conversation!

That’s right, ReGreet makes this very easy by allowing environment variables to be set right in the config. I don’t believe SDDM makes this quite as easy so you’ll have to cook up something else.

Just to clarify, these configs are importing environment variables into the user environment (which is different than setting environment variables system-wide).

A simple solution would to be to create a custom session file that sets your environment variables for you, similar to how you would set them in a desktop entry (see https://wiki.archlinux.org/title/Desktop_entries#Modify_environment_variables).

You can put a custom session file in /usr/local/share/wayland-sessions (so it doesn’t get overwritten when the Sway package gets updated). First create the directory if it doesn’t already exist:

sudo mkdir -p /usr/local/share/wayland-sessions

Then copy over the existing session file:

sudo cp /usr/share/wayland-sessions/sway.desktop /usr/local/share/wayland-sessions/

Open the new file with an editor and add your environment variables to the Exec line with env.

[Desktop Entry]
Name=Sway
Comment=An i3-compatible Wayland compositor
Exec=env XDG_CURRENT_DESKTOP=sway sway
Type=Application
DesktopNames=sway

Another approach would be to create a wrapper script that sets the environment variables before starting Sway as described in the Greetd wiki: https://man.sr.ht/~kennylevinsen/greetd/#how-to-set-xdg_session_typewayland

Then call the wrapper script on the Exec line of your custom session file (instead of calling sway directly).

[Desktop Entry]
Name=Sway
Comment=An i3-compatible Wayland compositor
Exec=/usr/local/bin/sway-run
Type=Application
DesktopNames=sway

Either way should work fine. :slightly_smiling_face:

Wow. That is a boatload of help. Thank you so much, @BluishHumility ! You are a scholar and a gentlebeing! This is going to give me a huge head start when I go break things on the weekend. I do my best break-the-system work then. :stuck_out_tongue:

This is how I set environment variables in sway

Thank you, Lorenzo! I’ll play with your method as well this weekend. I’ve read your work elsewhere but forgot to look at your solution this time around. Cheers!

From what I read around at that time, there are other ways, using a custom start script or using systemd. To be honest, that’s the easiest and (for me) best way to get what I needed and I seem to remember it’s one of the suggested approaches.
Hope it won’t ruin your weekend :wink:

@BluishHumility - can’t thank you enough for the EOS Sway edition instructions! I’ve been on a week-long quest to find a new DE, after my beloved Xfce finally failed me (see (Possibly SOLVED w/590.48) FYI: Xfce and Nvidia 580.119.02). Tldr, I found Sway (after giving I3 a whirl, but that still had some of the X11 issues I was having with Nvidia) and I’m truly home.

If you need any help testing anything new, let me know.

after me switching to sway i was first into replicating my personal i3 setup, but switched very fast to start from scratch .. and after hardened my personal setup i started to work on this here:

Whats about merging the work on the CE with this, to create a general setup to be added to the ISO sooner or later?

Looks really nice.

Screenshot_20260321_223830

Love this bit

Ein bisschen Spass muss sein:

True that