From 0b4cb56ba096655ab080174f747b782cab29df29 Mon Sep 17 00:00:00 2001 From: Sergio Costas Rodriguez Date: Tue, 9 Jul 2024 16:59:08 +0200 Subject: [PATCH 1/2] Add launcher for "updates" This patch adds an extra, invisible, .desktop file that opens the store in the "updates" page directly. This is needed because in the new Refresh App Awareness, we want to allow the user to open the snap-center in the "updates" page directly from a "pending update" notification, but since it is `snapd-desktop-integration` the application that opens it, and it is inside another snap, the only way that it has to launch the `snap-center` is using the `desktop-launch` DBus interface. This interface, unfortunately, doesn't allow to pass parameters, only allows to pass the name of a `.desktop` file to launch, so this workaround is needed. --- packages/app_center/assets/app-center-updates.desktop | 10 ++++++++++ snap/snapcraft.yaml | 11 +++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 packages/app_center/assets/app-center-updates.desktop diff --git a/packages/app_center/assets/app-center-updates.desktop b/packages/app_center/assets/app-center-updates.desktop new file mode 100644 index 000000000..63dcdb424 --- /dev/null +++ b/packages/app_center/assets/app-center-updates.desktop @@ -0,0 +1,10 @@ +[Desktop Entry] +Type=Application +Version=1.0 +Exec=snap-store --updates %U +Icon=bin/data/flutter_assets/assets/app-center.png +Terminal=false +Categories=System;Utility;PackageManager;SoftwareManagement;Network;Settings; +Keywords=Ubuntu;Applications;Apps;Store;Software;Snaps; +Name=App Center Updates +NoDisplay=true diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 592b12016..35dc2abf4 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -60,13 +60,13 @@ parts: apps: snap-store: command: bin/snap-store - environment: + environment: &store_env RATINGS_SERVICE_URL: 'ratings.ubuntu.com' RATINGS_SERVICE_PORT: '443' RATINGS_SERVICE_USE_TLS: 'true' desktop: bin/data/flutter_assets/assets/app-center.desktop extensions: [gnome] - plugs: + plugs: &store_plugs - appstream-metadata - desktop - desktop-launch @@ -74,6 +74,13 @@ apps: - snapd-control - packagekit-control + show-updates: + command: bin/snap-store --updates + desktop: bin/data/flutter_assets/assets/app-center-updates.desktop + environment: *store_env + extensions: [gnome] + plugs: *store_plugs + slots: packagekit-svc: interface: dbus From 95758aa3deafb414979ea0423fe5d4dbe09d9314 Mon Sep 17 00:00:00 2001 From: Sergio Costas Rodriguez Date: Tue, 9 Jul 2024 17:20:34 +0200 Subject: [PATCH 2/2] Added note about why the .desktop and the entry are required --- packages/app_center/assets/app-center-updates.desktop | 3 +++ snap/snapcraft.yaml | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/packages/app_center/assets/app-center-updates.desktop b/packages/app_center/assets/app-center-updates.desktop index 63dcdb424..583dc9c1d 100644 --- a/packages/app_center/assets/app-center-updates.desktop +++ b/packages/app_center/assets/app-center-updates.desktop @@ -1,4 +1,7 @@ [Desktop Entry] +# This desktop entry is required to allow Snapd Desktop Integration +# to open the Snap Center in the "updates" page when the user +# clicks "Show updates" in a notification. DO NOT DELETE. Type=Application Version=1.0 Exec=snap-store --updates %U diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 35dc2abf4..38314f5db 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -74,6 +74,10 @@ apps: - snapd-control - packagekit-control +# This entry, along with the corresponding .desktop file, is required +# to allow Snapd Desktop Integration to open the Snap Center in the +# "updates" page when the user clicks "Show updates" in a notification. +# DO NOT DELETE. show-updates: command: bin/snap-store --updates desktop: bin/data/flutter_assets/assets/app-center-updates.desktop