76 lines
2.5 KiB
Diff
76 lines
2.5 KiB
Diff
|
From: =?utf-8?b?Ik1hcmNvIFRyZXZpc2FuIChUcmV2acOxbyki?= <mail@3v1n0.net>
|
||
|
Date: Mon, 27 Mar 2023 21:02:02 +0200
|
||
|
Subject: shell-global, util: Do not move snap apps to gnome-apps scope
|
||
|
|
||
|
Snap applications already have their own scope so we must not move them.
|
||
|
|
||
|
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/gnome-shell/+bug/2011806
|
||
|
---
|
||
|
js/misc/util.js | 20 ++++++++++++++++++--
|
||
|
src/shell-global.c | 7 +++++++
|
||
|
2 files changed, 25 insertions(+), 2 deletions(-)
|
||
|
|
||
|
diff --git a/js/misc/util.js b/js/misc/util.js
|
||
|
index 0201fd1..22d9a5a 100644
|
||
|
--- a/js/misc/util.js
|
||
|
+++ b/js/misc/util.js
|
||
|
@@ -119,6 +119,20 @@ export function spawnApp(argv) {
|
||
|
*/
|
||
|
export function trySpawn(argv) {
|
||
|
let success_, pid;
|
||
|
+ let path = argv[0];
|
||
|
+
|
||
|
+ if (!path?.includes('/')) {
|
||
|
+ path = GLib.find_program_in_path(argv[0]);
|
||
|
+ if (!path) {
|
||
|
+ throw new GLib.SpawnError({
|
||
|
+ code: GLib.SpawnError.NOENT,
|
||
|
+ message: _('Command not found'),
|
||
|
+ });
|
||
|
+ }
|
||
|
+
|
||
|
+ argv = [path, ...argv.slice(1)];
|
||
|
+ }
|
||
|
+
|
||
|
try {
|
||
|
[success_, pid] = GLib.spawn_async(
|
||
|
null, argv, null,
|
||
|
@@ -150,8 +164,10 @@ export function trySpawn(argv) {
|
||
|
}
|
||
|
}
|
||
|
|
||
|
- // Async call, we don't need the reply though
|
||
|
- GnomeDesktop.start_systemd_scope(argv[0], pid, null, null, null, () => {});
|
||
|
+ if (!path?.includes('/snap/bin') && !argv?.join(' ').includes('snap run')) {
|
||
|
+ // Async call, we don't need the reply though
|
||
|
+ GnomeDesktop.start_systemd_scope(argv[0], pid, null, null, null, () => {});
|
||
|
+ }
|
||
|
|
||
|
// Dummy child watch; we don't want to double-fork internally
|
||
|
// because then we lose the parent-child relationship, which
|
||
|
diff --git a/src/shell-global.c b/src/shell-global.c
|
||
|
index e60b574..a0c3d5c 100644
|
||
|
--- a/src/shell-global.c
|
||
|
+++ b/src/shell-global.c
|
||
|
@@ -1501,6 +1501,7 @@ shell_global_app_launched_cb (GAppLaunchContext *context,
|
||
|
{
|
||
|
gint32 pid;
|
||
|
const gchar *app_name;
|
||
|
+ const gchar *command_line;
|
||
|
|
||
|
if (!g_variant_lookup (platform_data, "pid", "i", &pid))
|
||
|
return;
|
||
|
@@ -1514,6 +1515,12 @@ shell_global_app_launched_cb (GAppLaunchContext *context,
|
||
|
if (app_name == NULL)
|
||
|
app_name = g_app_info_get_executable (info);
|
||
|
|
||
|
+ command_line = g_app_info_get_commandline (info);
|
||
|
+ if (command_line &&
|
||
|
+ (strstr (command_line, "/snap/bin") ||
|
||
|
+ strstr (command_line, "snap run")))
|
||
|
+ return;
|
||
|
+
|
||
|
/* Start async request; we don't care about the result */
|
||
|
gnome_start_systemd_scope (app_name,
|
||
|
pid,
|