latest
This commit is contained in:
1 parent
df2540c6b7
commit
d48198e199
8 files changed
+92
-41
No files matched your search
@@ -1,14 +1,24 @@
|
|||||||
// Auto-generated by DMS - do not edit manually
|
// 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" {
|
output "eDP-1" {
|
||||||
mode "2880x1920@120.000"
|
mode "2880x1920@120.000"
|
||||||
scale 1.5
|
scale 2
|
||||||
position x=0 y=0
|
position x=1184 y=1080
|
||||||
hot-corners {
|
focus-at-startup
|
||||||
top-right
|
layout {
|
||||||
bottom-left
|
always-center-single-column
|
||||||
bottom-right
|
|
||||||
top-left
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
output "DP-10" {
|
||||||
|
mode "1920x1080@74.973"
|
||||||
|
scale 1
|
||||||
|
position x=1920 y=0
|
||||||
|
}
|
||||||
|
|
||||||
@@ -59,10 +59,7 @@ gestures {
|
|||||||
}
|
}
|
||||||
|
|
||||||
hot-corners {
|
hot-corners {
|
||||||
top-left
|
off
|
||||||
top-right
|
|
||||||
bottom-left
|
|
||||||
bottom-right
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -151,6 +151,8 @@
|
|||||||
python3Packages.pydantic-settings
|
python3Packages.pydantic-settings
|
||||||
python3Packages.pytest
|
python3Packages.pytest
|
||||||
libinput
|
libinput
|
||||||
|
wlrctl
|
||||||
|
ydotool
|
||||||
];
|
];
|
||||||
shellHook = ''
|
shellHook = ''
|
||||||
export PATH=$PATH:$(pwd)/bin
|
export PATH=$PATH:$(pwd)/bin
|
||||||
|
|||||||
+7
-7
@@ -43,6 +43,13 @@ in
|
|||||||
enable = true;
|
enable = true;
|
||||||
niri = {
|
niri = {
|
||||||
enable = true;
|
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
|
# Packages
|
||||||
environment.systemPackages =
|
environment.systemPackages =
|
||||||
let
|
let
|
||||||
@@ -243,12 +247,8 @@ in
|
|||||||
# claude-desktop.packages.x86_64-linux.default
|
# claude-desktop.packages.x86_64-linux.default
|
||||||
claude-code
|
claude-code
|
||||||
|
|
||||||
# My Own
|
|
||||||
niri-touchscreen-gestures
|
|
||||||
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
||||||
services.usbmuxd.enable = true;
|
services.usbmuxd.enable = true;
|
||||||
services.flatpak.packages = [
|
services.flatpak.packages = [
|
||||||
"com.cassidyjames.butler"
|
"com.cassidyjames.butler"
|
||||||
|
|||||||
@@ -45,10 +45,32 @@ skyg.nixos.desktop.tiler.background.enable
|
|||||||
|
|
||||||
When `skyg.nixos.desktop.tiler.niri.touchscreen-gestures.enable = true`:
|
When `skyg.nixos.desktop.tiler.niri.touchscreen-gestures.enable = true`:
|
||||||
|
|
||||||
- Installs `niri-touchscreen-gestures` package
|
- Installs the `niri-touchscreen-gestures` and `dotool` packages
|
||||||
- Starts a user systemd service (`niri-touchscreen-gestures.service`)
|
- 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
|
- 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`
|
- Asserts that `niri.enable` is on — the daemon drives niri over its IPC socket
|
||||||
- Requires user to be in the `input` group (done automatically by `tiler.enable`)
|
|
||||||
|
### 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.
|
See `pkgs/niri-touchscreen-gestures/README.md` for gesture configuration details.
|
||||||
@@ -11,6 +11,7 @@ in
|
|||||||
imports = [
|
imports = [
|
||||||
./hyprland.nix
|
./hyprland.nix
|
||||||
./niri.nix
|
./niri.nix
|
||||||
|
./niri-touchscreen-gestures.nix
|
||||||
./swww.nix
|
./swww.nix
|
||||||
];
|
];
|
||||||
options = {
|
options = {
|
||||||
|
|||||||
@@ -9,14 +9,16 @@
|
|||||||
flake-utils.url = "github:numtide/flake-utils";
|
flake-utils.url = "github:numtide/flake-utils";
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = {
|
outputs =
|
||||||
self,
|
{ self
|
||||||
nixpkgs,
|
, nixpkgs
|
||||||
flake-utils,
|
, flake-utils
|
||||||
}:
|
,
|
||||||
|
}:
|
||||||
flake-utils.lib.eachDefaultSystem (
|
flake-utils.lib.eachDefaultSystem (
|
||||||
system: let
|
system:
|
||||||
pkgs = import nixpkgs {inherit system;};
|
let
|
||||||
|
pkgs = import nixpkgs { inherit system; };
|
||||||
|
|
||||||
# Python with the packages needed by the offline converter tools
|
# Python with the packages needed by the offline converter tools
|
||||||
pythonEnv = pkgs.python3.withPackages (
|
pythonEnv = pkgs.python3.withPackages (
|
||||||
@@ -36,7 +38,7 @@
|
|||||||
version = "1.0";
|
version = "1.0";
|
||||||
src = ./.;
|
src = ./.;
|
||||||
|
|
||||||
nativeBuildInputs = with pkgs; [makeWrapper];
|
nativeBuildInputs = with pkgs; [ makeWrapper ];
|
||||||
|
|
||||||
buildInputs = with pkgs; [
|
buildInputs = with pkgs; [
|
||||||
gcc
|
gcc
|
||||||
@@ -45,7 +47,7 @@
|
|||||||
|
|
||||||
# python3 is needed by checkPhase: `make test-c` shells out to
|
# python3 is needed by checkPhase: `make test-c` shells out to
|
||||||
# `python3 tools/run_tests.py` (see c/Makefile, PYTHON ?= python3).
|
# `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
|
# Use x86-64-v3 (AVX2) for a portable binary; override with ARCH=native for local builds
|
||||||
ARCH =
|
ARCH =
|
||||||
@@ -122,7 +124,7 @@
|
|||||||
|
|
||||||
buildInputs =
|
buildInputs =
|
||||||
old.buildInputs
|
old.buildInputs
|
||||||
++ (with pkgs.rocmPackages; [clr rocm-runtime hipblas]);
|
++ (with pkgs.rocmPackages; [ clr rocm-runtime hipblas ]);
|
||||||
|
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
runHook preBuild
|
runHook preBuild
|
||||||
@@ -139,9 +141,10 @@
|
|||||||
# build), and the GPU path needs real hardware — so skip the suite.
|
# build), and the GPU path needs real hardware — so skip the suite.
|
||||||
doCheck = false;
|
doCheck = false;
|
||||||
|
|
||||||
meta = old.meta // {platforms = pkgs.lib.platforms.linux;};
|
meta = old.meta // { platforms = pkgs.lib.platforms.linux; };
|
||||||
});
|
});
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
packages =
|
packages =
|
||||||
{
|
{
|
||||||
default = colibri;
|
default = colibri;
|
||||||
@@ -166,7 +169,7 @@
|
|||||||
formatter = pkgs.alejandra;
|
formatter = pkgs.alejandra;
|
||||||
|
|
||||||
devShells.default = pkgs.mkShell {
|
devShells.default = pkgs.mkShell {
|
||||||
inputsFrom = [colibri];
|
inputsFrom = [ colibri ];
|
||||||
|
|
||||||
packages = with pkgs; [
|
packages = with pkgs; [
|
||||||
pythonEnv
|
pythonEnv
|
||||||
+22
-6
@@ -1,15 +1,31 @@
|
|||||||
from collections.abc import Iterable
|
from collections.abc import Iterable
|
||||||
|
|
||||||
import evdev
|
import evdev
|
||||||
|
from evdev import ecodes
|
||||||
|
|
||||||
|
|
||||||
def identify_touchscreen_via_evdev() -> Iterable[evdev.InputDevice]:
|
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():
|
for path in evdev.list_devices():
|
||||||
dev = evdev.InputDevice(path)
|
dev = evdev.InputDevice(path)
|
||||||
name_lower = dev.name.lower()
|
if ecodes.INPUT_PROP_DIRECT not in dev.input_props():
|
||||||
if "touchscreen" in name_lower or "touch panel" in name_lower:
|
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
|
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
|
|
||||||
Reference in new issue
Block a user