From 72f885ed26bdd57d8ec55a4173374e872c963f34 Mon Sep 17 00:00:00 2001 From: Myned Date: Wed, 27 Nov 2024 16:12:59 -0600 Subject: [PATCH] nix: unify hyprland devices Signed-off-by: Myned --- options/custom/desktops/hyprland/settings.nix | 70 +++++++------------ 1 file changed, 27 insertions(+), 43 deletions(-) diff --git a/options/custom/desktops/hyprland/settings.nix b/options/custom/desktops/hyprland/settings.nix index 6ec0362..d50636c 100644 --- a/options/custom/desktops/hyprland/settings.nix +++ b/options/custom/desktops/hyprland/settings.nix @@ -247,53 +247,37 @@ in { # https://wiki.hyprland.org/Configuring/Variables/#custom-accel-profiles # https://wayland.freedesktop.org/libinput/doc/latest/pointer-acceleration.html#the-custom-acceleration-profile #?? custom - # TODO: Combine same devices - # FIXME: Hotplugging may result in different id - device = [ - { - name = "kensington-orbit-wireless-tb-mouse"; - accel_profile = "adaptive"; - sensitivity = -0.6; - left_handed = true; - middle_button_emulation = true; - natural_scroll = true; - } + device = let + # Combine duplicate devices into one attrset + #?? (devices ["NAME"] {ATTRS}) + devices = names: attrs: map (name: {inherit name;} // attrs) names; + in + flatten [ + (devices ["kensington-orbit-wireless-tb-mouse" "orbit-bt5.0-mouse"] { + accel_profile = "adaptive"; + left_handed = true; + middle_button_emulation = true; + natural_scroll = true; + sensitivity = -0.6; + }) - { - name = "orbit-bt5.0-mouse"; - accel_profile = "adaptive"; - sensitivity = -0.6; - left_handed = true; - middle_button_emulation = true; - natural_scroll = true; - } + (devices ["logitech-m570"] { + accel_profile = "custom 1 0 1 3"; + sensitivity = -0.2; + }) - { - name = "logitech-m570"; - accel_profile = "custom 1 0 1 3"; - sensitivity = -0.2; - } + (devices ["nordic-2.4g-wireless-receiver-mouse" "protoarc-em11-nl-mouse"] { + sensitivity = -0.7; + }) - { - name = "nordic-2.4g-wireless-receiver-mouse"; - sensitivity = -0.7; - } + (devices ["razer-razer-viper-ultimate" "razer-razer-viper-ultimate-dongle"] { + sensitivity = -0.7; + }) - { - name = "protoarc-em11-nl-mouse"; - sensitivity = -0.7; - } - - { - name = "razer-razer-viper-ultimate-dongle"; - sensitivity = -0.7; - } - - { - name = "wireless-controller-touchpad"; - enabled = false; - } - ]; + (devices ["wireless-controller-touchpad"] { + enabled = false; + }) + ]; }; }; }