niri: fix trackball device detection
Signed-off-by: Myned <dev@bjork.tech>
This commit is contained in:
parent
50cf7f508e
commit
88c0fcb0d4
2 changed files with 42 additions and 13 deletions
|
@ -33,11 +33,11 @@ in {
|
||||||
repeat-rate = 40;
|
repeat-rate = 40;
|
||||||
};
|
};
|
||||||
|
|
||||||
# BUG: Applies to trackball device, switch to "flat" when per-device configuration is supported
|
# TODO: Update when per-device configuration is supported
|
||||||
# https://github.com/YaLTeR/niri/issues/371
|
# https://github.com/YaLTeR/niri/issues/371
|
||||||
# https://github.com/sodiboo/niri-flake/blob/main/docs.md#programsnirisettingsinputmouseaccel-profile
|
# https://github.com/sodiboo/niri-flake/blob/main/docs.md#programsnirisettingsinputmouseaccel-profile
|
||||||
mouse = {
|
mouse = {
|
||||||
accel-profile = "adaptive";
|
accel-profile = "adaptive"; # flat
|
||||||
accel-speed = -0.7;
|
accel-speed = -0.7;
|
||||||
scroll-factor = 1.25;
|
scroll-factor = 1.25;
|
||||||
};
|
};
|
||||||
|
@ -55,8 +55,10 @@ in {
|
||||||
# https://github.com/sodiboo/niri-flake/blob/main/docs.md#programsnirisettingsinputtrackballaccel-profile
|
# https://github.com/sodiboo/niri-flake/blob/main/docs.md#programsnirisettingsinputtrackballaccel-profile
|
||||||
trackball = {
|
trackball = {
|
||||||
accel-profile = "adaptive";
|
accel-profile = "adaptive";
|
||||||
accel-speed = -0.5;
|
accel-speed = -0.8;
|
||||||
|
left-handed = true;
|
||||||
middle-emulation = true;
|
middle-emulation = true;
|
||||||
|
natural-scroll = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,19 +6,46 @@
|
||||||
}:
|
}:
|
||||||
with lib; let
|
with lib; let
|
||||||
cfg = config.custom.services.udev;
|
cfg = config.custom.services.udev;
|
||||||
|
|
||||||
|
chgrp = getExe' pkgs.coreutils "chgrp";
|
||||||
|
chmod = getExe' pkgs.coreutils "chmod";
|
||||||
in {
|
in {
|
||||||
options.custom.services.udev.enable = mkOption {default = false;};
|
options.custom.services.udev = {
|
||||||
|
enable = mkOption {default = false;};
|
||||||
|
backlight = mkOption {default = true;};
|
||||||
|
input = mkOption {default = true;};
|
||||||
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
# https://wiki.archlinux.org/title/Udev
|
# https://wiki.archlinux.org/title/Udev
|
||||||
# Allow video group to change display brightness
|
services.udev.extraRules =
|
||||||
# https://raw.githubusercontent.com/ErikReider/SwayOSD/main/data/udev/99-swayosd.rules
|
optionalString cfg.backlight ''
|
||||||
services.udev.extraRules = let
|
# Allow video group to change display brightness
|
||||||
chgrp = "${pkgs.coreutils}/bin/chgrp";
|
# https://raw.githubusercontent.com/ErikReider/SwayOSD/main/data/udev/99-swayosd.rules
|
||||||
chmod = "${pkgs.coreutils}/bin/chmod";
|
ACTION=="add", \
|
||||||
in ''
|
SUBSYSTEM=="backlight", \
|
||||||
ACTION=="add", SUBSYSTEM=="backlight", RUN+="${chgrp} video /sys/class/backlight/%k/brightness"
|
RUN+="${chgrp} video /sys/class/backlight/%k/brightness"
|
||||||
ACTION=="add", SUBSYSTEM=="backlight", RUN+="${chmod} g+w /sys/class/backlight/%k/brightness"
|
ACTION=="add", \
|
||||||
'';
|
SUBSYSTEM=="backlight", \
|
||||||
|
RUN+="${chmod} g+w /sys/class/backlight/%k/brightness"
|
||||||
|
''
|
||||||
|
+ optionalString cfg.input ''
|
||||||
|
# Per-device input configuration
|
||||||
|
# https://wiki.archlinux.org/title/Libinput#Via_Udev_Rule
|
||||||
|
# https://wayland.freedesktop.org/libinput/doc/latest/device-configuration-via-udev.html
|
||||||
|
#?? sudo libinput list-devices
|
||||||
|
#?? sudo udevadm info /dev/input/event*
|
||||||
|
#?? sudo udevadm trigger /dev/input/event*
|
||||||
|
|
||||||
|
# Kensington Orbit
|
||||||
|
ENV{ID_USB_SERIAL}=="Kensington_ORBIT_WIRELESS_TB", \
|
||||||
|
ENV{ID_INPUT_MOUSE}="", \
|
||||||
|
ENV{ID_INPUT_TRACKBALL}="1"
|
||||||
|
|
||||||
|
# ProtoArc EM04
|
||||||
|
ENV{ID_USB_SERIAL}=="Nordic_2.4G_Wireless_Receiver", \
|
||||||
|
ENV{ID_INPUT_MOUSE}="", \
|
||||||
|
ENV{ID_INPUT_TRACKBALL}="1"
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue