3

I couldn't solve this problem despite spending many hours (two days), so I decided to ask here. How can I restore the default settings for the Apple Magic Trackpad 2 when using on Ubuntu?

My problem is the following: I am using Ubuntu 20.04 LTS. After using my Apple Magic Trackpad 2 for some time without major issues, it stopped working. (I am using it via a cable). I always have to click on it very hard to be able to move my cursor. Unusable. I was able to find a kind of a workaround here (Apple Magic Trackpad 2 configuration )

It suggest using a command like

xinput set-prop 17 296 2, 2, 0

With xinput list I first identify the trackpad's id (not persistent!). Now it is 21.

⎜ ↳ Apple Inc. Magic Trackpad 2 id=21 [slave pointer (2)]

These are its properties that I identify by typing xinput watch-props 21.

Device 'Apple Inc. Magic Trackpad 2':
Device Enabled (171):   1
Coordinate Transformation Matrix (173): 1.000000, 0.000000, 0.000000, 0.000000,    1.000000, 0.000000, 0.000000, 0.000000, 1.000000
Device Accel Profile (304): 1
Device Accel Constant Deceleration (305):   2.500000
Device Accel Adaptive Deceleration (306):   1.000000
Device Accel Velocity Scaling (307):    22.886030
Synaptics Edges (331):  -3031, 3287, -2048, 2157
Synaptics Finger (332): 70, 75, 0
Synaptics Tap Time (333):   180
Synaptics Tap Move (334):   402
Synaptics Tap Durations (335):  180, 180, 100
Synaptics ClickPad (336):   1
Synaptics Middle Button Timeout (337):  0
Synaptics Two-Finger Pressure (338):    279
Synaptics Two-Finger Width (339):   7
Synaptics Scrolling Distance (340): -182, 182
Synaptics Edge Scrolling (341): 0, 0, 0
Synaptics Two-Finger Scrolling (342):   1, 1
Synaptics Move Speed (343): 1.000000, 1.750000, 0.021875, 0.000000
Synaptics Off (344):    0
Synaptics Locked Drags (345):   0
Synaptics Locked Drags Timeout (346):   5000
Synaptics Tap Action (347): 0, 0, 0, 0, 1, 3, 2
Synaptics Click Action (348):   1, 3, 2
Synaptics Circular Scrolling (349): 0
Synaptics Circular Scrolling Distance (350):    0.100000
Synaptics Circular Scrolling Trigger (351): 0
Synaptics Circular Pad (352):   0
Synaptics Palm Detection (353): 1
Synaptics Palm Dimensions (354):    10, 198
Synaptics Coasting Speed (355): 20.000000, 50.000000
Synaptics Pressure Motion (356):    29, 158
Synaptics Pressure Motion Factor (357): 1.000000, 1.000000
Synaptics Resolution Detect (358):  1
Synaptics Grab Event Device (359):  0
Synaptics Gestures (360):   1
Synaptics Capabilities (361):   1, 0, 0, 1, 1, 1, 0
Synaptics Pad Resolution (362): 44, 47
Synaptics Area (363):   0, 0, 0, 0
Synaptics Soft Button Areas (364):  0, 0, 0, 0, 0, 0, 0, 0
Synaptics Noise Cancellation (365): 45, 45
Device Product ID (297):    1452, 613
Device Node (296):  "/dev/input/event25"

So far, I haven't modified anything. According to the above mentioned workaround, we now need to identify the 'Synaptics Finger'-ID which is 332 in this case (not persistent either):

xinput set-prop 21 332 2, 2, 0

After that, it seems to work.

However, whenever I restart either the computer or the trackpad, all of the changes disappear. I initially added a shortcut for these commands; however, it is not effective as ids tend to change after unplugging the trackpad. I also considered writing a script, however, it should come into effect whenever I plug in/turn on the trackpad - not when the computer is turned on.

I want to delete all of the settings stored when connecting this trackpad. Just as it was at the beginning. Similar to the following solution for macos.

So far, I've also tried the following commands restoring settings - they weren't effective. dconf reset -f / dconf reset -f /org/gnome/desktop/peripherals/mouse/ dconf reset -f /org/gnome/desktop/peripherals/touchpad/

How can I restore the default settings for the Apple Magic Trackpad 2 when using on Ubuntu? Alternatively, how can I make these changes persistent?

Thank you so much for any help!

2 Answers2

1

I found a way to make these settings permanent.

Add this section to your /etc/X11/xorg.conf file:

Section "InputClass"
    Identifier "Apple Magic Trackpad"
    MatchIsTouchpad "on"
    MatchUSBID "05ac:0265"
    Driver        "synaptics"
    Option        "VertScrollDelta" "50"
    Option        "HorizScrollDelta" "50"
    Option        "MinSpeed"        "0.6"
    Option        "MaxSpeed"        "1.3"
    Option        "AccelFactor"     "0.08"
    Option        "VertResolution"  "1"
    Option        "HorizResolution" "3"
    Option        "TapButton1"      "1"
    Option "TapButton3" "2"
    Option "VertEdgeScroll" "on"
    Option "VertTwoFingerScroll" "on"
    Option "HorizEdgeScroll" "on"
    Option "HorizTwoFingerScroll" "on"
    Option "CircularScrolling" "on"
    Option "CircScrollTrigger" "2"
    Option "EmulateTwoFingerMinZ" "40"
    Option "EmulateTwoFingerMinW" "8"
    Option "CoastingSpeed" "0"
    Option "FingerLow" "2"
    Option "FingerHigh" "2"
    Option "MaxTapTime" "125"
EndSection

These two options will do the trick as xinput:

Option "FingerLow" "2"
Option "FingerHigh" "2"

Update the USB ID with your device ID, get it with "lsusb"

Hope that helps.

Regards.

Jairelee
  • 671
0

I use the below script to set my trackpad settings for Logitech T650 AND Apple Magic Trackpad 2

I use KDE and have added the script as a startup script I saved my script in ~/bin/user-settings.sh and you can call it manually by executing ~/bin/user-settings.sh

What I still need to tweak, is

  1. Tap and drag select is not working for me. Click and drag to select does
  2. I'm not happy that I cannot set these settings in KDE
  3. You need libinput

I have the following packages installed on my system (Ubuntu 22.04 / KDE 5.24)

❯❯❯ sudo dpkg --list |grep input            
ii  inputattach                                   1:1.7.1-1build2                             amd64        utility to connect serial-attached peripherals to the input subsystem
ii  khotkeys:amd64                                4:5.24.4-0ubuntu1                           amd64        configure input actions settings
ii  khotkeys-data                                 4:5.24.4-0ubuntu1                           all          configure input actions settings
ii  libinput-bin                                  1.20.0-1                                    amd64        input device management and event handling library - udev quirks
ii  libinput10:amd64                              1.20.0-1                                    amd64        input device management and event handling library - shared library
ii  libqt5hunspellinputmethod5:amd64              5.15.3+dfsg-1                               amd64        Qt virtual keyboard - helper library for Hunspell input method
ii  libxcb-xinput0:amd64                          1.14-3ubuntu3                               amd64        X C Binding, xinput extension
ii  python3-evdev                                 1.4.0+dfsg-1build2                          amd64        Python 3 bindings for the Linux input subsystem
ii  xinput                                        1.6.3-1build2                               amd64        Runtime configuration and test of XInput devices
ii  xserver-xorg-input-all                        1:7.7+23ubuntu2                             amd64        X.Org X server -- input driver metapackage
ii  xserver-xorg-input-libinput                   1.2.1-1                                     amd64        X.Org X server -- libinput input driver
ii  xserver-xorg-input-synaptics                  1.9.1-1ubuntu3                              amd64        Synaptics TouchPad driver for X.Org server
ii  xserver-xorg-input-wacom                      1:1.0.0-3ubuntu1                            amd64        X.Org X server -- Wacom input driver

Script below. Let me know what you think, perhaps we can get a perfect settings?

#!/usr/bin/env bash

set touchpad settings

echo "Set Trackpad Settings" DEVICE_NAME_IDENTIFIER="T650|Magic Trackpad 2"

next we get the id of the device

DEVICE_ID=$(xinput -list |grep -iE "$DEVICE_NAME_IDENTIFIER" | cut -d "=" -f2 | awk '{ print $1 }')

if [[ $DEVICE_ID -gt 0 ]] ; then echo "Logitech Touchpad T650 or Apple Magic Trackpad found - applying settings" # next we find all of the id's of the properties we want to set #xinput list-props $DEVICE_ID

SETTINGS=(
    'Device Accel Profile|2'
    'Device Accel Constant Deceleration|1.500000'
    'Device Accel Adaptive Deceleration|1.000000'
    'Device Accel Velocity Scaling|1.00000'
    'Synaptics Tap Time|110'
    'Synaptics Tap Move|180'
    'Synaptics Tap Durations|120, 110, 110'
    'Synaptics Middle Button Timeout|100'
    'Synaptics Two-Finger Pressure|162'
    'Synaptics Scrolling Distance|50, 50'
    'Synaptics Two-Finger Scrolling|1, 1'
    'Synaptics Move Speed|1.97737, 3.919290, 0.054371, 0.000000'
    'Synaptics Locked Drags|0'
    'Synaptics Locked Drags Timeout|5000'
    'Synaptics Tap Action|2, 3, 0, 0, 1, 3, 0'
    'Synaptics Click Action|1, 3, 0'
    'Synaptics Circular Scrolling|0'
    'Synaptics Circular Scrolling Distance|0.100007'
    'Synaptics Circular Scrolling Trigger|0'
    'Synaptics Palm Detection|0'
    'Synaptics Coasting Speed|95.000000, 95.000000'
    'Synaptics Pressure Motion|110, 110'
    'Synaptics Off|0'
    'Synaptics Pressure Motion Factor|1.000000, 1.000000'
    'Synaptics Resolution Detect|1'
    'Synaptics Gestures|1'
    # 'Synaptics Capabilities|1, 0, 0, 1, 1, 1, 1'
    'Synaptics Area|0, 0, 0, 0'
    'Synaptics Noise Cancellation|10, 10'
    'Synaptics Finger|2, 4, 0'
)

for fields in "${SETTINGS[@]}" # quotes around settings array needed otherwise strings are split by space
    do
        # echo "fields are: $fields"
        IFS=$'|' read -r property setting <<< "$fields"
        # echo "property: $property value: $setting"
        SYNAPTICS_PROP_ID=$(xinput list-props $DEVICE_ID |grep -m1 "$property" | cut -d "(" -f2 | cut -d ")" -f1 |grep -o '[0-9]\+')
        CURENT_PROPERTY_VALUE=$(xinput list-props $DEVICE_ID |grep -m1 "$property")
        echo "Current vs New: $CURENT_PROPERTY_VALUE:$setting"
        xinput set-prop $DEVICE_ID $SYNAPTICS_PROP_ID $setting
    done

else echo "Logitech Touchpad T650 or Apple Magic Trackpad not found - exiting" exit 1

fi