[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

MBF: adding portals.conf(5) to desktop environments



xdg-desktop-portal is a D-Bus service providing access to
desktop-environment-related functionality for applications. It was
originally written to provide sandboxed apps (Flatpak, Snap, etc.) with
limited access to resources outside their sandbox with user consent, but
is increasingly also used by non-sandboxed apps (.deb or equivalent) as a
desktop-environment-independent interface to features like screen-sharing
that are otherwise difficult to implement in a cross-desktop way.

xdg-desktop-portal itself does not contain any
desktop-environment-specific code, and is shared between
all desktop environments. However, a lot of what it does requires use of
desktop-environment-specific mechanisms or user interface conventions.
To allow for that, it contacts a desktop-specific backend (x-d-p-gtk,
x-d-p-gnome, x-d-p-kde and so on) and uses that to provide its full
functionality.

In Debian 12, if xdg-desktop-portal does not find a suitable backend
for the current desktop environment, it would fall back to trying *any*
backend. This meant that all backends needed to be prepared to run in an
environment where their functionality cannot actually work, which is
rarely tested, leading to undesired situations where a desktop
environment's backend can cause bugs (such as crashes or slow application
startup) while running different desktop environments.

xdg-desktop-portal 1.17.x is now available in experimental, and this version
contains upstream changes so that desktop environments can have more control
over the backends they use. As described in
<https://github.com/flatpak/xdg-desktop-portal/blob/main/doc/portals-conf.rst>,
the recommendation is now that each desktop environment should provide
a file listing its preferred backends, similar to the one added by
<https://gitlab.gnome.org/GNOME/gnome-session/-/merge_requests/95/diffs>
in GNOME.

In a future version of xdg-desktop-portal, installing a portals.conf(5)
file is likely to become a requirement for desktop environments that
want to have working portal interfaces. For the moment, there is some
backwards-compatibility to keep existing desktop environments mostly
working (see below).

I'm intending to re-upload x-d-p 1.17.x to unstable soon.

Packages affected
=================

