about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/inputmethods/libinput-gestures
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/tools/inputmethods/libinput-gestures')
-rw-r--r--nixpkgs/pkgs/tools/inputmethods/libinput-gestures/0001-hardcode-name.patch13
-rw-r--r--nixpkgs/pkgs/tools/inputmethods/libinput-gestures/0002-paths.patch34
-rw-r--r--nixpkgs/pkgs/tools/inputmethods/libinput-gestures/default.nix55
3 files changed, 102 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/tools/inputmethods/libinput-gestures/0001-hardcode-name.patch b/nixpkgs/pkgs/tools/inputmethods/libinput-gestures/0001-hardcode-name.patch
new file mode 100644
index 000000000000..f811343ee79b
--- /dev/null
+++ b/nixpkgs/pkgs/tools/inputmethods/libinput-gestures/0001-hardcode-name.patch
@@ -0,0 +1,13 @@
+diff --git a/libinput-gestures b/libinput-gestures
+index 78c7c28..da04007 100755
+--- a/libinput-gestures
++++ b/libinput-gestures
+@@ -27,7 +27,7 @@ except ImportError:
+
+ session_locked = False
+
+-PROGPATH = Path(sys.argv[0])
++PROGPATH = Path("libinput-gestures")
+ PROGNAME = PROGPATH.stem
+
+ # Conf file containing gesture commands.
diff --git a/nixpkgs/pkgs/tools/inputmethods/libinput-gestures/0002-paths.patch b/nixpkgs/pkgs/tools/inputmethods/libinput-gestures/0002-paths.patch
new file mode 100644
index 000000000000..a507625406f2
--- /dev/null
+++ b/nixpkgs/pkgs/tools/inputmethods/libinput-gestures/0002-paths.patch
@@ -0,0 +1,34 @@
+diff --git a/libinput-gestures b/libinput-gestures
+index 78c7c28..1a2c965 100755
+--- a/libinput-gestures
++++ b/libinput-gestures
+@@ -87,11 +87,11 @@ def get_libinput_vers():
+     'Return the libinput installed version number string'
+     # Try to use newer libinput interface then fall back to old
+     # (depreciated) interface.
+-    res = run(('libinput', '--version'), check=False)
++    res = run(('@libinput@', '--version'), check=False)
+     if res:
+         return res.strip(), True
+
+-    res = run(('libinput-list-devices', '--version'), check=False)
++    res = run(('@libinput-list-devices@', '--version'), check=False)
+     return res and res.strip(), False
+
+ def get_devices_list(cmd_list_devices, device_list):
+@@ -694,11 +694,11 @@ def main():
+         sys.exit('libinput helper tools do not seem to be installed?')
+
+     if has_subcmd:
+-        cmd_debug_events = 'libinput debug-events'
+-        cmd_list_devices = 'libinput list-devices'
++        cmd_debug_events = '@libinput@ debug-events'
++        cmd_list_devices = '@libinput@ list-devices'
+     else:
+-        cmd_debug_events = 'libinput-debug-events'
+-        cmd_list_devices = 'libinput-list-devices'
++        cmd_debug_events = '@libinput@-debug-events'
++        cmd_list_devices = '@libinput@-list-devices'
+
+     if args.verbose:
+         # Output various info/version info
diff --git a/nixpkgs/pkgs/tools/inputmethods/libinput-gestures/default.nix b/nixpkgs/pkgs/tools/inputmethods/libinput-gestures/default.nix
new file mode 100644
index 000000000000..b9384469e963
--- /dev/null
+++ b/nixpkgs/pkgs/tools/inputmethods/libinput-gestures/default.nix
@@ -0,0 +1,55 @@
+{ lib, stdenv, fetchFromGitHub, makeWrapper,
+  libinput, wmctrl, python3,
+  coreutils, xdotool ? null,
+  extraUtilsPath ? lib.optional (xdotool != null) xdotool
+}:
+stdenv.mkDerivation rec {
+  pname = "libinput-gestures";
+  version = "2.76";
+
+  src = fetchFromGitHub {
+    owner = "bulletmark";
+    repo = "libinput-gestures";
+    rev = version;
+    sha256 = "sha256-Tb/gQ/2Ul4JzEiLEUPJBj9T6ZAqzMSPdgiofdnDj73Q=";
+  };
+  patches = [
+    ./0001-hardcode-name.patch
+    ./0002-paths.patch
+  ];
+
+  nativeBuildInputs = [ makeWrapper ];
+  buildInputs = [ python3 ];
+
+  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/systemd/user/libinput-gestures.service" --replace "/usr" "$out"
+      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 ([coreutils] ++ extraUtilsPath)}"
+    '';
+
+  meta = with lib; {
+    homepage = "https://github.com/bulletmark/libinput-gestures";
+    description = "Gesture mapper for libinput";
+    license = licenses.gpl3Plus;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ teozkr ];
+  };
+}