From patchwork Wed Sep 6 15:43:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zheng Junjie X-Patchwork-Id: 53598 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 2BFD527BBEA; Wed, 6 Sep 2023 16:45:25 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 3CDDE27BBE9 for ; Wed, 6 Sep 2023 16:45:23 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qduiF-0005ys-P1; Wed, 06 Sep 2023 11:45:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qduiD-0005yY-T6 for guix-patches@gnu.org; Wed, 06 Sep 2023 11:45:01 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qduiD-00024q-Kw for guix-patches@gnu.org; Wed, 06 Sep 2023 11:45:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qduiE-0005Qy-ND for guix-patches@gnu.org; Wed, 06 Sep 2023 11:45:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#65785] [PATCH] gnu: kwin: Unwrap executable name for desktop file search. Resent-From: Zheng Junjie Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 06 Sep 2023 15:45:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 65785 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 65785@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.169401506120816 (code B ref -1); Wed, 06 Sep 2023 15:45:02 +0000 Received: (at submit) by debbugs.gnu.org; 6 Sep 2023 15:44:21 +0000 Received: from localhost ([127.0.0.1]:37173 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qduhY-0005Pf-P4 for submit@debbugs.gnu.org; Wed, 06 Sep 2023 11:44:21 -0400 Received: from lists.gnu.org ([2001:470:142::17]:48108) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qduhW-0005PP-PY for submit@debbugs.gnu.org; Wed, 06 Sep 2023 11:44:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qduhQ-0005mK-Ba for guix-patches@gnu.org; Wed, 06 Sep 2023 11:44:12 -0400 Received: from smtp81.cstnet.cn ([159.226.251.81] helo=cstnet.cn) by eggs.gnu.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1qduhK-0001nD-8A for guix-patches@gnu.org; Wed, 06 Sep 2023 11:44:10 -0400 Received: from localhost.localdomain (unknown [111.0.51.83]) by APP-03 (Coremail) with SMTP id rQCowADn7qI5nvhk8Bw5Cw--.49771S2; Wed, 06 Sep 2023 23:43:55 +0800 (CST) From: Zheng Junjie Date: Wed, 6 Sep 2023 23:43:53 +0800 Message-ID: <836a7a424e74184fcd6ab76f77f6c4b6a45c126f.1694015033.git.zhengjun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IevJa73UjIFyTuYvjxUgg_TUUUUU X-Originating-IP: [111.0.51.83] X-CM-SenderInfo: x2kh0wxmxqyx3h6l2u1dvotugofq/ Received-SPF: pass client-ip=159.226.251.81; envelope-from=zhengjunjie@iscas.ac.cn; helo=cstnet.cn X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches 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 base-commit: 6113e0529d61df7425f64e30a6bf77f7cfdfe5a5 prerequisite-patch-id: 913694f521724b04504a8a442176f68277104422 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 ++ ++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