Any package that registers itself as an X11 or Wayland desktop session
(/usr/share/xsessions/*.desktop, /usr/share/wayland-sessions/*.desktop)
is potentially affected. I attach a dd-list of packages that register
these files (excluding gnome-session, which I already changed).

As a lower priority, any other session manager, window manager or
other desktop-environment-like thing that sets the XDG_CURRENT_DESKTOP
environment variable could also participate in this mechanism. I don't
intend to mass-file bugs for these in any systematic way.

I intend to prioritize opening bugs for the major desktop environments that
have a task-foo-desktop metapackage: cinnamon, gnome-flashback, kde, lxde,
lxqt, mate, xfce. For task-gnome-desktop, I already uploaded gnome-session
44.0-3 with
<https://salsa.debian.org/gnome-team/gnome-session/-/commit/b201c9c40e3adc7bf0b1c3504bef4c8602aac31d>
included in it - that's an example of the sort of changes that are needed.

Action to be taken
==================

If the desktop environment is independent of any others, with no ":"
in $XDG_CURRENT_DESKTOP (like GNOME, KDE Plasma, Cinnamon) then it should:

- take the single string that it uses in XDG_CURRENT_DESKTOP
  (GNOME, KDE, X-Cinnamon)
- fold it to lower case (gnome, kde, x-cinnamon)
- install /usr/share/xdg-desktop-portal/${desktop}-portals.conf in either
  the package that provides the desktop session or one of its dependencies
- in that file, describe the portal backends that xdg-desktop-portal users
  should normally be using while logged in to this desktop environment

If the desktop environment behaves like a variant of another desktop
environment and sets XDG_CURRENT_DESKTOP to a ":"-separated sequence of
decreasingly specific names (like Budgie, which sets XDG_CURRENT_DESKTOP
to "Budgie:GNOME") then it has two choices:

1. Behave like an independent desktop environment by installing its own
   ${desktop}-portals.conf, for example Budgie could install
   budgie-portals.conf
2. Behave like its parent desktop environment and accept the parent desktop
   environment's choice of backends, for example Budgie could rely on
   GNOME's gnome-portals.conf

The correct choice depends on how similar the desktop environment is to
its parent. I suspect that GNOME Classic (in the gnome-shell-extensions
package) is similar enough to the default GNOME environment that it
can safely rely on gnome-portals.conf, but Budgie and GNOME Flashback
are sufficiently different that they will probably need their own
desktop-specific *-portals.conf.

A desktop-specific *-portals.conf can either be provided by the upstream
project or by the Debian maintainer. It will usually be appropriate to
try to send this change upstream.

For desktop environment maintainers who are familiar with the use of
mimeapps.list to select preferred desktop-specific MIME handlers: the
portals.conf(5) search path is intentionally very similar.

For the more complete / less self-assembled desktop environments, it would
also be a good idea to declare a Depends or Recommends on the desired
portal backend in either the desktop session itself or a larger metapackage,
particularly if it's something other than x-d-p-gtk. GNOME and KDE both do
this already, and Sway has a Suggests on x-d-p-wlr.

Customized and user-specific desktop environments
=================================================

If a sysadmin or user has constructed their own desktop environment from
smaller components, has customized their environment, or wishes to use
portal backends that are not the ones recommended by their desktop
environment maintainer, they can write similar portals.conf(5) files to
set up whatever portals they prefer, and install them into
/etc/xdg-desktop-portal or ~/.config/xdg-desktop-portal.
Please see
<https://github.com/flatpak/xdg-desktop-portal/blob/main/doc/portals-conf.rst>
for more details. In xdg-desktop-portal (>= 1.17) the same information
is installed as portals.conf(5) and referred to by debian/NEWS.

If the desktop environment does not set the XDG_CURRENT_DESKTOP
environment variable in the D-Bus/systemd activation environment, the
sysadmin or user will need to either use a portals.conf with no desktop
environment prefix, or set XDG_CURRENT_DESKTOP to a suitable value as
a prerequisite for creating a desktop-specific portals.conf(5).

Backwards-compatibility
=======================

If no portals.conf(5) appropriate for the current desktop environment is
found, xdg-desktop-portal will fall back to checking the older UseIn=
field in each backend's .portal files, with a warning. For example, this
should be enough to get the desired portal backend in KDE Plasma. This
mechanism will probably be removed eventually by upstream.

As a Debian-specific change, if xdg-desktop-portal does not find any
backend that declares that it should be used in the current desktop
environment, xdg-desktop-portal will fall back to trying to use
xdg-desktop-portal-gtk, again with a warning. This is because despite
originally being designed for GNOME only, x-d-p-gtk has traditionally
been treated like a reference implementation of a portal backend, and
is the backend that has traditionally been installed by users of desktop
environments that do not yet have their own backend. This is a short-term
Debian-specific change, and we plan to remove it when the major desktop
environments have had a chance to add a portals.conf(5).

    smcv
Albin Tonnerre <lutin@debian.org>
   e17 (U)

Alexander Wirt <formorer@debian.org>
   subtle

Alf Gaida <agaida@siduction.org>
   lxqt-session (U)

Andrea Bolognani <eof@kiyuko.org>
   spectrwm

Andreas Metzler <ametzler@debian.org>
   e17 (U)
   wmaker (U)

Andrew Lee (李健秋) <ajqlee@debian.org>
   lxde-common (U)
   lxqt-session (U)

Andriy Grytsenko <andrej@rep.kiev.ua>
   lxde-common (U)

Arnaud Ferraris <aferraris@debian.org>
   plasma-mobile (U)

Arnaud Ferraris <arnaud.ferraris@gmail.com>
   phosh (U)

Aron Xu <aron@debian.org>
   ukui-session-manager (U)

Arun Kumar Pariyar <arun@debian.org>
   cutefish-core

Arun Kumar Pariyar <openarungeek@gmail.com>
   cutefish-core

Aurélien COUDERC <coucouf@debian.org>
   plasma-bigscreen (U)
   plasma-workspace (U)

Axel Beckert <abe@debian.org>
   flwm

Benda Xu <heroxbd@gentoo.org>
   stumpwm (U)

Benda Xu <orv@debian.org>
   stumpwm (U)

Birger Schacht <birger@debian.org>
   sway (U)

Boyuan Yang <byang@debian.org>
   wayfire

ChangZhuo Chen (陳昌倬) <czchen@debian.org>
   lxqt-session (U)

Chris Boyle <cmb@debian.org>
   aewm++
   sapphire

Christoph Egger <christoph@debian.org>
   herbstluftwm

Christoph Martin <martin@uni-mainz.de>
   cinnamon (U)

Christopher James Halse Rogers <raof@ubuntu.com>
   mir (U)

Clint Adams <clint@debian.org>
   xmonad (U)

David Mohammed <fossfreedom@ubuntu.com>
   budgie-desktop

Debian Cairo-dock Maintainers <team+pkg-cairo-dock-devel@tracker.debian.org>
   cairo-dock

Debian Cinnamon Team <debian-cinnamon@lists.debian.org>
   cinnamon

Debian Common Lisp Team <debian-common-lisp@lists.debian.org>
   stumpwm

Debian Edu Packaging Team <debian-edu-pkg-team@lists.alioth.debian.org>
   impressive-display
   surf-display

Debian Emacsen team <debian-emacsen@lists.debian.org>
   exwm

Debian GNOME Maintainers <pkg-gnome-maintainers@lists.alioth.debian.org>
   gnome-flashback
   gnome-shell-extensions

Debian Haskell Group <pkg-haskell-maintainers@lists.alioth.debian.org>
   xmonad

Debian i3 maintainers <team+i3@tracker.debian.org>
   i3-wm

Debian LXDE Maintainers <pkg-lxde-maintainers@lists.alioth.debian.org>
   lxde-common

Debian Mir Team <team+mir@tracker.debian.org>
   mir

Debian Multimedia Maintainers <debian-multimedia@lists.debian.org>
   kodi

Debian Pkg-e Team <pkg-e-devel@lists.alioth.debian.org>
   e17

Debian QA Group <packages@qa.debian.org>
   blackbox
   ctwm
   lwm
   miwm
   pekwm

Debian Qt/KDE Maintainers <debian-qt-kde@lists.debian.org>
   plasma-bigscreen
   plasma-workspace

Debian Remote Maintainers <debian-remote@lists.debian.org>
   remmina

Debian Sugar Team <pkg-sugar-devel@lists.alioth.debian.org>
   sugar

Debian UBports Team <team+ubports@tracker.debian.org>
   lomiri-session
   mir (U)

Debian Window Maker Team <pkg-wmaker-devel@lists.alioth.debian.org>
   wmaker

Debian Window Maker Team <team+wmaker@tracker.debian.org>
   wmaker

Debian X Strike Force <debian-x@lists.debian.org>
   twm
   weston

Debian Xfce Maintainers <debian-xfce@lists.debian.org>
   lightdm
   xfce4-session

Debian+Ubuntu MATE Packaging Team <debian-mate@lists.debian.org>
   mate-session-manager

DebianOnMobile Maintainers <debian-on-mobile-maintainers@alioth-lists.debian.net>
   phosh
   plasma-mobile
   sxmo-utils

Desmond O. Chang <dochang@gmail.com>
   stumpwm (U)

Dima Kogan <dkogan@debian.org>
   notion

Dmitry E. Oboukhov <unera@debian.org>
   fluxbox

Dmitry Shachnev <mitya57@debian.org>
   gnome-flashback (U)

Dominik George <natureshadow@debian.org>
   impressive-display (U)

Doug Torrance <dtorrance@piedmont.edu>
   wmaker (U)

Eduard Bloch <blade@debian.org>
   icewm

Emilio Pozuelo Monfort <pochu@debian.org>
   weston (U)

Fabio Fantoni <fantonifabio@tiscali.it>
   cinnamon (U)

Graham Inggs <ginggs@debian.org>
   motif

Gürkan Myczko <gurkan@phys.ethz.ch>
   amiwm

Gürkan Myczko <tar@debian.org>
   amiwm

handsome_feng <jianfengli@ubuntukylin.com>
   ukui-session-manager (U)

Hugo Lefeuvre <hle@debian.org>
   dwm

Héctor Orón Martínez <zumbi@debian.org>
   weston (U)

Iain Lane <laney@debian.org>
   gnome-shell-extensions (U)

Ilias Tsitsimpis <iliastsi@debian.org>
   xmonad (U)

Jaimos Skriletz <jaimosskriletz@gmail.com>
   fvwm
   fvwm3

Jakob Haufe <sur5r@debian.org>
   i3-wm (U)

James McDonald <james@jamesmcdonald.com>
   cwm

Jan Lübbe <jluebbe@debian.org>
   e17 (U)

Jari Aalto <jari.aalto@cante.net>
   lwm

Jeremy Bicha <jbicha@debian.org>
   gnome-shell-extensions (U)

Jeremy Bicha <jbicha@ubuntu.com>
   gnome-flashback (U)
   gnome-shell-extensions (U)

Joachim Breitner <nomeata@debian.org>
   xmonad (U)

Jochen Sprickerhof <jspricke@debian.org>
   sxmo-utils (U)

John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
   mate-session-manager (U)

Jonas Smedegaard <dr@jones.dk>
   sugar (U)

Jose M Calhariz <jose@calhariz.com>
   sawfish

Joshua Peisach <itzswirlz2020@outlook.com>
   cinnamon (U)

Kylin Team <team+kylin@tracker.debian.org>
   ukui-session-manager

Laurent Bigonville <bigon@debian.org>
   gnome-shell-extensions (U)

Louis Bettens <louis@bettens.info>
   xmonad (U)

LXQt Packaging Team <pkg-lxqt-devel@lists.alioth.debian.org>
   lxqt-session

LXQt Packaging Team <team+lxqt@tracker.debian.org>
   lxqt-session

Marcin Owsiany <porridge@debian.org>
   bambam

Marco Mattiolo <marco.mattiolo@hotmail.it>
   plasma-mobile (U)

Marco Trevisan (Treviño) <marco@ubuntu.com>
   gnome-shell-extensions (U)

Margarita Manterola <marga@debian.org>
   cinnamon (U)

Marius Gripsgard <mariogrip@debian.org>
   mir (U)

Marius Gripsgard <marius@ubports.com>
   lomiri-session (U)
   mir (U)

Martin <debacle@debian.org>
   exwm (U)

Mateusz Łukasik <mati75@linuxmint.pl>
   evilwm
   openbox

Mats Erik Andersson <mats.andersson@gisladisker.se>
   w9wm
   windowlab

Matteo Bini <matteobin@tiepi.it>
   dwm

Matteo F. Vescovi <mfv@debian.org>
   remmina (U)

Maximiliano Curia <maxy@debian.org>
   cinnamon (U)

Michael Stapelberg <stapelberg@debian.org>
   i3-wm
   i3-wm (U)

Mike Gabriel <sunweaver@debian.org>
   impressive-display (U)
   lomiri-session (U)
   mate-session-manager (U)
   mir (U)
   surf-display (U)
   weston (U)

Milan Zamazal <pdm@debian.org>
   stumpwm (U)

Moray Allan <moray@debian.org>
   matchbox-common

Nicolas Braud-Santoni <nicoo@debian.org>
   sway (U)

nicoo <nicoo@debian.org>
   sway (U)

Nobuhiro Iwamatsu <iwamatsu@debian.org>
   bspwm
   cairo-dock (U)

Norbert Preining <norbert@preining.info>
   cinnamon (U)
   plasma-workspace (U)

Patrick Franz <deltaone@debian.org>
   plasma-bigscreen (U)
   plasma-workspace (U)

Patrick Franz <patfra71@gmail.com>
   plasma-workspace (U)

Paul Gevers <elbrus@debian.org>
   motif (U)

Paul Tagliamonte <paultag@debian.org>
   fluxbox (U)

Peter Van Eynde <pvaneynd@debian.org>
   stumpwm (U)

Phil Brooke <pjb@debian.org>
   fvwm1

Raphael Mota Ramos <raphaelmota.ti@gmail.com>
   bspwm (U)

Reiner Herrmann <reiner@reiner-h.de>
   awesome

Robert Luberda <robert@debian.org>
   afterstep

Ross Vandegrift <rvandegrift@debian.org>
   e17 (U)

Ryan Kavanagh <rak@debian.org>
   xmonad (U)

Samuel Henrique <samueloph@debian.org>
   jwm

Santiago Ruano Rincón <santiago@debian.org>
   sugar (U)

Scarlett Moore <sgmoore@debian.org>
   plasma-bigscreen (U)

Scarlett Moore <sgmoore@kde.org>
   plasma-workspace (U)

Simon Quigley <tsimonq2@debian.org>
   mir (U)

Stefano Karapetsas <stefano@karapetsas.com>
   mate-session-manager (U)

Sway and related packages team <team+swaywm@tracker.debian.org>
   sway

Tzafrir Cohen <tzafrir@debian.org>
   sxmo-utils (U)

Vangelis Mouhtsis <vangelis@gnugr.org>
   mate-session-manager (U)

Vasyl Gello <vasek.gello@gmail.com>
   kodi (U)

Vincent Bernat <bernat@debian.org>
   fvwm-crystal

Youhei SASAKI <uwabami@gfd-dennou.org>
   cairo-dock (U)

Yves-Alexis Perez <corsac@debian.org>
   lightdm (U)
   xfce4-session (U)


Reply to: