Make the mouse wheel in Ubuntu behave like Mac OSX

30 November 2012 — 5 Comments

I’m used to my Mac where the direction of scrolling was changed to a more ‘natural’ way starting with OSX Lion. It’s the same way scrolling works on mobile devices. When working on Ubuntu, I want to have the same behaviour because I’m used to it.

To do so you need to edit (or create) the .Xmodmap file in your homedir.

This is the default:

cat ~/.Xmodmap
pointer = 1 2 3 4 5

I changed it to:

vim ~/.Xmodmap
pointer = 1 2 3 5 4

This essentially makes the last two (scroll wheel) buttons work the other way around, and that is exactly the behaviour I want.

To enable this setting you have to either logout (and back in) of your X environment, or run this oneliner (Thanks James!):

xmodmap -e "pointer = 1 2 3 5 4"

By editing both the Xmodmap file and running the above oneliner, the new setting works immediately and also keeps working when you (for example) reboot your machine.

5 responses to Make the mouse wheel in Ubuntu behave like Mac OSX

  1. 

    There is no file in that directory with that name in Ubuntu 12.04, and adding one with the parameters pointer = 1 2 3 5 4 doesn’t appear to make a difference. Perhaps you might consider expanding this to include all of the steps and specify what version of Ubuntu you’re using and what hardware you’ve tested this on.

    I didn’t reboot, which I’m assuming **may** reload whatever is involved in controlling the mouse; however, without knowing for sure, I’m willing to simply wait until I’m forced to reboot to test this out as to not disrupt my current work. The mouse scroll effect isn’t **that** important to me, but this advice may help improve your post and make it more useful to others.

    Hope this helps!

    James

  2. 

    Hello,

    I just wanted to follow up. (Posted a comment before but it never showed up…) Anyway, the changes you posted worked great after a reboot. The power went out, forcing me to reboot, and the scrolling reversed on me, and I realized that Ubuntu was now behaving EXACTLY as the Mac! Success!

    Additionally, I found something you could include in your blog article for those who want to also see the changes take effect immediately:

    xmodmap -e “pointer = 1 2 3 5 4”

    Run that command on the terminal, and it will reconfigure the scroll for the existing session. Folks will still need to edit the .Xmodmap file though as per your instructions in order to persist from reboot to reboot.

    Thanks again for your post,
    James Mortensen

    • 

      Hi James,

      Thank you for your posts and sorry I wasn’t able to come back to you any sooner. You’re right, rebooting enables the new setting. Although logging out and back in also does the trick. Cool you found an even easier way by using that xmodmap oneliner. I’ll update my post with this info.

      Thanks again!

      Remi

  3. 

    This still works great for ubuntu 14.04. The mouse scroll was driving me crazy when switching between mac and linux machines throughout the day. =)

  4. 

    Works in 16.04 too!!

Leave a reply to James Mortensen Cancel reply