Tweak and fine-tune touchpads and mice

Here are some pointers on how to fine-tune the behavior of mice and trackpads.

 Note that this is unofficial, unsupported, etc  .:-) 

 

To experiment with changing settings (not permanent):

  1. Get to a shell (ctl+alt+t when logged in, then run "shell" cmd)
  2. Find your device ID by running 
    xinput -list
    to see all devices - use the name of the devices to locate your touchpad or mouse.
  3. Once you have that id #, you want to list all the properties the device has so you can decide what to adjust, so run 
    xinput list-props [id#]
  4. Now you can look through that list and find the attribute you want to change. Take note of the attribute id # which is found in the parentheses at the end of the attribute name. 
  5. Decide what you want the new value to be (you'll have to guess-and-check at what the right adjustments are for any given device), and then you can change the attribute value this way:
    xinput set-prop [device id#] [attribute id#] [new value]

 

Test the results and repeat that process until you know the value you like. 

Now, these actions will only last until your next reboot.

 

To make changes persistent (or close): 

Now you know the settings that you'd like to change. You can group them all into a script to run on every startup, but unfortunately the  id of your trackpad and the properties you want to change may have different numbers assigned to them from boot to boot, so you need to define variables for your device and for each property you want to change that can query generically for them and ensure you always get the right answer.

You will likely need to understand bash pretty well to do this, and such tutorials are outside the scope of this article. For those ready to try this, here is an example script of my trackpad script for reference:

 

DEVICE=`xinput --list | grep -i touchpad | cut -f 2 -d = | cut -f 1 -d "["`
AUS=`xinput --list-props $DEVICE| grep -i australian | cut -f 2 -d "(" | cut -f 1 -d ")"`
XSCROLL=`xinput --list-props $DEVICE | grep -i scale | grep -i scroll | grep -i x | cut -f 2 -d "(" | cut -f 1 -d ")"`
YSCROLL=`xinput --list-props $DEVICE | grep -i scale | grep -i scroll | grep -i y | cut -f 2 -d "(" | cut -f 1 -d ")"`
THREESWIPE=`xinput --list-props $DEVICE | grep -i "three finger swipe distance" | cut -f 2 -d "(" | cut -f 1 -d ")"`
xinput --set-prop $DEVICE $AUS 1
xinput --set-prop $DEVICE $XSCROLL 1.5
xinput --set-prop $DEVICE $YSCROLL 1.5
xinput --set-prop $DEVICE $THREESWIPE 1.0

 

Your script won't be the same as mine, but hopefully the structure is helpful.

Once you've created a .txt draft of what you think your script should contain (and you should be testing all your script-lines directly on the cmd line to see if they work) copy that .txt and rename the copy to a .sh (script.txt > script.sh) - try to make the name brief and easy to remember.

 

Now you have "script.sh" which is your own personal input-device-fixer. To make those fixes present all the time, you need this script to run at startup. You can try to setup something that runs at startup automatically, but it's a little complex on CloudReady (compared to init scripts and .bashrc functionality on more typical Linux).

 

Copy script.sh into your path and modify it to be executable by executing these three cmds:

sudo mount -o rw,remount /

sudo cp ~/Downloads/script.sh /usr/bin/

sudo chmod 777 /usr/bin/script.sh

 

Once you've done that, you can fix device behavior each time you reboot by opening a shell (see #1 and 2 above) and simply running the cmd

script

It should only take a couple seconds if you use ctl+alt+t, and you can avoid all the complexity of a startup script.

Have more questions? Submit a request

3 Comments

  • Avatar
    Dan Atha

    When I try to use this and run script.sh after reboot, I get "command not found"
    I'm running an xinput command so it says "xinput: command not found"
    If I type in my xinput command right below the error, it works fine. Something is missing when running the .sh file. I tried adding sh in front of xinput but then got sh: command not found.
    Help.

  • Avatar
    SignedAdam

    @Dan Atha - Maybe you have to install Chromebrew!

    https://neverware.zendesk.com/hc/en-us/articles/216335208-Want-a-Package-Manager-Try-Chromebrew-

    then install xinput using Chromebrew!, just a guess

     

    when i run the command, I get "unable to connect to X server"

    Edited by SignedAdam
  • Avatar
    Anunay Jain

    @Dan Atha - You need to run these commands as chronos to do this :
    Type "shell" (without quotes)
    then it will ask for a password type "chrome"
    now you will be in shell type those commands to fine tune your device

Please sign in to leave a comment.
Powered by Zendesk