GNU bug report logs - #65785
[PATCH] gnu: kwin: Unwrap executable name for desktop file search.

Previous Next

Package: guix-patches;

Reported by: Zheng Junjie <zhengjunjie <at> iscas.ac.cn>

Date: Wed, 6 Sep 2023 15:45:02 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 65785 in the body.
You can then email your comments to 65785 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#65785; Package guix-patches. (Wed, 06 Sep 2023 15:45:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Zheng Junjie <zhengjunjie <at> iscas.ac.cn>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Wed, 06 Sep 2023 15:45:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Zheng Junjie <zhengjunjie <at> iscas.ac.cn>
To: guix-patches <at> gnu.org
Subject: [PATCH] gnu: kwin: Unwrap executable name for desktop file search.
Date: Wed,  6 Sep 2023 23:43:53 +0800
see https://github.com/NixOS/nixpkgs/pull/116549

* gnu/packages/patches/kwin-unwrap-executable-name-for-dot-desktop-search.patch:
New file.
* gnu/local.mk (dist_patch_DATA): Add it.
* gnu/packages/kde-plasma.scm (kwin)[origin]: Use it.
---
 gnu/local.mk                                  |  1 +
 gnu/packages/kde-plasma.scm                   |  1 +
 ...ecutable-name-for-dot-desktop-search.patch | 89 +++++++++++++++++++
 3 files changed, 91 insertions(+)
 create mode 100644 gnu/packages/patches/kwin-unwrap-executable-name-for-dot-desktop-search.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 6ccd27cba5..f8af4366ef 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1475,6 +1475,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/kobodeluxe-midicon-segmentation-fault.patch	\
   %D%/packages/patches/kobodeluxe-graphics-window-signed-char.patch	\
   %D%/packages/patches/kodi-set-libcurl-ssl-parameters.patch		\
+  %D%/packages/patches/kwin-unwrap-executable-name-for-dot-desktop-search.patch\
   %D%/packages/patches/kodi-mesa-eglchromium.patch		\
   %D%/packages/patches/laby-make-install.patch			\
   %D%/packages/patches/laby-use-tmpdir-from-runtime.patch	\
diff --git a/gnu/packages/kde-plasma.scm b/gnu/packages/kde-plasma.scm
index 11586a6ce2..331ab28cd1 100644
--- a/gnu/packages/kde-plasma.scm
+++ b/gnu/packages/kde-plasma.scm
@@ -1210,6 +1210,7 @@ (define-public kwin
               (method url-fetch)
               (uri (string-append "mirror://kde/stable/plasma/" version "/"
                                   name "-" version ".tar.xz"))
+              (patches (search-patches "kwin-unwrap-executable-name-for-dot-desktop-search.patch"))
               (sha256
                (base32
                 "0bssp76lzqqlan5pfg6wjf4z9c6pl6p66ri8p82vqqw406x5bzyb"))))
