1{ lib, stdenv, fetchFromGitHub, makeWrapper,
2 libinput, wmctrl, python3,
3 xdotool ? null,
4 extraUtilsPath ? lib.optional (xdotool != null) xdotool
5}:
6stdenv.mkDerivation rec {
7 pname = "libinput-gestures";
8 version = "2.39";
9 name = "${pname}-${version}";
10
11 src = fetchFromGitHub {
12 owner = "bulletmark";
13 repo = "libinput-gestures";
14 rev = version;
15 sha256 = "0bzyi55yhr9wyar9mnd09cr6pi88jkkp0f9lndm0a9jwi1xr4bdf";
16 };
17 patches = [
18 ./0001-hardcode-name.patch
19 ./0002-paths.patch
20 ];
21
22 nativeBuildInputs = [ makeWrapper ];
23 buildInputs = [ python3 ];
24
25 postPatch =
26 ''
27 substituteInPlace libinput-gestures-setup --replace /usr/ /
28
29 substituteInPlace libinput-gestures \
30 --replace /etc "$out/etc" \
31 --subst-var-by libinput "${libinput}/bin/libinput" \
32 --subst-var-by wmctrl "${wmctrl}/bin/wmctrl"
33 '';
34 installPhase =
35 ''
36 runHook preInstall
37 ${stdenv.shell} libinput-gestures-setup -d "$out" install
38 runHook postInstall
39 '';
40 postFixup =
41 ''
42 rm "$out/bin/libinput-gestures-setup"
43 substituteInPlace "$out/share/applications/libinput-gestures.desktop" --replace "/usr" "$out"
44 chmod +x "$out/share/applications/libinput-gestures.desktop"
45 wrapProgram "$out/bin/libinput-gestures" --prefix PATH : "${lib.makeBinPath extraUtilsPath}"
46 '';
47
48 meta = with stdenv.lib; {
49 homepage = https://github.com/bulletmark/libinput-gestures;
50 description = "Gesture mapper for libinput";
51 license = licenses.gpl3Plus;
52 platforms = platforms.linux;
53 maintainers = with maintainers; [ teozkr ];
54 };
55}