Subject: [PATCH v3 5/7] gnu: Add plasma-applet-window-buttons.

From: Sughosha <[email-masked]>
Date: Sat, 4 Nov 2023 01:36:59 +0100

* gnu/packages/kde-xyz.scm (plasma-applet-window-buttons): New variable.

Change-Id: I4c84e71e10fd8294ab1c81248ddf86909e714286
---
 gnu/local.mk                                  |  1 +
 gnu/packages/kde-xyz.scm                      | 39 ++++++++++++++
 ...sion-window-buttons-applet-fix-build.patch | 52 +++++++++++++++++++
 3 files changed, 92 insertions(+)
 create mode 100644 gnu/packages/patches/plasma-shell-extension-window-buttons-applet-fix-build.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 03e8c28d45..41e3b71346 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1747,6 +1747,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/petri-foo-0.1.87-fix-recent-file-not-exist.patch			\
   %D%/packages/patches/php-fix-streams-copy-length.patch	\
   %D%/packages/patches/plasma-framework-fix-KF5PlasmaMacros.cmake.patch \
+  %D%/packages/patches/plasma-shell-extension-window-buttons-applet-fix-build.patch	\
   %D%/packages/patches/pocketfft-cpp-prefer-preprocessor-if.patch			\
   %D%/packages/patches/pokerth-boost.patch			\
   %D%/packages/patches/ppsspp-disable-upgrade-and-gold.patch		\
diff --git a/gnu/packages/kde-xyz.scm b/gnu/packages/kde-xyz.scm
index c24c50f60a..da9d477fd1 100644
--- a/gnu/packages/kde-xyz.scm
+++ b/gnu/packages/kde-xyz.scm
@@ -23,6 +23,7 @@ (define-module (gnu packages kde-xyz)
   #:use-module (guix git-download)
   #:use-module (guix packages)
   #:use-module ((guix licenses) #:prefix license:)
+  #:use-module (gnu packages)
   #:use-module (gnu packages gnome-xyz)
   #:use-module (gnu packages kde-frameworks)
   #:use-module (gnu packages kde-plasma)
@@ -158,3 +159,41 @@ (define-public plasma-applet-window-appmenu
        "This plasmoid shows the current window appmenu in Plasma panels or
 Latte Dock.")
       (license license:gpl2+))))
+
+(define-public plasma-applet-window-buttons
+  (package
+    (name "plasma-applet-window-buttons")
+    (version "0.11.1")
+    (source
+     (origin
+       (method git-fetch)
+       (uri
+        (git-reference
+          (url "https://github.com/psifidotos/applet-window-buttons")
+          (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "1wbiw5gz6fp8rf2f8sd3ibgkx9abvi0d3s0xz6m3p6n4cvdky323"))
+       (patches
+        (search-patches
+         "plasma-shell-extension-window-buttons-applet-fix-build.patch"))))
+    (build-system qt-build-system)
+    (native-inputs
+     (list extra-cmake-modules))
+    (inputs
+     (list kcmutils
+           kconfigwidgets
+           kcoreaddons
+           kdeclarative
+           ki18n
+           kservice
+           kwindowsystem
+           plasma-framework
+           qtdeclarative-5))
+    (propagated-inputs
+     (list kdecoration))
+    (home-page "https://github.com/psifidotos/applet-window-buttons")
+    (synopsis "Window buttons in Plasma panels")
+    (description
+     "This plasmoid shows window buttons in Plasma panels or Latte Dock.")
+    (license license:gpl2+)))
diff --git a/gnu/packages/patches/plasma-shell-extension-window-buttons-applet-fix-build.patch b/gnu/packages/patches/plasma-shell-extension-window-buttons-applet-fix-build.patch
new file mode 100644
index 0000000000..afbb62eb30
--- /dev/null
+++ b/gnu/packages/patches/plasma-shell-extension-window-buttons-applet-fix-build.patch
@@ -0,0 +1,52 @@
+From 924994e10402921bf22fefc099bca2914989081c Mon Sep 17 00:00:00 2001
+From: Dmitry Chermnykh <[email-masked]>
+Date: Mon, 23 Jan 2023 21:21:47 +0500
+Subject: [PATCH] Support building on plasma 5.26.90+
+
+---
+ CMakeLists.txt                        | 2 +-
+ libappletdecoration/previewclient.cpp | 5 +++++
+ libappletdecoration/previewclient.h   | 1 +
+ 3 files changed, 7 insertions(+), 1 deletion(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 5ecec88..43adaef 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -8,7 +8,7 @@ set(EMAIL "[email-masked]")
+ 
+ set(QT_MIN_VERSION "5.15.0")
+ set(KF5_MIN_VERSION "5.81.0")
+-set(KDECORATION2_MIN_VERSION "5.24.0")
++set(KDECORATION2_MIN_VERSION "5.26.90")
+ 
+ set(KF5_LOCALE_PREFIX "")
+ 
+diff --git a/libappletdecoration/previewclient.cpp b/libappletdecoration/previewclient.cpp
+index 2cf184b..3ffe358 100644
+--- a/libappletdecoration/previewclient.cpp
++++ b/libappletdecoration/previewclient.cpp
+@@ -263,6 +263,11 @@ WId PreviewClient::windowId() const
+     return 0;
+ }
+ 
++QString PreviewClient::windowClass() const
++{
++    return QString("kwin_preview");
++}
++
+ QPalette PreviewClient::palette() const
+ {
+     return m_palette->palette();
+diff --git a/libappletdecoration/previewclient.h b/libappletdecoration/previewclient.h
+index c479acc..e5fbe7a 100644
+--- a/libappletdecoration/previewclient.h
++++ b/libappletdecoration/previewclient.h
+@@ -74,6 +74,7 @@ class PreviewClient : public QObject, public KDecoration2::ApplicationMenuEnable
+     QString caption() const override;
+     WId decorationId() const override;
+     WId windowId() const override;
++    QString windowClass() const override;
+     int desktop() const override;
+     QIcon icon() const override;
+     bool isActive() const override;
-- 
2.41.0