FS#72297 - [sway] Set XDG_CURRENT_DESKTOP and import into systemd user environment
Attached to Project:
Community Packages
Opened by Max Gautier (VannTen) - Thursday, 30 September 2021, 08:07 GMT
Last edited by Brett Cornwall (ainola) - Wednesday, 01 November 2023, 20:12 GMT
Opened by Max Gautier (VannTen) - Thursday, 30 September 2021, 08:07 GMT
Last edited by Brett Cornwall (ainola) - Wednesday, 01 November 2023, 20:12 GMT
|
Details
Description:
The sway package in archlinux ships with the following `/etc/sway/config.d/50-systemd-user.conf` ``` # sway does not set DISPLAY/WAYLAND_DISPLAY in the systemd user environment # See # Adapted from xorg's 50-systemd-user.sh, which achieves a similar goal. exec systemctl --user import-environment DISPLAY WAYLAND_DISPLAY SWAYSOCK exec hash dbus-update-activation-environment 2>/dev/null && \ dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK ``` In the pipewire article it is noted that to correctly use xdg-destktop-portal-wlr the XDG_CURRENT_DESKTOP has to be set to the name of the compositor (sway) in the environment of the systemd user instance. https://wiki.archlinux.org/title/PipeWire#WebRTC_screen_sharing Would it make sense to add that variable to 50-systemd-user.conf for a better out of the box experience ? Additional info: * package version(s) sway 1:1.6.1-1 |
This task depends upon
Closed by Brett Cornwall (ainola)
Wednesday, 01 November 2023, 20:12 GMT
Reason for closing: Implemented
Additional comments about closing: sway 1:1.8.1-3 fixes this!
Wednesday, 01 November 2023, 20:12 GMT
Reason for closing: Implemented
Additional comments about closing: sway 1:1.8.1-3 fixes this!
According to https://github.com/swaywm/sway/pull/6227#issuecomment-826288321 they do not want that variable in sway.desktop.
According to https://bugzilla.mozilla.org/show_bug.cgi?id=1640115#c10 last line, sway will not set XDG_CURRENT_DESKTOP itself. This is also absent in the manual page sway(1) near the bottom.
I don't think upstream would be in favor of this change if they explicitly don't want to set it themselves.
The Arch wiki page for sway currently does not mention XDG_CURRENT_DESKTOP. My suggestion is to add the information there.
Upstream has confirmed their non-intention to set that variable as their belief is that users should set this up themselves (not out of gatekeeping but rather due to unfortunately poor specification by xdg-desktop-portal). This puts us in an awkward position: Do we pull a Debian and deviate or do we merely shrug and improve the docs?
There's a near-universal need for users to share their desktops, which guarantees that manual intervention would be involved if we don't do anything. We will likely continue to get bug reports and most users of Sway will require going through this irritation.
After conferring with maximbaz, we decided upon pragmatism and will go forward with setting/exporting XDG_CURRENT_DESKTOP=sway in the default configuration. There will be a separate /etc/sway/config.d/40-environment.conf file that will be sourced before the systemd/dbus environment import file. The intention here is that the default configuration will provide all of this nonsense for the majority that just want their desktop to function, whereas the edge cases can simply ignore importing the file.
- `dbus-update-activation-environment` is always present (because it's provided by dbus, which is required by systemd, which in turn is part of base), so we don't need to check its existence with `hash`
- `dbus-update-activation-environment --systemd XXX` already imports to systemd user environment, so we can safely remove `systemctl --user import-environment XXX` as duplicate
- `dbus-update-activation-environment` allows usage as `dbus-update-activation-environment --systemd NAME=VALUE`
So we can reduce 50-systemd-user.conf to be simply:
dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK
And create 40-environment.conf with this content:
dbus-update-activation-environment --systemd XDG_CURRENT_DESKTOP=sway
We can also consider renaming these files for clarity, e.g. 50-systemd-user.conf -> 50-display.conf and 40-environment.conf -> 60-xdg.conf, but I don't mind too much about the naming you choose, go with whatever makes sense to you.
Thanks for bringing this up again. It should really be fixed now.