lol

Trackpoint scrolling on T450s et al

+31 -17
+31 -17
nixos/modules/tasks/trackpoint.nix
··· 45 45 ''; 46 46 }; 47 47 48 + fakeButtons = mkOption { 49 + default = false; 50 + type = types.bool; 51 + description = '' 52 + Switch to "bare" PS/2 mouse support in case Trackpoint buttons are not recognized 53 + properly. This can happen for example on models like the L430, T450, T450s, on 54 + which the Trackpoint buttons are actually a part of the Synaptics touchpad. 55 + ''; 56 + }; 57 + 48 58 }; 49 59 50 60 }; ··· 52 62 53 63 ###### implementation 54 64 55 - config = mkMerge [ 56 - (mkIf config.hardware.trackpoint.enable { 65 + config = 66 + let cfg = config.hardware.trackpoint; in 67 + mkMerge [ 68 + (mkIf cfg.enable { 57 69 services.udev.extraRules = 58 70 '' 59 - ACTION=="add|change", SUBSYSTEM=="input", ATTR{name}=="TPPS/2 IBM TrackPoint", ATTR{device/speed}="${toString config.hardware.trackpoint.speed}", ATTR{device/sensitivity}="${toString config.hardware.trackpoint.sensitivity}" 71 + ACTION=="add|change", SUBSYSTEM=="input", ATTR{name}=="TPPS/2 IBM TrackPoint", ATTR{device/speed}="${toString cfg.speed}", ATTR{device/sensitivity}="${toString cfg.sensitivity}" 60 72 ''; 61 73 62 74 system.activationScripts.trackpoint = ··· 65 77 ''; 66 78 }) 67 79 68 - (mkIf config.hardware.trackpoint.emulateWheel { 69 - services.xserver.config = 70 - '' 71 - Section "InputClass" 72 - Identifier "Trackpoint Wheel Emulation" 73 - MatchProduct "Elantech PS/2 TrackPoint|TPPS/2 IBM TrackPoint|DualPoint Stick|Synaptics Inc. Composite TouchPad / TrackPoint|ThinkPad USB Keyboard with TrackPoint|USB Trackpoint pointing device|Composite TouchPad / TrackPoint" 74 - MatchDevicePath "/dev/input/event*" 75 - Option "EmulateWheel" "true" 76 - Option "EmulateWheelButton" "2" 77 - Option "Emulate3Buttons" "false" 78 - Option "XAxisMapping" "6 7" 79 - Option "YAxisMapping" "4 5" 80 - EndSection 81 - ''; 80 + (mkIf (cfg.emulateWheel) { 81 + services.xserver.inputClassSections = 82 + ['' 83 + Identifier "Trackpoint Wheel Emulation" 84 + MatchProduct "${if cfg.fakeButtons then "PS/2 Generic Mouse" else "Elantech PS/2 TrackPoint|TPPS/2 IBM TrackPoint|DualPoint Stick|Synaptics Inc. Composite TouchPad / TrackPoint|ThinkPad USB Keyboard with TrackPoint|USB Trackpoint pointing device|Composite TouchPad / TrackPoint"}" 85 + MatchDevicePath "/dev/input/event*" 86 + Option "EmulateWheel" "true" 87 + Option "EmulateWheelButton" "2" 88 + Option "Emulate3Buttons" "false" 89 + Option "XAxisMapping" "6 7" 90 + Option "YAxisMapping" "4 5" 91 + '']; 92 + }) 93 + 94 + (mkIf cfg.fakeButtons { 95 + boot.extraModprobeConfig = "options psmouse proto=bare"; 82 96 }) 83 97 ]; 84 98 }