From a5d207f0db20933501712c037703cb7cb27adbbc Mon Sep 17 00:00:00 2001 From: Zheng Junjie Date: Wed, 6 Sep 2023 23:43:53 +0800 Subject: gnu: kwin: Unwrap executable name for desktop file search. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. Signed-off-by: Ludovic Courtès --- gnu/local.mk | 1 + gnu/packages/kde-plasma.scm | 1 + ...ap-executable-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 0d6e6846ee..a94fce9248 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1479,6 +1479,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 @@ KDE Frameworks components.") (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 ++ ++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 + //KF + #include ++#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 + #include +@@ -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 -- cgit v1.2.3 mmit/gnu-system.am?id=a55e2b221c121503045fd8e8fcecc4a8c1f47a29'>gnu: curl: Update to 7.41.0. Support CURLOPT_CAPATH on GnuTLS....Tomáš Čech 2015-04-09gnu: python-2: Restore python-libffi-mips-n32-fix.patch....Mark H Weaver 2015-04-10python: Update to 3.4.3...Cyril Roelandt 2015-04-09Merge branch 'master' into core-updatesLudovic Courtès 2015-04-09gnu: gcc: Do not pass -dynamic-linker to linker when !shared on arm....Mark H Weaver 2015-04-08gnu: Add geoclue....Andy Wingo 2015-04-08gnu: Add colord service....Andy Wingo 2015-04-08gnu: inetutils: Apply syslogd patch....Ludovic Courtès 2015-04-08Merge branch 'master' into core-updates宋文武 2015-04-07gnu: Change ld-wrapper extension from .scm to .in....Ludovic Courtès 2015-04-06gnu: icecat: Update to 31.6.0-gnu1....Mark H Weaver 2015-04-05gnu: linux-libre: Fix drm_wait_one_vblank warnings....Mark H Weaver 2015-04-05gnu: ghostscript: Add $libdir to the RUNPATH of executables....Ludovic Courtès 2015-04-05gnu: openssl: Set appropriate RUNPATH on shared libraries....Ludovic Courtès 2015-04-04gnu: Perl GD: Add stub patch....Mark H Weaver 2015-04-04gnu: source-highlight: Remove obsolete patch....Mark H Weaver 2015-04-03gnu: Remove deleted patch file from build system....David Thompson 2015-04-03gnu: xorg: Add patch to fix sis driver crashes....Alex Kost 2015-04-02gnu: Add fcitx....宋文武 2015-04-02gnu: icecat: Apply fixes for CVE-2015-{0801,0807,0815,0816}....Mark H Weaver 2015-04-01gnu: linux-libre: Update to 3.19.3....Mark H Weaver 2015-04-01gnu: pulseaudio: Increase timeout on cpu-mix-test....Mark H Weaver 2015-03-30gnu: Add audacity....Taylan Ulrich Bayırlı/Kammer 2015-03-30gnu: portaudio: Patch for Audacity compatibility....Taylan Ulrich Bayırlı/Kammer 2015-03-27gnu: Rename (gnu packages ocrad) to (gnu packages ocr)....Taylan Ulrich Bayırlı/Kammer 2015-03-26services: Add 'lirc-service'....Alex Kost 2015-03-26gnu: Add LIRC....Alex Kost 2015-03-26gnu: Add IBus....Ricardo Wurmus 2015-03-25gnu: icecat: Apply fixes for CVE-2015-{0817,0818} and other selected bugs....Mark H Weaver 2015-03-24gnu: calibre: Add a patch to avoid automatic checking for updates....Andreas Enge 2015-03-23gnu: Add Julia....Ricardo Wurmus 2015-03-22gnu: Add mplayer2....Taylan Ulrich Bayırlı/Kammer 2015-03-18gnu: Add agg....Tomáš Čech 2015-03-17gnu: Add Lingua-EN-Words2Nums....Eric Bavier 2015-03-17gnu: Add key-mon....Ludovic Courtès 2015-03-15gnu: pavucontrol: Work around segmentation fault....Ludovic Courtès 2015-03-15gnu: Add Lilypond....Ricardo Wurmus 2015-03-15pulseaudio: Update to 6.0; add dependency on eudev....Ludovic Courtès 2015-03-14gnu: Rename module dnsmasq to dns....Tomáš Čech