How to fix/debug discord screenshare issues on KDE

Given it does not exist, do you think that this is a bug? Like, I dont know if any screenshare portal or anything of the sort exists on my system, and I dont think there is a package for it.

Ah, whoops, sorry, lost this thread.

My bad, you’re looking for a user service:

systemctl --user status xdg-desktop-portal-kde.service

… unsure off the top of my head where on the filesystem these live.

[spiderunderurbed@daspidercave:/etc/nixos]$ systemctl --user status xdg-desktop-portal-kde.service

[spiderunderurbed@daspidercave:/etc/nixos]$ systemctl --user status xdg-desktop-portal-kde.service
Unit xdg-desktop-portal-kde.service could not be found.
[ble: exit 4]

[spiderunderurbed@daspidercave:/etc/nixos]$ 

Ok, having dug into the source code, the actual service name appears to be plasma-xdg-desktop-portal-kde.service.

If you still can’t find it, look around systemctl --user list-units.

[

spiderunderurbed@daspidercave:~]$ sudo systemctl status plasma-xdg-desktop-portal-kde.service
[sudo] password for spiderunderurbed: 
Unit plasma-xdg-desktop-portal-kde.service could not be found.
[ble: exit 4]

[spiderunderurbed@daspidercave:~]$ systemctl status --user plasma-xdg-desktop-portal-kde.service
○ plasma-xdg-desktop-portal-kde.service - Xdg Desktop Portal For KDE
     Loaded: loaded (/run/current-system/sw/share/systemd/user/plasma-xdg-desktop-portal-kde.service; linked-runtime; preset: ignored)
     Active: inactive (dead)
[ble: exit 3]

[spiderunderurbed@daspi

I tried starting the service, it didnt fix my screensharing issues

Awesome! Now we just need to understand why it’s inactive. What does journalctl --user -xe --unit plasma-xdg-desktop-portal-kde.service say?

Well before I turn it on, there are no entries. When I start it, i get this:
May 14 09:47:39 daspidercave systemd[1696]: Started Xdg Desktop Portal For KDE.

░░ Subject: A start job for unit UNIT has finished successfully
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░ 
░░ A start job for unit UNIT has finished successfully.
░░ 
░░ The job identifier is 900.

Nothing changes for the systemd service even if i try screensharing it, so its whole purpose is to start another process I guess

So, the service is this:

ExecStart=@CMAKE_INSTALL_FULL_LIBEXECDIR@/xdg-desktop-portal-kde
BusName=org.freedesktop.impl.portal.desktop.kde
Slice=session.slice
# Auto restart is off as we are DBus activated
Restart=no

It’s a dbus-activated service, i.e., it will be started automatically if some service requests a screenshare. Starting it manually should work fine too.

Systemd will keep track of any process it launches, and the systemctl status output should show you if it’s running (and extra metadata like its PID. If it’s not showing you that, the process died.

You can double check by grepping the ps output for that binary name, if you like.

All that said, if that’s failing to start we have our culprit. I’m a bit stuck here though; I have no idea why it would fail, and the logs are empty. Maybe try running the binary manually? If you read the service file you can see what binary to run.

https://pastebin.com/Sf0gz6Y2
^ I ran this command:
QT_LOGGING_RULES="*.debug=true" /nix/store/4mxb4j4ma1h88c5afhvny0jl48zfmkg6-xdg-desktop-portal-kde-6.3.5/libexec/xdg-desktop-portal-kde
the env varible so it actually output logs, i dunno if the output is useful

This might be related but idk:
kde.plasma.wayland.client: Unknown interface announced: zkde_screencast_unstable_v1 / 68 / 5

This issue is with OBS too, display capture is no longer available, I didn’t use to have this issue with OBS.

Seeing the same issue with KDE and possibly niri on - different machines - when trying to screenshare in Browser and Zoom.

  • On the machine with niri I’ve been having this issue for a few months now and wasn’t able to get anywhere with my debug skills.
  • The machine with KDE is new so I just stumbled over the issue there.

Also runnings on nixos-unstable.

Added some of my findings to nixos/Plasma6 Screenshare Portal is not avalible on KDE for wayland (and other applications) · Issue #407809 · NixOS/nixpkgs · GitHub

Not sure if this is helpful to anyone, but after 2 days of debugging I finally found the culprit.

I accidently overwrote all of environment.sessionVariables using a mkForce leading to a whole bunch of environment variables missing which broke my xdg portals…

The questionable code was

environment.sessionVariables = lib.mkForce {
  "NIX_PATH" = "/etc/nix/inputs/nixpgks";
};

instead of

environment.sessionVariables."NIX_PATH" = lib.mkForce "/etc/nix/inputs/nixpgks";
1 Like

That isn’t causing my problem because I do not use mkForce for my environment.sessionVaribles, I would MASSIVELY appreciate it if you could look at my config and tell me what could potentially be the cause? I already tried alot of debugging and I am a bit lost: