summary refs log tree commit diff
path: root/pkgs/tools/inputmethods/libinput-gestures/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/tools/inputmethods/libinput-gestures/default.nix')
-rw-r--r--pkgs/tools/inputmethods/libinput-gestures/default.nix54
1 files changed, 54 insertions, 0 deletions
diff --git a/pkgs/tools/inputmethods/libinput-gestures/default.nix b/pkgs/tools/inputmethods/libinput-gestures/default.nix
new file mode 100644
index 000000000000..e58cabc6791a
--- /dev/null
+++ b/pkgs/tools/inputmethods/libinput-gestures/default.nix
@@ -0,0 +1,54 @@
+{ lib, stdenv, fetchFromGitHub, makeWrapper,
+  libinput, wmctrl,
+  xdotool ? null,
+  extraUtilsPath ? lib.optional (xdotool != null) xdotool
+}:
+stdenv.mkDerivation rec {
+  pname = "libinput-gestures";
+  version = "2.32";
+  name = "${pname}-${version}";
+
+  src = fetchFromGitHub {
+    owner = "bulletmark";
+    repo = "libinput-gestures";
+    rev = version;
+    sha256 = "1by6sabx0s8sd9w5675gc26q7yccxnxxsjg4dqlb6nbs0vcg81s7";
+  };
+  patches = [
+    ./0001-hardcode-name.patch
+    ./0002-paths.patch
+  ];
+
+  nativeBuildInputs = [ makeWrapper ];
+
+  postPatch =
+    ''
+      substituteInPlace libinput-gestures-setup --replace /usr/ /
+
+      substituteInPlace libinput-gestures \
+        --replace      /etc     "$out/etc" \
+        --subst-var-by libinput "${libinput}/bin/libinput" \
+        --subst-var-by wmctrl   "${wmctrl}/bin/wmctrl"
+    '';
+  installPhase =
+    ''
+      runHook preInstall
+      ${stdenv.shell} libinput-gestures-setup -d "$out" install
+      runHook postInstall
+    '';
+  postFixup =
+    ''
+      rm "$out/bin/libinput-gestures-setup"
+      substituteInPlace "$out/share/applications/libinput-gestures.desktop" --replace "/usr" "$out"
+      chmod +x "$out/share/applications/libinput-gestures.desktop"
+      wrapProgram "$out/bin/libinput-gestures" --prefix PATH : "${lib.makeBinPath extraUtilsPath}"
+    '';
+
+  meta = with stdenv.lib; {
+    homepage = https://github.com/bulletmark/libinput-gestures;
+    description = "Gesture mapper for libinput";
+    license = licenses.gpl3Plus;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ teozkr ];
+  };
+}