On Fri, 18 Feb 2022 at 09:15:24 -0700, Sean Whitton wrote:
> Some time has passed without objections so I would be happy to add these
> two virtual packages.  My only concern is that there are going to be
> quite a few virtual packages in this area, now, and the virtual packages
> list will contain only terse descriptions of each one.  Someone
> packaging a new session/display manager/WM might have a hard time
> figuring out what to use, unless they happen to stumble across the
> discussion in this bug.

I'm slightly regretting opening this can of worms now, but here's my
best attempt at Policy wording.

ยง(Packages providing an X session manager) might be incomplete: it's not
clear to me whether there are any particular requirements for an
x-session-manager (does it have to implement XSMP?) or whether it's as
vague as "anything that is a larger X11 session than an x-window-manager".

    smcv
>From 0ddc90382dda161060459f286f81fe26ecaffc4e Mon Sep 17 00:00:00 2001
From: Simon McVittie <s...@debian.org>
Date: Fri, 18 Feb 2022 20:34:33 +0000
Subject: [PATCH] Describe how to register X11 and Wayland sessions

Closes: #1004522
---
 policy/ch-customized-programs.rst | 136 +++++++++++++++++++++++++++++-
 virtual-package-names-list.yaml   |   6 +-
 2 files changed, 139 insertions(+), 3 deletions(-)

diff --git a/policy/ch-customized-programs.rst b/policy/ch-customized-programs.rst
index bf8dabb..85a5e79 100644
--- a/policy/ch-customized-programs.rst
+++ b/policy/ch-customized-programs.rst
@@ -274,8 +274,8 @@ configuration.
 
 .. _s11.8:
 
-Programs for the X Window System
---------------------------------
+Programs for the X Window System and Wayland
+--------------------------------------------
 
 .. _s11.8.1:
 
@@ -363,6 +363,19 @@ That alternative should have a slave alternative for
 ``/usr/share/man/man1/x-window-manager.1.gz`` pointing to the
 corresponding manual page.
 
+If the window manager acts as a desktop environment in its own right,
+including mechanisms to launch programs, exit the session and so on,
+so that it would be appropriate for it to appear as a desktop environment
+that can be chosen by users in a display manager such as gdm or sddm,
+then it may install a ``.desktop`` file in ``/usr/share/xsessions``
+(see :ref:`s-x-session` for details).
+
+Conversely, if the window manager is intended to be used as part of a
+larger desktop environment session, then it should not install a file into
+``/usr/share/xsessions``, and should not provide ``x-session``.
+Instead, the metapackage or session manager for the larger desktop
+environment session should be responsible for that integration.
+
 .. _s11.8.5:
 
 Packages providing fonts
@@ -502,6 +515,125 @@ name. Other X Window System applications should use the ``/etc/``
 directory unless otherwise mandated by policy (such as for
 :ref:`s-appdefaults`).
 
