How do I configure 'Natural Scrolling' with an Apple Magic Mouse?

Solution 1:

Find the device ID of your magic mouse by doing:

xinput list

Then set the inverse scrolling by doing:

xinput set-button-map ID 1 2 3 5 4

(replacing ID with the ID of your device)

Solution 2:

In order to automatically change to natural scrolling in boot time, I did the following steps:

  1. I created a simple script, as follows:

    mouse_id=$(xinput list | grep 's Mouse' | egrep -o "[[:digit:]]{2}") 
    eval "$(xinput set-button-map $mouse_id 1 2 3 5 4)"
    
  2. I made a soft link in /bin directory

  3. Finally, I added this script to startup applications

After a restart it works perfectly.

My script is not perfect but it works. Maybe someone can suggest a better script for this or better approach. Fill free to edit my script. (I am using Ubuntu 12.04.)