The K400 Plus firmware turns two-finger swipes into whole wheel ticks, so every scroll jumps a fixed distance. A trimmed copy of k400-raw's touchpad mode switches the touchpad to raw HID++ reporting and exposes it as a native multitouch touchpad, which GNOME scrolls smoothly.
44 lines
1.2 KiB
Nix
44 lines
1.2 KiB
Nix
{ lib, pkgs, ... }:
|
|
let
|
|
py = pkgs.python3Packages;
|
|
in
|
|
{
|
|
# The K400 Plus firmware turns two-finger swipes into coarse wheel ticks.
|
|
# This switches its touchpad to raw HID++ reporting and exposes it as a
|
|
# native multitouch touchpad, so GNOME scrolls it smoothly.
|
|
systemd.services.k400-touchpad = {
|
|
description = "Logitech K400 Plus raw touchpad bridge";
|
|
wants = [ "systemd-udevd.service" ];
|
|
after = [ "systemd-udevd.service" ];
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
environment = {
|
|
# `toPythonModule` exposes Solaar's `logitech_receiver`. Not a
|
|
# `withPackages` env, since Solaar bundles a conflicting `hid_parser`.
|
|
PYTHONPATH = py.makePythonPath [
|
|
(py.toPythonModule pkgs.solaar)
|
|
py.evdev
|
|
py.pygobject3
|
|
];
|
|
|
|
# `logitech_receiver` imports Gdk at load time
|
|
GI_TYPELIB_PATH = lib.makeSearchPath "lib/girepository-1.0" [
|
|
pkgs.gtk3
|
|
pkgs.pango.out
|
|
pkgs.gdk-pixbuf
|
|
pkgs.harfbuzz
|
|
pkgs.gobject-introspection
|
|
];
|
|
};
|
|
|
|
serviceConfig = {
|
|
ExecStart = "${py.python.interpreter} ${./k400-touchpad.py}";
|
|
Restart = "on-failure";
|
|
RestartSec = 3;
|
|
TimeoutStopSec = 8;
|
|
};
|
|
};
|
|
|
|
boot.kernelModules = [ "uinput" ];
|
|
}
|