Avoid hardcoding XDG_CURRENT_DESKTOP, mention dbus implementation quirks

Vladimir-csp 2024-09-15 02:36:40 +03:00
parent 30f6ba04a2
commit 6e65be864d

@ -4,11 +4,21 @@ Make sure you have installed both the `gtk` and `wlr` portal backends.
## Setup the environment
From [xdg-desktop-portal-wlr](https://github.com/emersion/xdg-desktop-portal-wlr/tree/master?tab=readme-ov-file#running):
> Make sure `XDG_CURRENT_DESKTOP` is set. Make sure `WAYLAND_DISPLAY` and `XDG_CURRENT_DESKTOP` are imported into D-Bus. If you're running Sway, this can be added to your config file:
```sh
exec dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway
> Make sure `XDG_CURRENT_DESKTOP` is set. Make sure `WAYLAND_DISPLAY` and `XDG_CURRENT_DESKTOP` are imported into D-Bus.
See [Systemd and dbus activation environments](https://github.com/swaywm/sway/wiki#systemd-and-dbus-activation-environments)
If dbus implementation is `dbus-broker`, systemd activation environment is used:
```
`--systemd` can be omitted if you don't use it.
exec systemctl --user import-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=${XDG_CURRENT_DESKTOP:-sway:wlroots}
```
If classic dbus is used, it has its own separate one:
```sh
exec dbus-update-activation-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=${XDG_CURRENT_DESKTOP:-sway:wlroots}
```
`XDG_CURRENT_DESKTOP` should be passed through in case it was set before sway (i.e. by a Display Manager)
## Set the portals Sway should use
From `portals.conf(5)`: