`libinput-gestures` multitouch gestures for Hyprland on NixOS

This post is very similar to Recommendations for multitouch gestures in Hyprland on NixOS. The solution there did not work for me, so I decided to open up a separate thread to not pollute the other one. I will happily move this discussion to that other thread instead if this practice is not approved by the moderators of this forum.

Issue

I would like to have libinput-gestures working on my machine so that I can map movements on the touchpad to arbitrary functions. I get as far as having libinput-gestures recognize the motions I am doing, but I can’t get it to issue out any commands.

Setup

OS: NixOS
Window manager: Hyprland (0.41)
libinput-gestures configuration:

{ pkgs, ... }:

{
  services = {
    libinput.enable = true;
  };

  environment.etc."libinput-gestures.conf" = {
    text = ''
    gesture swipe up 4 kitty
    '';
    mode = "444";
  };

  # Not working!
  environment.systemPackages = with pkgs; [
    libinput
    # still does not work!
    libinput-gestures
    wmctrl
    ydotool
    xdotool
  ];
}

This allows me to run libinput-gestures which does detect the correct gestures, but I can’t get it to map the gestures to any command that actually runs

❯ sudo libinput-gestures -v
libinput-gestures: session unknown+unknown on Linux-6.6.33-x86_64-with-glibc2.39, python 3.11.9, libinput 1.25.0
Hash: d41d8cd98f00b204e9800998ecf8427e
Warning: must install wmctrl to use _internal command.
Gestures configured in /nix/store/6nsr3xgy07mvfcgx3kp7rvm3mm1d2zmj-libinput-gestures-2.76/etc/libinput-gestures.conf:
swipe up           _internal ws_up
swipe down         _internal ws_down
swipe left         xdotool key alt+Right
swipe right        xdotool key alt+Left
pinch in           xdotool key super+s
pinch out          xdotool key super+s
libinput-gestures: device /dev/input/by-path/platform-AMDI0010:03-event-mouse(event17): SYNA32D3:00 06CB:CED1 Touchpad
libinput-gestures: SWIPE up 3 [47.129999999999995, -313.70000000000005]
   _internal ws_up
Authorization required, but no authorization protocol specified

Cannot open display.

My questions are:

  • I have installed wmctrl, how can I ensure that libinput-gestures can recognize it
  • What is this Authorization required, but no authorization protocol specified
  • Why is it complaining about not being able to open a display?

Any leads would be more than welcome, as I am currently very stuck with this!