Recommendations for multitouch gestures in Hyprland on NixOS?

Hyprland has really limited gestures by default, as outlined in the Hyprland Wiki. So I tried using libinput-gestures, which I had some good experience with recently. I used libinput-gestures on Arcolinux running Hyprland and didn’t have any issues.

For libinput-gestures, it doesn’t seem to work on NixOS and there aren’t any additional configuration options on MyNixOS or nixos.org beyond the package install. So I don’t think I’ve configured it incorrectly or anything. On NixOS, when I run libinput-gestures-setup autostart start I get libinput-gestures-setup: command not found.

There looks like there are several options for gestures on linux, in general, such as:

Here are some of the gestures that I had in my libinput-gestures config that I’d like to either reproduce or continue using in NixOS:

gesture swipe up 3 hyprctl dispatch fullscreen 1
gesture swipe down 3 hyprctl dispatch fullscreen 1
gesture swipe up 4 hyprctl dispatch fullscreen 0
gesture swipe down 4 hyprctl dispatch fullscreen 0
gesture pinch clockwise hyprctl dispatch splitratio 0.1
gesture pinch anticlockwise hyprctl dispatch splitratio -0.1
gesture pinch in 4 hyprctl dispatch killactive
gesture pinch out 4 hyprctl dispatch exec kitty
gesture swipe left_up 2 hyprctl dispatch workspace 1
gesture swipe left_down 2 hyprctl dispatch workspace 2
gesture swipe right_up 2 hyprctl dispatch workspace 3
gesture swipe right_down 2 hyprctl dispatch workspace 4

The clockwise and anticlockwise gestures were particularly cool. Does anyone have any experience with gestures in Hyprland on NixOS that they would recommend?

5 Likes

Yeah, since I wanted to go back to using Hyprland on my laptop this topic is kinda interesting. Hopefully we shall find something out here soon.

1 Like

But I was thinking: is the problem that you can’t run libinput-gestures-setup? Or does libinput-gestures not work at all?

You run libinput-gestures with libinput-gestures-setup followed by either start, stop, and autostart. So to answer your questions - yes :slight_smile:

So if you have a look at the nixpkgs derivation for libinput-gestures here in line 41:

You will see that libinput-gestures-setup gets removed, and hence, is no longer available.

However libinput-gestures should be available.

1 Like

Holy moly, you got it! Looks like you just run it with: libinput-gestures

I’ll have to add that to my hyprland startup script. Thank you!

1 Like

Hello @guttermonk. I am struggling to get libinput-gestures work too. Could you walk me through the steps that you took? Specifically

  • What nix configuration did you have? Just adding the libinput-gestures somewhere?
  • How did you set the configuration file?
  • How do you ensure that libinput-gestures is initiallized somehow at start-up time?

Thanks a lot for all the help, if you find the time to share

1 Like

Add the following to your configuration file:

  services = {
    xserver.windowManager.fvwm2.gestures = true;
    libinput.enable = true;
  };

  environment.systemPackages = with pkgs; [
    libinput
    libinput-gestures
    wmctrl
    xdotool
  ];

Then I just point an “exec-once” in my hyprland config to a startup script that executes: libinput-gestures &

1 Like

Did you run into a problem where you get Authorization required, but no authorization protocol specified?

image

Did you install the four packages I listed above? You need the two dependencies in that list. Looks like you don’t have wmctrl installed.

Do you happen to know how to modify this to work under Wayland?

I ask because I currently have the nvidia 555 beta driver running (TL;DR: it adds explicit sync support so that Wayland becomes somewhat usable on nvidia hardware).
The last obstacle to migration I can see ATM is a Wayland replacement for fusuma / xdotool, so that I can keep using multitouch gestures if/when I switch.

Truthfully, seeing as how it’s not 2004 anymore, DE’s like KDE and Gnome as well as WMs should just offer a native MacOS-like (i.e. easy to use) configuration page for this, including mapping random multitouch gestures to random input events.
But until that happens, such 3rd party tools will remain necessary unfortunately.

I’m using hyprland which runs under wayland, so the instructions above for libinput-gestures should work.

I am currently running Hyprland version 0.36 (a bit old, due to stability) on NIxOS too. What version of Hyprland are you running @guttermonk ?

I have installed the packes as per your suggestion. I am going to try and pass some of these dependencies via buildInputs and see if that helps me!

Unforunately, I am still getting the warning that Warning: must install wmctrl to use _internal command. even when I explicitly pass wmctrl to the libinput-gestures package.

I tried adding the

(libinput-gestures.overrideAttrs (oldAttrs: {
	propagatedBuildInputs = oldAttrs.buildInputs ++ [ wmctrl ];
}))