+.. _s-x-session:
+
+Packages providing an X Window System session
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Packages that provide a user-facing X Window System graphical environment
+should install a ``.desktop`` file into ``/usr/share/xsessions``,
+and declare in their ``Provides`` control field that they provide the
+virtual package ``x-session``.
+
+The package providing ``x-session`` may be either a window manager in
+its own right (for example ``twm``), or a session manager that will
+launch multiple components including a window manager (for example
+``gnome-session``). If it meets the requirements for an
+``x-window-manager`` (see :ref:`s11.8.4`)
+and/or an ``x-session-manager`` (see :ref:`s-x-session-manager`), then
+it should also behave as described in the appropriate sections.
+
+As with Wayland sessions (see :ref:`s-wayland-session`),
+the format of the session files in ``/usr/share/xsessions`` is similar
+to the format defined in the
+`freedesktop.org Desktop Entry Specification
+<https://specifications.freedesktop.org/desktop-entry-spec/latest/>`_,
+although many of the fields normally used for applications
+(see :ref:`s-menus`) are not applicable in session files.
+
+The session file must contain at least the ``Name`` and ``Exec`` fields.
+Login managers are expected to either launch a new X server or reuse
+an existing X server, with no window manager active, and then launch
+the ``Exec`` program with its ``DISPLAY`` environment variable set to
+use that X server.
+
+In addition to the fields from the Desktop Entry Specification, graphical
+environments may provide a ``DesktopNames`` field in the
+``[Desktop Entry]`` group. If present, this field's value is a
+semicolon-separated list of graphical environment names, as used for the
+``OnlyShowIn`` and ``NotShowIn`` fields. As described in the Desktop Entry
+Specification, the login manager should set the ``XDG_CURRENT_DESKTOP``
+environment variable to contain the same names, but as a colon-separated
+list, before launching the ``Exec`` program.
+
+Login managers that provide a menu of possible X sessions should
+read session files from at least ``/usr/local/share/xsessions`` and
+``/usr/share/xsessions`` to populate the menu. They may also read X
+sessions from additional, implementation-specific locations if desired.
+If the login manager also supports Wayland environments, it should list
+both X and Wayland sessions (see :ref:`s-wayland-session`).
+
+Although the files are named ``.desktop``, this mechanism is equally
+applicable to non-desktop-oriented graphical environments such as
+those used on mobile devices.
+
+.. _s-x-session-manager:
+
+Packages providing an X session manager
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Packages that provide a session manager that launches a user-facing X
+Window System graphical environment, but are not an ``x-window-manager``
+(see :ref:`s11.8.4`), should declare in their ``Provides`` control
+field that they provide the virtual package ``x-session-manager``.
+They should also register a program that can be run with no arguments
+as an alternative for ``/usr/bin/x-session-manager``.
+
+That alternative should have a slave alternative for
+``/usr/share/man/man1/x-session-manager.1.gz`` pointing to the
+corresponding manual page.
+
+Session managers should also register themselves as X sessions via a
+``.desktop`` file in ``/usr/share/xsessions`` (see :ref:`s-x-session`).
+
+.. _s-wayland-session:
+
+Packages providing a Wayland session
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Packages that provide a user-facing Wayland graphical environment that
+communicates with real input and display hardware should
+install a ``.desktop`` file into ``/usr/share/wayland-sessions``, and
+declare in their ``Provides`` control field that they provide the virtual
+package ``wayland-session``.
+
+Wayland graphical environments that can only operate as a "nested"
+environment, for example connecting to an X server or another Wayland
+compositor, should not provide ``wayland-session`` or a file in
+``/usr/share/wayland-sessions``.
+
+The package providing ``wayland-session`` may be either a Wayland
+compositor in its own right (for example ``weston``), or a session manager
+that will launch multiple components including a Wayland compositor
+(for example ``gnome-session``).
+
+As with X sessions (see :ref:`s-x-session`), the format of the session
+files in ``/usr/share/wayland-sessions`` is similar to the format defined
+in the `freedesktop.org Desktop Entry Specification
+<https://specifications.freedesktop.org/desktop-entry-spec/latest/>`_,
+although many of the fields normally used for applications
+(see :ref:`s-menus`) are not applicable in session files.
+
+The session file must contain at least the ``Name`` and ``Exec`` fields.
+Login managers are expected to launch the ``Exec`` program in order to
+implement a login to the Wayland session.
+
+In addition to the fields from the Desktop Entry Specification, graphical
+environments may provide a ``DesktopNames`` field in the
+``[Desktop Entry]`` group, with the same behaviour as for
+X sessions (see :ref:`s-x-session`).
+
+Login managers that provide a menu of possible Wayland sessions should
+read session files from at least ``/usr/local/share/wayland-sessions``
+and ``/usr/share/wayland-sessions`` to populate the menu. They may also
+read Wayland sessions from additional, implementation-specific locations
+if desired. If the login manager also supports X environments, it should
+list both X and Wayland sessions (see :ref:`s-x-session`).
+
+Although the files are named ``.desktop``, this mechanism is equally
+applicable to non-desktop-oriented graphical environments such as
+those used on mobile devices.
+
 .. _s-perl:
 
 Perl programs and modules
diff --git a/virtual-package-names-list.yaml b/virtual-package-names-list.yaml
index 5743b73..3d0cfed 100644
--- a/virtual-package-names-list.yaml
+++ b/virtual-package-names-list.yaml
@@ -210,7 +210,7 @@ virtualPackages:
  - name: pop3-server
    description: a POP3 Server
 
-# X Window System
+# X Window System and Wayland
 
  - name: x-display-manager
    description: an X client which manages a collection of X servers
@@ -222,6 +222,10 @@ virtualPackages:
    description: an X client which provides window management services
  - name: xserver
    description: an X server that (directly or indirectly) manages physical input and display hardware
+ - name: x-session
+   description: an X11 desktop session registered via /usr/share/xsessions/*.desktop
+ - name: wayland-session
+   description: a Wayland desktop session registered via /usr/share/wayland-sessions/*.desktop
 
 # Fonts
 
-- 
2.35.1

Reply via email to