This commit is contained in:
ari committed 2026-08-05 15:59:22 -04:00
1 parent df2540c6b7
commit d48198e199
8 files changed
+92 -41

No files matched your search

+17 -7
View File
@@ -1,14 +1,24 @@
// Auto-generated by DMS - do not edit manually
output "DP-9" {
mode "1920x1080@74.973"
scale 1
position x=0 y=0
}
output "eDP-1" {
mode "2880x1920@120.000"
scale 1.5
position x=0 y=0
hot-corners {
top-right
bottom-left
bottom-right
top-left
scale 2
position x=1184 y=1080
focus-at-startup
layout {
always-center-single-column
}
}
output "DP-10" {
mode "1920x1080@74.973"
scale 1
position x=1920 y=0
}
+1 -4
View File
@@ -59,10 +59,7 @@ gestures {
}
hot-corners {
top-left
top-right
bottom-left
bottom-right
off
}
}
+2
View File
@@ -151,6 +151,8 @@
python3Packages.pydantic-settings
python3Packages.pytest
libinput
wlrctl
ydotool
];
shellHook = ''
export PATH=$PATH:$(pwd)/bin
+7 -7
View File
@@ -43,6 +43,13 @@ in
enable = true;
niri = {
enable = true;
# Touchscreen taps/swipes -> niri actions. touchOutput must be given
# explicitly because three outputs are enabled; it matches the
# `touch { map-to-output }` block in configs/niri/shared/general.kdl.
touchscreen-gestures = {
enable = true;
touchOutput = "eDP-1";
};
};
};
};
@@ -114,9 +121,6 @@ in
};
};
};
nixpkgs.config.permittedInsecurePackages = [
"python3.12-ecdsa-0.19.1"
];
# Packages
environment.systemPackages =
let
@@ -243,12 +247,8 @@ in
# claude-desktop.packages.x86_64-linux.default
claude-code
# My Own
niri-touchscreen-gestures
]);
services.usbmuxd.enable = true;
services.flatpak.packages = [
"com.cassidyjames.butler"
+26 -4
View File
@@ -45,10 +45,32 @@ skyg.nixos.desktop.tiler.background.enable
When `skyg.nixos.desktop.tiler.niri.touchscreen-gestures.enable = true`:
- Installs `niri-touchscreen-gestures` package
- Starts a user systemd service (`niri-touchscreen-gestures.service`)
- Installs the `niri-touchscreen-gestures` and `dotool` packages
- Starts two user services: `niri-touchscreen-gestures.service` and `dotoold.service`
- Enables `hardware.uinput` and adds the user to `uinput` (`input` already comes from `tiler.enable`)
- Uses built-in defaults: 3-finger swipes for workspace/column navigation, 4-finger for overview
- Can be customized by placing a TOML config at `~/.config/niri/gestures.toml`
- Requires user to be in the `input` group (done automatically by `tiler.enable`)
- Asserts that `niri.enable` is on — the daemon drives niri over its IPC socket
### Options
| Option | Default | Notes |
|---|---|---|
| `touchOutput` | `null` | niri output the panel maps to. **Required when more than one output is enabled** — the daemon refuses to start otherwise. Match `touch { map-to-output }` in the niri config. |
| `device` | `null` | Explicit evdev path; auto-detect fails with multiple touchscreens. |
| `threshold` | `60` | Pixels of movement before a swipe registers. |
| `configFile` | `null` | TOML gesture config. Must exist if set — a missing file is fatal, not a fallback to defaults. |
### Why dotool and not ydotool
Forwarding a tap needs the pointer placed at an absolute position. `ydotool`'s
`mousemove --absolute` does not do that: it emits a warp-to-corner plus a
*relative* delta, so the compositor's pointer acceleration scales it — measured
at exactly 2x on this host, saturating at the screen edge past ~1440px. niri has
no per-device input config, so accel cannot be flattened for just the virtual
device. `dotool` registers a uinput device with a declared absolute axis range
and jumps the cursor via `mouseto`, which acceleration cannot distort.
`dotoold` runs as a long-lived daemon because registering a uinput device carries
a startup delay that would otherwise be paid on every tap.
See `pkgs/niri-touchscreen-gestures/README.md` for gesture configuration details.
+1
View File
@@ -11,6 +11,7 @@ in
imports = [
./hyprland.nix
./niri.nix
./niri-touchscreen-gestures.nix
./swww.nix
];
options = {
@@ -9,14 +9,16 @@
flake-utils.url = "github:numtide/flake-utils";
};
outputs = {
self,
nixpkgs,
flake-utils,
}:
outputs =
{ self
, nixpkgs
, flake-utils
,
}:
flake-utils.lib.eachDefaultSystem (
system: let
pkgs = import nixpkgs {inherit system;};
system:
let
pkgs = import nixpkgs { inherit system; };
# Python with the packages needed by the offline converter tools
pythonEnv = pkgs.python3.withPackages (
@@ -36,7 +38,7 @@
version = "1.0";
src = ./.;
nativeBuildInputs = with pkgs; [makeWrapper];
nativeBuildInputs = with pkgs; [ makeWrapper ];
buildInputs = with pkgs; [
gcc
@@ -45,7 +47,7 @@
# python3 is needed by checkPhase: `make test-c` shells out to
# `python3 tools/run_tests.py` (see c/Makefile, PYTHON ?= python3).
nativeCheckInputs = with pkgs; [python3];
nativeCheckInputs = with pkgs; [ python3 ];
# Use x86-64-v3 (AVX2) for a portable binary; override with ARCH=native for local builds
ARCH =
@@ -122,7 +124,7 @@
buildInputs =
old.buildInputs
++ (with pkgs.rocmPackages; [clr rocm-runtime hipblas]);
++ (with pkgs.rocmPackages; [ clr rocm-runtime hipblas ]);
buildPhase = ''
runHook preBuild
@@ -139,9 +141,10 @@
# build), and the GPU path needs real hardware — so skip the suite.
doCheck = false;
meta = old.meta // {platforms = pkgs.lib.platforms.linux;};
meta = old.meta // { platforms = pkgs.lib.platforms.linux; };
});
in {
in
{
packages =
{
default = colibri;
@@ -166,7 +169,7 @@
formatter = pkgs.alejandra;
devShells.default = pkgs.mkShell {
inputsFrom = [colibri];
inputsFrom = [ colibri ];
packages = with pkgs; [
pythonEnv
@@ -1,15 +1,31 @@
from collections.abc import Iterable
import evdev
from evdev import ecodes
def identify_touchscreen_via_evdev() -> Iterable[evdev.InputDevice]:
"""Yield the real touchscreens, selected by capability rather than by name.
INPUT_PROP_DIRECT is the kernel's own statement that the device's coordinates
map directly onto the display, which is what distinguishes a touchscreen from
the two kinds of device that otherwise look identical:
* a touchpad, which is absolute but reports INPUT_PROP_POINTER instead
* a synthetic pointer such as `dotool absolute pointer`, which reports
ABS_X/ABS_Y and no props at all
Matching on ABS_X/ABS_Y and an absent "touchpad"/"mouse" substring used to
accept both, so the daemon detected its own click-forwarding device as a
second touchscreen and refused to start.
Multitouch axes are required as well: a device without them cannot report the
finger counts every gesture in the detector is defined in terms of.
"""
for path in evdev.list_devices():
dev = evdev.InputDevice(path)
name_lower = dev.name.lower()
if "touchscreen" in name_lower or "touch panel" in name_lower:
if ecodes.INPUT_PROP_DIRECT not in dev.input_props():
continue
abs_axes = dev.capabilities(absinfo=False).get(ecodes.EV_ABS, [])
if ecodes.ABS_MT_POSITION_X in abs_axes and ecodes.ABS_MT_POSITION_Y in abs_axes:
yield dev
if caps := dev.capabilities(absinfo=False).get(evdev.ecodes.EV_ABS):
if evdev.ecodes.ABS_X in caps and evdev.ecodes.ABS_Y in caps:
if ("mouse" not in name_lower) and ("touchpad" not in name_lower):
yield dev