[gnome-software/mwleeds/fix-autostart-desktop-name] Rename gnome-software-service.desktop to the app ID




commit 9676a4fedd170103915ba48a8e8b798c789a8102
Author: Phaedrus Leeds <mwleeds protonmail com>
Date:   Wed Mar 2 11:20:24 2022 -0800

    Rename gnome-software-service.desktop to the app ID
    
    Currently we install three .desktop files:
    - org.gnome.Software.desktop which is the one used for the shell's list
      of applications
    - gnome-software-local-file.desktop which is used for opening local
      files
    - gnome-software-service.desktop which is put in /etc/xdg/autostart/ so
      that "gnome-software --gapplication-service" is run in the background
      at the start of a user session.
    
    This commit renames the autostart one to org.gnome.Software.desktop.
    This change is necessary so that the systemd scope created for
    gnome-software will follow the standard laid out by
    https://systemd.io/DESKTOP_ENVIRONMENTS/ which says that the
    Application ID should be in the unit name. With this change the scope
    goes from e.g. "app-gnome-gnome\x2dsoftware\x2dservice-9502.scope" to
    e.g. "app-gnome-org.gnome.Software-2248.scope". Both before and after
    this commit, the scope and process are the same for the background
    service and for the graphical application when/if it is launched.
    
    Having the scope (cgroup) in the right format is important because I am
    working on getting xdg-desktop-portal to use the cgroup of a process to
    determine its app ID[1], and the app ID is then used for checking
    permissions, including in the dynamic launcher portal which will
    specifically allow the app ID "org.gnome.Software" for one of its
    methods.[2]
    
    An interesting historical note: gnome-software-service.desktop used to
    have "Exec=${libexecdir}/gnome-software-service" before
    "--gapplication-service" came along, so it used to make more sense that
    it was named as such.
    
    I have tested this change; starting gnome-software in the background and
    via gnome-shell work as expected.
    
    [1] https://github.com/flatpak/xdg-desktop-portal/pull/719
    [2] https://github.com/flatpak/xdg-desktop-portal/pull/696

 contrib/gnome-software.spec.in                             |  2 +-
 .../autostart/org.gnome.Software.desktop.in                |  0
 data/meson.build                                           | 14 ++++++++++++++
 src/meson.build                                            |  8 --------
 4 files changed, 15 insertions(+), 9 deletions(-)
---
diff --git a/contrib/gnome-software.spec.in b/contrib/gnome-software.spec.in
index 584d081ea..f79448567 100644
--- a/contrib/gnome-software.spec.in
+++ b/contrib/gnome-software.spec.in
@@ -163,7 +163,7 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop
 %{gs_plugin_dir}/libgs_plugin_provenance.so
 %{gs_plugin_dir}/libgs_plugin_repos.so
 %{gs_plugin_dir}/libgs_plugin_rewrite-resource.so
-%{_sysconfdir}/xdg/autostart/gnome-software-service.desktop
+%{_sysconfdir}/xdg/autostart/org.gnome.Software.desktop
 %{_datadir}/app-info/xmls/org.gnome.Software.Featured.xml
 %{_datadir}/dbus-1/services/org.freedesktop.PackageKit.service
 %{_datadir}/dbus-1/services/org.gnome.Software.service
diff --git a/src/gnome-software-service.desktop.in b/data/autostart/org.gnome.Software.desktop.in
similarity index 100%
rename from src/gnome-software-service.desktop.in
rename to data/autostart/org.gnome.Software.desktop.in
diff --git a/data/meson.build b/data/meson.build
index 1e9e6a29f..7472f393b 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -2,6 +2,20 @@ subdir('appdata')
 subdir('icons')
 subdir('assets')
 
+cdata = configuration_data()
+cdata.set('bindir', join_paths(get_option('prefix'),
+                               get_option('bindir')))
+
+# note: the main .desktop file is in src/
+# this one is for the background service
+# replace @bindir@
+configure_file(
+  input : 'autostart/org.gnome.Software.desktop.in',
+  output : 'org.gnome.Software.desktop',
+  install_dir: join_paths(get_option('sysconfdir'), 'xdg/autostart'),
+  configuration : cdata
+)
+
 compiled_schemas = gnome.compile_schemas(
   depend_files: 'org.gnome.software.gschema.xml')
 install_data('org.gnome.software.gschema.xml',
diff --git a/src/meson.build b/src/meson.build
index bfc8f0c9a..c69b02b18 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -186,14 +186,6 @@ configure_file(
   configuration : cdata
 )
 
-# replace @bindir@
-configure_file(
-  input : 'gnome-software-service.desktop.in',
-  output : 'gnome-software-service.desktop',
-  install_dir: join_paths(get_option('sysconfdir'), 'xdg/autostart'),
-  configuration : cdata
-)
-
 i18n.merge_file(
   input:
     # replace mime-type handlers


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