Kdeconnect under hyprland is problematic

Hi, I’m a newbie here on NixOS and I’m wondering what is the problem with kdeconnect.
The two major issues are that I cannot neither copy something from the computer so it will be transmitted to my phone clipboard nor I can share a link with my phone so it will be opened in my computer browser
but when I enable the plasma dekstop option in configuration.nix
services.xserver.desktopManager.plasma5.enable
it magically works but the issue remain that my system become bloated and the themes are messy because they are no longer handled by home-mnager.

so sadly for the first time in my life I’m asking for help online :frowning: , hoping it will not take too long to get resolved.

I’m going to guess it’s a wayland vs xorg issue; xwayland has a separate clipboard from the wayland one, sometimes you end up not being to copy between applications because of it. Are the applications you’re copying from running under xwayland? Is kdeconnect somehow running under xwayland when not under plasma?

That could be a desktop portal thing, or a misconfiguration of xdg-open/mimeapps. What do systemctl status --user xdg-desktop-portal, systemctl status --user xdg-desktop-portal-hyprland, systemctl status --user xdg-desktop-portal-kde and xdg-mime query default x-scheme-handler/http give you?

Thank you for your quick response.

I don’t think so because when I run hyprctl clients it shows that it is not running under xwayland :

Window 3c6b170 -> Kdeconnect under hyprland is problematic - Help - NixOS Discourse — Mozilla Firefox:
        mapped: 1
        hidden: 0
        at: 7,51
        size: 1906,1022
        workspace: 1 (1)
        floating: 0
        monitor: 0
        class: firefox
        title: Kdeconnect under hyprland is problematic - Help - NixOS Discourse — Mozilla Firefox
        initialClass: firefox
        initialTitle: Mozilla Firefox
        pid: 2471
        xwayland: 0
        pinned: 0
        fullscreen: 0
        fullscreenmode: 0
        fakefullscreen: 0
        grouped: 0
        swallowing: 0

Window 3c89440 -> KDE Connect:
        mapped: 1
        hidden: 0
        at: 7,51
        size: 946,1022
        workspace: 2 (2)
        floating: 0
        monitor: 0
        class: org.kde.kdeconnect.app
        title: KDE Connect
        initialClass: org.kde.kdeconnect.app
        initialTitle: KDE Connect
        pid: 3201
        xwayland: 0
        pinned: 0
        fullscreen: 0
        fullscreenmode: 0
        fakefullscreen: 0
        grouped: 0
        swallowing: 0
● xdg-desktop-portal.service - Portal service
     Loaded: loaded (/etc/systemd/user/xdg-desktop-portal.service; static)
     Active: active (running) since Thu 2023-11-23 00:17:55 +03; 12h ago
   Main PID: 2191 (.xdg-desktop-po)
      Tasks: 6 (limit: 18891)
     Memory: 3.9M
        CPU: 206ms
     CGroup: /user.slice/user-1000.slice/user@1000.service/session.slice/xdg-desktop-portal.service
             └─2191 /nix/store/ghxhmp45c3i5vb2kp4zmd9bq0zral544-xdg-desktop-portal-1.16.0/libexec/xdg-desktop-portal

Nov 23 00:17:54 DEKSTOP-System systemd[1217]: Starting Portal service...
Nov 23 00:17:55 DEKSTOP-System systemd[1217]: Started Portal service.
Nov 23 00:37:00 DEKSTOP-System .xdg-desktop-po[2191]: A backend call failed: Inhibiting other than idle not supported
Nov 23 00:37:04 DEKSTOP-System .xdg-desktop-po[2191]: Failed to get application states: GDBus.Error:org.freedesktop.portal.Error.Fa>
Nov 23 03:45:26 DEKSTOP-System .xdg-desktop-po[2191]: A backend call failed: Inhibiting other than idle not supported
Nov 23 12:43:52 DEKSTOP-System .xdg-desktop-po[2191]: Caught PipeWire error: connection error
Nov 23 12:44:02 DEKSTOP-System .xdg-desktop-po[2191]: PipeWire roundtrip timed out waiting for events
Nov 23 12:44:02 DEKSTOP-System .xdg-desktop-po[2191]: Failed connect to PipeWire: No node factory discovered
● xdg-desktop-portal-hyprland.service - Portal service (Hyprland implementation)
     Loaded: loaded (/etc/systemd/user/xdg-desktop-portal-hyprland.service; static)
     Active: active (running) since Thu 2023-11-23 00:17:55 +03; 10min ago
   Main PID: 2227 (.xdg-desktop-po)
      Tasks: 6 (limit: 18891)
     Memory: 12.6M
        CPU: 33ms
     CGroup: /user.slice/user-1000.slice/user@1000.service/session.slice/xdg-desktop-portal-hyprland.service
             └─2227 /nix/store/rgv7k3662ic04pikfjddsa0745ydi83a-xdg-desktop-portal-hyprland-0.3.1/libexec/xdg-desktop-portal-hyprla>

Nov 23 00:17:55 DEKSTOP-System systemd[1217]: Starting Portal service (Hyprland implementation)...
Nov 23 00:17:55 DEKSTOP-System systemd[1217]: Started Portal service (Hyprland implementation).
lines 1-12/12 (END)
Unit xdg-desktop-portal-kde.service could not be found.

I do not know what is the problem wit kde portal I cannot enable it or start it because I have already add it to my config

xdg.portal.enable = true;
xdg.portal.extraPortals=[
  pkgs.xdg-dekstop-portal-gtk
  pkgs.xdg-dekstop-portal-kde
];
firefox.desktop

this looks fine

I think there are a major step related to xdg-desktop-portal-kde that I’m missing but cannot find it.

Hello abc!
I don’t use KDEConnect but GNOME with GSConnect (which is based on KDEConnect) and I remember that I had to open some ports in my firewall in order for GSConnect to work properly. As the KDE Wiki states, KDEConnect uses dynamic ports in the range 1714-1764 for UDP and TCP. So I customized my configuration like this:

# ...
networking = {
    hostName = hostname;
    networkmanager.enable = true;
    firewall.enable = true;
    firewall.allowedTCPPortRanges = [ { from = 1714; to = 1764;} ]; # for Gsconnect
    firewall.allowedUDPPortRanges = [ { from = 1714; to = 1764;} ]; # for Gsconnect
  };
#...

Before I opened the ports, when i tried to send data to my phone I would get a notification on my computer that it was sent, but the data never actually arrived. After opening the specified ports, sending data works as expected and I get a separate notification as well that confirms the successful transfer.

A word of caution though: I’m very new to NixOS myself so I don’t know if this applies to your case. Just want to share my personal experience in case it might be useful. =)

Thank you for your reply sleepy :slight_smile:

I’m aware of port issue but it is not the problem what I’m facing because the phone is connected
and functioning but the issue is with these two features only.

If you use the kdeconnect module (and set the package to GSConnect) it will do ghat for you: https://github.com/NixOS/nixpkgs/blob/f741f8a839912e272d7e87ccf4b9dbc6012cdaf9/nixos/modules/programs/kdeconnect.nix#L30

Afaik the hyprland desktop portal is incompatible with any other desktop portals. At least in the past, that broke file pickers for me. You certainly don’t want to run the gtk portal in addition to the others.

YMMV though, kdeconnect might not even use the desktop portal.

1 Like

I see. I’m sorry I wasn’t able to help you. I keep my fingers crossed that you’ll find a solution eventually! :slightly_smiling_face:

1 Like

I wasn’t aware of this option. That’s great, I came here with the intention to offer help (although unsuccessfully) and I learned something new myself! Thanks for pointing it out, TLATER! :smiley:

1 Like

I have noticed something days ago so I thought it may help to eliminate some factors from the equation of this problem , when I open kdeconnect UI and suprised that when pasted text on the text box IT WAS WORKING !!

but don’t know when I click send clipboard to the phone I got empty text I think there are a dependency or something that kdeconnect need clipboard works , I have tried install klipper ( KDE Clipboard ) if it may do anything but with no luck :face_holding_back_tears:

Oh god, Finally it works
the workaround for now that to add
plasma-workspace to my home manager

pkgs.libsForQt5.plasma-workspace

then with each boot I need to run

startplasma-wayland

It will eventually not run since there are other packages needed
for plasma desktop to work but It does initiate something that fix clipboard issue

and it will not interfere my theming like the services.xserver.desktopManager.plasma5.enable option

Yeah , I know it is a shitty solution but it works for now
I would investigate later to find better solution

the remaining issue is sharing links from phone to computer browser do not work even with this workaround

Hey @abc
Did you find any proper solution for this issue?

I’m also having this and its quite bothering me since I always use this clipboard sharing functionality with additional devices.

I’ve added the plasma-workspace package and when i run startplasma-wayland, it actually starts the plasma greeting and will never go away.

I’m on Nix OS 23.11 with sway wm