Skip to content

Conversation

@City-busz
Copy link

This fixes the problem that XDG Desktop Portal does not use the LXQt backend under LXQt session.

This fixes the problem that XDG Desktop Portal does not use the LXQt backend under LXQt session.
@stefonarch
Copy link
Member

I'm not sure about this. Testing on a clean user and openbox the portal isn't loaded with or without this. It needs here systemctl --user restart xdg-desktop-portal to work after login.

@City-busz
Copy link
Author

@stefonarch: Are you sure? What happens if you replace the command with this?
dbus-update-activation-environment --systemd XDG_CURRENT_DESKTOP

@stefonarch
Copy link
Member

This looks working at a first test. But that portal stuff is weird IMO always a little bit.

@City-busz
Copy link
Author

The XDG Desktop Portal documentation recommends these two commands:
https://flatpak.github.io/xdg-desktop-portal/docs/system-integration.html#d-bus-activation-environment

And labwc already do this:
https://github.com/labwc/labwc/blob/7f67b9c8664b57eefb70644b2c17ceb378acd49e/src/config/session.c#L213-L245

This is why the proper portal backend is loaded when using labwc, but not when using other window managers/compositors.

@stefonarch
Copy link
Member

stefonarch commented Oct 18, 2025

On a second test it didn't work, with a cold boot. Labwc does it well, Hyprland too, niri not (with LXQt), the others I don't remember atm, kwin_wayland has issues too.

What I see isn't logical, and I remember similar behavior on niri:

  1. applied your patch, rebooted
  2. login in the test user from tty
  3. Portal isn't loaded
  4. systemctl --user restart xdg-desktop-portal loads it.
  5. Close session, logout from tty and log in again and start the session
  6. Portal is loaded now.

@stefonarch
Copy link
Member

stefonarch commented Oct 18, 2025

Another 2 reboots and tests, it works fine with niri, and it worked twice now with x11 too.

Tested cold boot into kwin_wayland - it fixes the not loading there too.
@tsujan can you confirm this?

@tsujan
Copy link
Member

tsujan commented Oct 18, 2025

@tsujan can you confirm this?

The portal is correctly loaded here on both labwc and kwin_wayland without needing any patch. labwc has always been OK. They may have made a change to KWin recently; I see new lines about portals in my log when I log into LXQt+kwin_wayland.

Anyway, I think we need @palinek to look into this.

@stefonarch
Copy link
Member

Are you sure? Try to boot directly into kwin_wayland.

@tsujan
Copy link
Member

tsujan commented Oct 18, 2025

Are you sure?

Yes. I remember we didn't know why it worked for me but not for you.

Also, some things seem to have changed in KWin 6.4.X in a positive direction.

@tsujan
Copy link
Member

tsujan commented Oct 18, 2025

BTW, don't forget that, even if this change can have a nonrandom effect on Wayland, its place should be changed in lxqt/lxqt-wayland-session#90: logically, it should come after the last instance of export XDG_CURRENT_DESKTOP=….

@City-busz
Copy link
Author

Tested cold boot into kwin_wayland - it fixes the not loading there too.

kwin_wayland does not load the LXQt portal for me either without this change. I'm using KWin 6.4.5.

BTW, don't forget that, even if this change can have a nonrandom effect on Wayland, its place should be changed in lxqt/lxqt-wayland-session#90: logically, it should come after the last instance of export XDG_CURRENT_DESKTOP=….

Now I updated that pull request to call this command after every XDG_CURRENT_DESKTOP export.

@tsujan
Copy link
Member

tsujan commented Oct 18, 2025

If it works for both of you, that's a good sign.

@palinek, can it have any side effect?


# set environment variables for new units started by user service manager
if command -v systemctl >/dev/null; then
systemctl --user import-environment XDG_CURRENT_DESKTOP
Copy link
Contributor

@palinek palinek Oct 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we push the variable into the systemd environment block for the sake of running lxqt-session, then we probably should also remove it (systemctl --user unset-environment) after lxqt-session's end.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if it's needed, because it seems that these variables are imported to the systemd user environment anyway, the systemctl --user show-environment command lists them after login. This explicit import just ensures that it happens early enough before the XDG Desktop Portal service starts.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I remember login from tty with startx with xfwm4 it was needed, but I'm not sure if DMs play a role in set/unset here too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants