# Xdg-desktop-portal not working on Wayland while KDE is installed?

**URL:** https://discourse.nixos.org/t/xdg-desktop-portal-not-working-on-wayland-while-kde-is-installed/20919
**Category:** Help
**Created:** [August 12, 2022, 10:01am UTC](https://discourse.nixos.org/t/xdg-desktop-portal-not-working-on-wayland-while-kde-is-installed/20919 "2022-08-12T10:01:28Z")
**Posts on this page:** 1
**Showing post:** 3

<div class="post-metadata">

### Author: ![feliix42](https://discourse.nixos.org/user_avatar/discourse.nixos.org/feliix42/32/3196_2.png) [@feliix42](https://discourse.nixos.org/u/feliix42)
#### Post date: [January 3, 2023, 5:27pm UTC](https://discourse.nixos.org/t/xdg-desktop-portal-not-working-on-wayland-while-kde-is-installed/20919/3 "2023-01-03T17:27:40Z")

</div>

I managed to solve the problem after a while of tinkering, though forgot to post it (shame on me). So here it is, for future reference (and adapted to `nixos-22.11`):

1. My configuration for `xdg-portal` now looks like this:

```nix
xdg.portal = {
  enable = true;
  extraPortals = with pkgs; [
    xdg-desktop-portal-wlr
    xdg-desktop-portal-kde
    xdg-desktop-portal-gtk
  ];
  wlr = {
    enable = true;
    settings = { # uninteresting for this problem, for completeness only
      screencast = {
        output_name = "eDP-1";
        max_fps = 30;
        chooser_type = "simple";
        chooser_cmd = "${pkgs.slurp}/bin/slurp -f %o -or";
      };
    };
  };
};

```

2. I guess this is the most crucial part which I messed up because I didn’t know better: You must announce the fact that a sway session is running to `systemd` manually. This is extensively documented in the sway wiki but well, if you don’t know where the problem is it’s hard to look for a solution in the right places. Put this in `~/.config/sway/config`:

```ini
# announce a running sway session to systemd
exec systemctl --user import-environment XDG_SESSION_TYPE XDG_CURRENT_DESKTOP
exec dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway

```

Works like a charm now.

---

_[View the full topic](https://discourse.nixos.org/t/xdg-desktop-portal-not-working-on-wayland-while-kde-is-installed/20919)._
