Fix '%k' macros in .desktop files

Resolves: https://issues.redhat.com/browse/RHEL-72966
This commit is contained in:
Florian Müllner 2025-01-07 19:27:49 +01:00
parent c1a623ff21
commit 8d8fc5f34a
No known key found for this signature in database
2 changed files with 48 additions and 1 deletions

View File

@ -0,0 +1,42 @@
From f65b9f2df5bf913f8c152ea770795d2cdcb14c6a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
Date: Tue, 7 Jan 2025 19:09:01 +0100
Subject: [PATCH] desktop-icons: Fix '%k' in .desktop files
In order to support Link-type .desktop files, we load the file
ourselves, and then create the AppInfo from the loaded keyfile
to avoid reading the file twice.
Unfortunately that means that the AppInfo loses the filename
information, which is necessary to substitute the '%k' macro.
In order to support both the macro and Link-type .desktop files,
we have to take the hit and let GIO read the file again.
---
extensions/desktop-icons/fileItem.js | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/extensions/desktop-icons/fileItem.js b/extensions/desktop-icons/fileItem.js
index 1c9a1e55..c765967b 100644
--- a/extensions/desktop-icons/fileItem.js
+++ b/extensions/desktop-icons/fileItem.js
@@ -241,13 +241,14 @@ var FileItem = class {
if (this._isDesktopFile) {
try {
const keyFile = new GLib.KeyFile();
- keyFile.load_from_file(this._file.get_path(), GLib.KeyFileFlags.NONE);
+ const path = this._file.get_path();
+ keyFile.load_from_file(path, GLib.KeyFileFlags.NONE);
const type = keyFile.get_string(
GLib.KEY_FILE_DESKTOP_GROUP, GLib.KEY_FILE_DESKTOP_KEY_TYPE);
switch (type) {
case GLib.KEY_FILE_DESKTOP_TYPE_APPLICATION:
- this._desktopFile = Gio.DesktopAppInfo.new_from_keyfile(keyFile);
+ this._desktopFile = Gio.DesktopAppInfo.new_from_filename(path);
if (!this._desktopFile) {
log(`Couldnt parse ${this._displayName} as a desktop file, will treat it as a regular file.`);
this._isValidDesktopFile = false;
--
2.47.1

View File

@ -6,7 +6,7 @@
Name: gnome-shell-extensions
Version: 3.32.1
Release: 39%{?dist}
Release: 40%{?dist}
Summary: Modify and extend GNOME Shell functionality and behavior
Group: User Interface/Desktops
@ -59,6 +59,7 @@ Patch0030: 0001-desktop-icons-Don-t-use-blocking-IO.patch
Patch0031: 0001-panel-favorites-Update-to-upstream-version.patch
Patch0032: 0001-desktop-icons-Don-t-try-spawn-with-non-existent-work.patch
Patch0033: 0001-classification-banner-Hide-from-picks.patch
Patch0034: 0001-desktop-icons-Fix-k-in-.desktop-files.patch
%description
GNOME Shell Extensions is a collection of extensions providing additional and
@ -573,6 +574,10 @@ cp $RPM_SOURCE_DIR/gnome-classic.desktop $RPM_BUILD_ROOT%{_datadir}/xsessions
%changelog
* Tue Jan 07 2025 Florian Müllner <fmuellner@redhat.com> - 3.32.1-40
- Fix '%k' macro in .desktop files
Resolves: RHEL-72966
* Tue Apr 23 2024 Florian Müllner <fmuellner@redhat.com> - 3.32.1-39
- Fix tooltip animation times
Resolves: RHEL-33681