Opened 4 months ago

Closed 3 months ago

#19087 closed enhancement (fixed)

Adding xdg-desktop-portal*

Reported by: Rahul Chandra Owned by: pierre
Priority: normal Milestone: 12.1
Component: BOOK Version: git
Severity: normal Keywords:
Cc:

Description

The xdg-portals allow for more seamless integration of desktop UI widgets with applications, allowing programs to universally access things like the native file-picker, screenshare tools and others without worrying about the specific desktop environments. In gnome this also allows the dark-mode libadwaita switching to work properly.

Packages:
xdg-portal
xdg-portal-gtk
xdg-portal-gnome
xdg-portal-kde
xdg-portal-lxqt

Please feel free to chime-in on any suggestions or if these should be added to the book at all.

Change History (19)

comment:1 by Xi Ruoyao, 4 months ago

I have xdg-desktop-portal and xdg-desktop-portal-gnome installed (for supporting a simple screen recorder/caster written by myself; OBS is just too heavy to install on LFS).

comment:2 by Rahul Chandra, 4 months ago

Great are you on sysv? I was talking with Doug. earlier about writing the sysv start scripts as we don't have systemd user services on sysv.

in reply to:  2 comment:3 by Xi Ruoyao, 4 months ago

Replying to Rahul Chandra:

Great are you on sysv? I was talking with Doug. earlier about writing the sysv start scripts as we don't have systemd user services on sysv.

I'm on systemd :(.

comment:4 by Douglas R. Reno, 4 months ago

I've been thinking about this and I might be able to write the scripts for SysV and test it if you want :)

It would take a couple of days though.

comment:5 by Douglas R. Reno, 4 months ago

It looks like this might just be dbus activated from what I'm reading (just like at-spi2), so there probably isn't a need to write an XDG Autostart script. It should definitely still be tested on SysV though

comment:6 by pierre, 4 months ago

I'm building a VM with lfs-sysV. I'll take the ticket when the VM is ready unless somebody beats me on this. But I am not sure how to test for each DE... Hints welcome :)

comment:7 by Xi Ruoyao, 4 months ago

Summary: Adding xdg-portal-*Adding xdg-desktop-portal*

comment:8 by pierre, 4 months ago

Owner: changed from blfs-book to pierre
Status: newassigned

comment:9 by pierre, 4 months ago

What do you think of location in book? I'd say it is in "graphics environment libraries" for xdg-desktop-portal and xdg-desktop-portal-gtk, in gnome/platform for xdg-desktop-portal-gnome, in lxqt/desktop for xdg-desktop-portal-lxqt, while xdg-desktop-portal-kde is in the plasma group and we already build it, although it is useless without xdg-desktop-portal...

in reply to:  9 ; comment:10 by Douglas R. Reno, 4 months ago

Replying to pierre:

What do you think of location in book? I'd say it is in "graphics environment libraries" for xdg-desktop-portal and xdg-desktop-portal-gtk, in gnome/platform for xdg-desktop-portal-gnome, in lxqt/desktop for xdg-desktop-portal-lxqt, while xdg-desktop-portal-kde is in the plasma group and we already build it, although it is useless without xdg-desktop-portal...

Hi Pierre,

I'm thinking Graphical Environment Libraries is the proper spot for xdg-desktop-portal and xdg-desktop-portal-gtk. Let's put xdg-desktop-portal-gnome after gsound, since it's technically still a platform library instead of a desktop component. For lxqt, I'd recommend putting it after lxqt-runner. For KDE I think we should still add a runtime dependency to xdg-desktop-portal - the KDE portal does build right now, but it still needs that package to properly function.

For a test I'd recommend using Libreoffice in either LXQt or Plasma (or both!) after setting a different theme in your System Settings, and seeing if the File Open dialog matches the new theme that you've set. If you're on a systemd system, it's also worth running a 'systemctl status --user' to see if you have any hits for xdg-desktop-portal while you've got that File Open dialog open. On SysV I think you'd be able to find it with a 'ps -aux' from a terminal since dbus should activate it. You should be able to check that in GNOME and XFCE as well, maybe using 'lsof' to check and see if the libraries installed by the gnome and gtk portal are in use (those might be good for other DEs too).

In theory Firefox should also use an XDG portal so if you have that installed, that might be a lighter test :)

comment:11 by Rahul Chandra, 4 months ago

Yup if your on a gnome system the fastest way to test it is to open a libadwaita app like nautilus and try setting your theme to "Dark Style" from either the dropdown menu or from settings and see if it changes. (You need xdg-desktop-portal-gnome for this)

I agree with Doug when it comes to the placements of *-gnome, *-kde etc, maybe just mention on the xdg-portal page that you need one of them for the package to do anything at all (runtime).

in reply to:  10 comment:12 by Rahul Chandra, 4 months ago

Replying to Douglas R. Reno:

For a test I'd recommend using Libreoffice in either LXQt or Plasma (or both!) after setting a different theme in your System Settings, and seeing if the File Open dialog matches the new theme that you've set. If you're on a systemd system, it's also worth running a 'systemctl status --user' to see if you have any hits for xdg-desktop-portal while you've got that File Open dialog open. On SysV I think you'd be able to find it with a 'ps -aux' from a terminal since dbus should activate it.

I'm really hoping that dbus auto activates it on sysv, on my systemd systems it's working great under gnome and KDE.

comment:13 by pierre, 4 months ago

On my sysv system, with xdg-desktop-portal and xdg-desktop-portal-gtk installed, after restarting GNOME, I get:

$ ps aux | grep portal
pierre    2226  0.0  0.4 431276 81144 tty7     Sl+  11:29   0:02 /usr/bin/Xwayland :0 -rootless -noreset -accessx -core -auth /run/user/1000/.mutter-Xwaylandauth.Y9V1G2 -listenfd 4 -listenfd 5 -displayfd 6 -initfd 7 -byteswappedclients -enable-ei-portal
pierre    2668  0.0  0.0 334392 11008 tty7     Sl+  11:29   0:00 /usr/libexec/ibus-portal
pierre    2795  0.0  0.0 497428 15224 tty7     Sl+  11:29   0:00 /usr/libexec/xdg-desktop-portal
pierre    2805  0.0  0.0 631796 10640 tty7     Sl+  11:29   0:00 /usr/libexec/xdg-document-portal
root      2811  0.0  0.0   2832  1664 ?        Ss   11:29   0:00 fusermount3 -o rw,nosuid,nodev,fsname=portal,auto_unmount,subtype=portal -- /run/user/1000/doc
pierre    2816  0.0  0.1 441352 28296 tty7     Sl+  11:29   0:00 /usr/libexec/xdg-desktop-portal-gtk
pierre    5316  0.0  0.0  33768  2560 pts/0    S+   13:12   0:00 grep --color=auto portal

Note that I am not sure ibus-portal and ei-portal are from the xdg-desktop-... packages.

Also, since fusermount seems to have done something, I've tried:

$ mount
[...]
portal on /run/user/1000/doc type fuse.portal (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000)

Not sure what the use of that is...

comment:14 by pierre, 4 months ago

My tests seem good for GNOME on sysv... For example, using firefox, and the "dark" theme, when I right click on a file to download, I get the chooser in dark. Now to test with kde...

comment:15 by pierre, 4 months ago

For kde, xdg-desktop-portal-kde is not launched unless /opt/kf5/share/xdg-desktop-portal/kde-portals.conf is copied to /usr/share/xdg-desktop-portal and /opt/kf5/share/xdg-desktop-portal/portals/kde.portal is copied to /usr/share/xdg-desktop-portal/portals. When this is done, all seems ok. Not sure whether we could influence xdg-desktop-portal search order so that it really uses /opt/kf5/share (which is in XDG_DATA_DIRS, and should be used according to the docs, but with low priority).

comment:16 by pierre, 4 months ago

I've pushed a first version in branch plabs/xdg-desktop-portal... Could someone test with systemd? Also I am not sure what to expect from the -lxqt backend: seems there is only the file chooser backend. Actually, we have two "versions" of lxqt in the book: one using needed parts of kde frameworks and plasma in /usr, and another one using full kf5 and plasma in /opt/kf5. I am not sure the latter has been fully tested! Please speak up if you think it has been...

in reply to:  15 ; comment:17 by pierre, 4 months ago

Replying to pierre:

Not sure whether we could influence xdg-desktop-portal search order so that it really uses /opt/kf5/share (which is in XDG_DATA_DIRS, and should be used according to the docs, but with low priority).

Maybe try to put /opt/kf5/share before /usr/share in XDG_DATA_DIRS

in reply to:  17 comment:18 by pierre, 4 months ago

Replying to pierre:

Replying to pierre:

Not sure whether we could influence xdg-desktop-portal search order so that it really uses /opt/kf5/share (which is in XDG_DATA_DIRS, and should be used according to the docs, but with low priority).

Maybe try to put /opt/kf5/share before /usr/share in XDG_DATA_DIRS

No, it's not enough (looks like a bug in xdg-desktop-portal, at least in doc).

comment:19 by pierre, 3 months ago

Resolution: fixed
Status: assignedclosed

Fixed at 9fbf060174 and preceding commits.

Note: See TracTickets for help on using tickets.