From f9eb4ff3510bd2810d775d93744907fd32822ace Mon Sep 17 00:00:00 2001 From: Scott Wallace Date: Thu, 9 May 2019 19:59:33 +0100 Subject: [PATCH] Better trackpad configuration for Linux on MBP --- .../roles/linux_desktop/files/mtrack.conf | 61 +++++++++++++++++++ .../roles/linux_desktop/tasks/config.yaml | 14 ----- .../includes/platform_apple inc._laptop.yaml | 32 +++++++++- .../includes/platform_google_laptop.yaml | 11 ++++ 4 files changed, 102 insertions(+), 16 deletions(-) create mode 100644 .ansible/roles/linux_desktop/files/mtrack.conf diff --git a/.ansible/roles/linux_desktop/files/mtrack.conf b/.ansible/roles/linux_desktop/files/mtrack.conf new file mode 100644 index 0000000..57cba15 --- /dev/null +++ b/.ansible/roles/linux_desktop/files/mtrack.conf @@ -0,0 +1,61 @@ +Section "InputClass" + MatchIsTouchpad "true" + Identifier "Apple Trackpad" + MatchProduct "Apple|bcm5974" + Driver "mtrack" + # Tweak cursor movement speed with this + # Option "Sensitivity" "0.05" + # Pressure at which a finger is detected as a touch + Option "FingerHigh" "5" + # Pressure at which a finger is detected as a release + Option "FingerLow" "5" + # I often use thumb to press down the physical button, so let's not ignore it + Option "IgnoreThumb" "false" + Option "ThumbRatio" "70" + Option "ThumbSize" "25" + # Ignore palm, with palm takes up to 30% of your touch pad + Option "IgnorePalm" "true" + Option "PalmSize" "30" + Option "ClickTime" "25" + # Disable tap-to-drag, we're using three finger drag instead + Option "TapDragEnable" "false" + # While touching the touch pad with # fingers, press the touchpad physical click button + Option "ClickFinger1" "1" + Option "ClickFinger2" "3" + Option "ClickFinger3" "2" + Option "ButtonMoveEmulate" "false" + Option "ButtonIntegrated" "true" + # The momentum after scroll fingers released + Option "ScrollCoastDuration" "300" + Option "ScrollCoastEnableSpeed" ".1" + # Natural scrolling with two fingers + Option "ScrollSmooth" "true" + Option "ScrollUpButton" "5" + Option "ScrollDownButton" "4" + Option "ScrollLeftButton" "7" + Option "ScrollRightButton" "6" + # Tweak scroll sensitivity with ScrollDistance, don't touch ScrollSensitivity + Option "ScrollDistance" "250" + Option "ScrollClickTime" "10" + # Three finger drag + Option "SwipeDistance" "1" + Option "SwipeLeftButton" "1" + Option "SwipeRightButton" "1" + Option "SwipeUpButton" "1" + Option "SwipeDownButton" "1" + Option "SwipeClickTime" "0" + Option "SwipeSensitivity" "1500" + # Four finger swipe, 8 & 9 are for browsers navigating back and forth respectively + Option "Swipe4LeftButton" "9" + Option "Swipe4RightButton" "8" + # Mouse button >= 10 are not used by Xorg, so we'll map them with xbindkeys and xdotool later + Option "Swipe4UpButton" "11" + Option "Swipe4DownButton" "10" + # Mouse buttons triggered by 2-finger pinching gesture + Option "ScaleDistance" "300" + Option "ScaleUpButton" "12" + Option "ScaleDownButton" "13" + # Mouse buttons trigger by 2-finger rotating gesture, disabled to enhance the pinch gesture + Option "RotateLeftButton" "0" + Option "RotateRightButton" "0" +EndSection diff --git a/.ansible/roles/linux_desktop/tasks/config.yaml b/.ansible/roles/linux_desktop/tasks/config.yaml index 38af84e..beeec4f 100644 --- a/.ansible/roles/linux_desktop/tasks/config.yaml +++ b/.ansible/roles/linux_desktop/tasks/config.yaml @@ -92,20 +92,6 @@ dest: '~/.conkyrc' mode: '0400' -- name: 'Synaptics touchpad natural scrolling' - tags: - - config - - desktop - copy: - dest: '/etc/X11/Xsession.d/80synaptics' - content: | - synclient VertScrollDelta=-247 - synclient HorizScrollDelta=-247 - mode: '0644' - owner: 'root' - group: 'root' - become: true - - name: 'Abert' tags: - config diff --git a/.ansible/roles/linux_desktop/tasks/includes/platform_apple inc._laptop.yaml b/.ansible/roles/linux_desktop/tasks/includes/platform_apple inc._laptop.yaml index fcff066..7f95078 100644 --- a/.ansible/roles/linux_desktop/tasks/includes/platform_apple inc._laptop.yaml +++ b/.ansible/roles/linux_desktop/tasks/includes/platform_apple inc._laptop.yaml @@ -1,8 +1,36 @@ -- name: 'Platform: Apple Inc. Laptop' +- name: 'Platform: Apple Inc. Laptop: Software' tags: - platform package: name: "{{ item }}" state: present - loop: ['mbpfan'] + loop: + - 'mbpfan' + - 'xserver-xorg-input-mtrack' become: true + +- name: 'Platform: Apple Inc. Laptop: Trackpad' + tags: + - platform + block: + - name: 'Platform: Apple Inc. Laptop: Remove Synaptics driver' + apt: + name: 'xserver-xorg-input-synaptics' + state: absent + purge: true + become: true + + - name: 'Platform: Apple Inc. Laptop: Remove old trackpad config' + file: + path: '/usr/share/X11/xorg.conf.d/50-mtrack.conf' + state: absent + become: true + + - name: 'Platform: Apple Inc. Laptop: Trackpad config' + copy: + src: files/mtrack.conf + dest: '/usr/share/X11/xorg.conf.d/10-mtrack.conf' + owner: 'root' + group: 'root' + mode: 0644 + become: true diff --git a/.ansible/roles/linux_desktop/tasks/includes/platform_google_laptop.yaml b/.ansible/roles/linux_desktop/tasks/includes/platform_google_laptop.yaml index e28784b..e6b0f37 100644 --- a/.ansible/roles/linux_desktop/tasks/includes/platform_google_laptop.yaml +++ b/.ansible/roles/linux_desktop/tasks/includes/platform_google_laptop.yaml @@ -22,3 +22,14 @@ regexp: '^options iwlwifi ' line: 'options iwlwifi 11n_disable=8 swcrypto=1' become: true + + - name: 'Synaptics touchpad natural scrolling' + copy: + dest: '/etc/X11/Xsession.d/80synaptics' + content: | + synclient VertScrollDelta=-247 + synclient HorizScrollDelta=-247 + mode: '0644' + owner: 'root' + group: 'root' + become: true