Subject: [bug#71403] [PATCH v2] gnu: Add libinput-gestures.

From: kiasoc5 <[email-masked]>
Date: Thu, 6 Jun 2024 22:35:54 -0400

Forgot to rebase this forgotten 2-year-old patch!

* gnu/packages/freedesktop.scm (libinput-gestures): New variable.
---
 gnu/packages/freedesktop.scm | 56 ++++++++++++++++++++++++++++++++++++
 1 file changed, 56 insertions(+)

diff --git a/gnu/packages/freedesktop.scm b/gnu/packages/freedesktop.scm
index 6941450436..79dd6d5015 100644
--- a/gnu/packages/freedesktop.scm
+++ b/gnu/packages/freedesktop.scm
@@ -744,6 +744,62 @@ (define-public libinput-minimal
                "-Ddebug-gui=false"    ;requires gtk+@3
                ,flags))))))
 
+(define-public libinput-gestures
+  (package
+    (name "libinput-gestures")
+    (version "2.76")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/bulletmark/libinput-gestures")
+                    (commit version)))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "0x7gwdq7c7rahbfj6cdk19jgmm4g87r51i1229rq55wlzm1y1gsd"))))
+    (build-system gnu-build-system)
+    (arguments
+     (list
+      #:make-flags
+      #~(list (string-append "DESTDIR=" #$output))
+      #:phases
+      #~(modify-phases %standard-phases
+          (delete 'configure) ; no configure
+          (add-before 'install 'fix-hardcoded-paths
+            (lambda _
+              (substitute* "libinput-gestures"
+                (("PROGPATH = Path(sys.argv[0])")
+                 "PROGPATH = Path(\"libinput-gestures\")")
+                (("'libinput'")
+                 (string-append
+                  "'" (search-input-file %build-inputs "/bin/libinput") "'")))))
+          (add-before 'install 'delete-mentions-of-usr
+            (lambda _
+              (substitute* "libinput-gestures-setup"
+                (("/usr") ""))))
+          ;; TODO: replace this phase
+          (add-before 'patch-dot-desktop-files 'patch-desktop-file-manually
+            (lambda _
+              (substitute* "libinput-gestures.desktop"
+                (("/usr/bin/libinput-gestures")
+                  (string-append #$output "/bin/libinput-gestures")))))
+          (add-after 'install 'remove-systemd-service
+            (lambda _
+              (delete-file-recursively (string-append #$output "/lib"))))
+          (delete 'check) ; no tests
+          )))
+    (inputs
+     (list python libinput hicolor-icon-theme))
+    (home-page "https://github.com/bulletmark/libinput-gestures")
+    (synopsis "Actions gestures on your touchpad using libinput")
+    (description
+     "@code{libinput-gestures} is a utility which reads libinput gestures from
+your touchpad and maps them to gestures you configure in a configuration file. 
+Each gesture can be configured to activate a shell command. It can be used for
+X window managers and Wayland compositors that do not support libinput gestures
+natively.")
+    (license license:gpl3+)))
+
 (define-public libxdg-basedir
   (package
     (name "libxdg-basedir")

base-commit: 580d77d0fb12448ef1621699cc0c56e787e2aadb
-- 
2.45.1