diff --git a/gnu/packages/patches/kwin-unwrap-executable-name-for-dot-desktop-search.patch b/gnu/packages/patches/kwin-unwrap-executable-name-for-dot-desktop-search.patch
new file mode 100644
index 0000000000..8f67553138
--- /dev/null
+++ b/gnu/packages/patches/kwin-unwrap-executable-name-for-dot-desktop-search.patch
@@ -0,0 +1,89 @@
+origin patch from nixos.
+
+see https://github.com/NixOS/nixpkgs/blob/2457551a54ffbd93b7d8f84af8b8fb3aac5cbdd5/pkgs/desktops/plasma-5/kwin/0001-NixOS-Unwrap-executable-name-for-.desktop-search.patch
+
+---
+ src/guix_utils.h     | 41 +++++++++++++++++++++++++++++++++++++++++
+ src/service_utils.h   |  4 +++-
+ src/waylandwindow.cpp |  5 ++++-
+ 3 files changed, 48 insertions(+), 2 deletions(-)
+ create mode 100644 src/guix_utils.h
+
+diff a/src/guix_utils.h b/src/guix_utils.h
+new file mode 100644
+index 0000000..726065d
+--- /dev/null
++++ b/src/guix_utils.h
+@@ -0,0 +1,24 @@
++#ifndef GUIX_UTILS_H
++#define GUIX_UTILS_H
++
++// kwin
++#include <kwinglobals.h>
++
++namespace KWin
++{
++
++static QString unwrapExecutablePath(const QString &in_executablePath)
++{
++    QString executablePath(in_executablePath);
++
++    while (executablePath.endsWith("-real") && executablePath[executablePath.lastIndexOf("/")+1] == QChar('.')) {
++        executablePath.remove(executablePath.length() - 5, 5);
++        executablePath.remove(executablePath.lastIndexOf("/")+1, 1);
++    }
++
++    return executablePath;
++}
++
++}// namespace
++
++#endif // GUIX_UTILS_H
+diff a/src/utils/serviceutils.h b/src/utils/serviceutils.h
+index 8a70c1f..475b15d 100644
+--- a/src/utils/serviceutils.h
++++ b/src/utils/serviceutils.h
+@@ -19,6 +19,7 @@
+ #include <QLoggingCategory>
+ //KF
+ #include <KApplicationTrader>
++#include "guix_utils.h"
+ 
+ namespace KWin
+ {
+@@ -26,8 +27,9 @@ namespace KWin
+ const static QString s_waylandInterfaceName = QStringLiteral("X-KDE-Wayland-Interfaces");
+ const static QString s_dbusRestrictedInterfaceName = QStringLiteral("X-KDE-DBUS-Restricted-Interfaces");
+ 
+-static QStringList fetchProcessServiceField(const QString &executablePath, const QString &fieldName)
++static QStringList fetchProcessServiceField(const QString &in_executablePath, const QString &fieldName)
+ {
++    const QString executablePath = unwrapExecutablePath(in_executablePath);
+     // needed to be able to use the logging category in a header static function
+     static QLoggingCategory KWIN_UTILS ("KWIN_UTILS", QtWarningMsg);
+     const auto servicesFound = KApplicationTrader::query([&executablePath] (const KService::Ptr &service) {
+diff a/src/waylandwindow.cpp b/src/waylandwindow.cpp
+index fd2c0c1..ae8cf96 100644
+--- a/src/waylandwindow.cpp
++++ b/src/waylandwindow.cpp
+@@ -10,6 +10,7 @@
+ #include "screens.h"
+ #include "wayland_server.h"
+ #include "workspace.h"
++#include "guix_utils.h"
+ 
+ #include <KWaylandServer/display.h>
+ #include <KWaylandServer/clientbuffer.h>
+@@ -173,7 +174,9 @@ void WaylandWindow::updateIcon()
+ 
+ void WaylandWindow::updateResourceName()
+ {
+-    const QFileInfo fileInfo(surface()->client()->executablePath());
++    const QString in_path = surface()->client()->executablePath();
++    const QString path = unwrapExecutablePath(in_path);
++    const QFileInfo fileInfo(path);
+     if (fileInfo.exists()) {
+         const QByteArray executableFileName = fileInfo.fileName().toUtf8();
+         setResourceClass(executableFileName, executableFileName);
+-- 
+2.32.0
\ No newline at end of file

base-commit: 6113e0529d61df7425f64e30a6bf77f7cfdfe5a5
prerequisite-patch-id: 913694f521724b04504a8a442176f68277104422
-- 
2.41.0





Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Thu, 14 Sep 2023 21:32:01 GMT) Full text and rfc822 format available.

Notification sent to Zheng Junjie <zhengjunjie <at> iscas.ac.cn>:
bug acknowledged by developer. (Thu, 14 Sep 2023 21:32:01 GMT) Full text and rfc822 format available.

Message #10 received at 65785-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Zheng Junjie <zhengjunjie <at> iscas.ac.cn>
Cc: 65785-done <at> debbugs.gnu.org
Subject: Re: bug#65785: [PATCH] gnu: kwin: Unwrap executable name for
 desktop file search.
Date: Thu, 14 Sep 2023 23:31:29 +0200
Zheng Junjie <zhengjunjie <at> iscas.ac.cn> skribis:

> see https://github.com/NixOS/nixpkgs/pull/116549
>
> * gnu/packages/patches/kwin-unwrap-executable-name-for-dot-desktop-search.patch:
> New file.
> * gnu/local.mk (dist_patch_DATA): Add it.
> * gnu/packages/kde-plasma.scm (kwin)[origin]: Use it.

Applied, thanks!




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 13 Oct 2023 11:24:16 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 210 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.