Fix spawning terminal without desktop directory

Resolves: RHEL-15366
This commit is contained in:
Florian Müllner 2023-11-02 21:48:40 +01:00
parent b26a0636bc
commit 91e7e27db1
2 changed files with 39 additions and 1 deletions

View File

@ -0,0 +1,33 @@
From b48dae39341a3ba24eb3d142f99eb37d6b14ab41 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
Date: Thu, 2 Nov 2023 20:51:45 +0100
Subject: [PATCH] desktop-icons: Don't try spawn with non-existent workdir
g_spawn_async() will fail if the specified workdir doesn't exist.
That means that opening a terminal from the context menu will fail
when the desktop directory doesn't exist.
The extension doesn't really make sense in that case, but when we
show an "Open in Terminal" menu item even then, users expect it
to work.
---
extensions/desktop-icons/desktopIconsUtil.js | 3 +++
1 file changed, 3 insertions(+)
diff --git a/extensions/desktop-icons/desktopIconsUtil.js b/extensions/desktop-icons/desktopIconsUtil.js
index 57bedc13..c3fe5977 100644
--- a/extensions/desktop-icons/desktopIconsUtil.js
+++ b/extensions/desktop-icons/desktopIconsUtil.js
@@ -50,6 +50,9 @@ function launchTerminal(workdir) {
* https://gitlab.gnome.org/GNOME/gnome-shell/blob/gnome-3-30/js/misc/util.js
*/
+ if (!GLib.file_test(workdir, GLib.FileTest.EXISTS))
+ workdir = null;
+
var success, pid;
try {
[success, pid] = GLib.spawn_async(workdir, argv, null,
--
2.41.0

View File

@ -7,7 +7,7 @@
Name: gnome-shell-extensions
Version: 40.7
Release: 8%{?dist}
Release: 9%{?dist}
Summary: Modify and extend GNOME Shell functionality and behavior
License: GPLv2+
@ -40,6 +40,7 @@ Patch017: 0001-desktopManager-Hook-into-LayoutManager-to-create-gri.patch
Patch018: 0001-gesture-inhibitor-Allow-inhibiting-workspace-switch-.patch
Patch019: 0001-desktop-icons-Don-t-use-blocking-IO.patch
Patch020: 0001-window-list-Explicitly-dispose-settings-on-destroy.patch
Patch021: 0001-desktop-icons-Don-t-try-spawn-with-non-existent-work.patch
%description
GNOME Shell Extensions is a collection of extensions providing additional and
@ -428,6 +429,10 @@ workspaces.
%changelog
* Thu Nov 02 2023 Florian Müllner <fmuellner@redhat.com> - 40.7-9
- Fix spawning terminal without desktop directory
Resolves: RHEL-15366
* Thu Aug 17 2023 Florian Müllner <fmuellner@redhat.com> - 40.7-8
- Rebuild for custom context menu
Resolves: #2232332