4

I’m looking for a command (defaults write …) to enable right-click by tapping the bottom right Trackpad corner.

This can be enabled as follows: System PreferencesTrackpadPoint & Click → enable Secondary click and select “Click in bottom right corner”.

However, I’m looking for a way to do this programmatically.

More details

To find out which settings to modify using the defaults command, I usually do something like this…

  1. Disable the desired setting in System Preferences and close the preference pane.
  2. Then:

    cd /tmp
    defaults read > before
    
  3. Then, change the setting in System Preferences and close the preference pane. 4.

    defaults read > after
    diff before after
    

A long time ago (I think it was still on Snow Leopard) this brought up the following solution:

# Map bottom right Trackpad corner to right-click
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadCornerSecondaryClick -int 2
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadRightClick -bool true

However, it seems like there’s more to it than just these two settings. I’ve tried disabling the setting in System Preferences, then running these commands, then logging out and back in again, but it had no effect.

1

1 Answer 1

4

I spent some more time debugging this, and it seems there are multiple setting locations (on multiple hosts) for the same setting.

AFAICT, each user gets his own host. The login screen uses a separate host. It makes sense to enable some settings (like Trackpad tap to click) for both these hosts.

Furthermore, OS X seems to have separate settings for Magic Trackpads and built-in MacBook Trackpads. The commands in my question only enable the Magic Trackpad settings.

Now, I try to enable it everywhere:

# Map bottom right Trackpad corner to right-click
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadCornerSecondaryClick -int 2
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadRightClick -bool true
defaults -currentHost write NSGlobalDomain com.apple.trackpad.trackpadCornerClickBehavior -int 1
defaults -currentHost write NSGlobalDomain com.apple.trackpad.enableSecondaryClick -bool true
defaults -currentHost write -globalDomain com.apple.mouse.tapBehavior -int 1

Note that a logout/login or restart may be required (which forces Track-pad's background-service aka demon to reload settings).

2
  • FTR, these commands (followed by a reboot) seemed to work fine on a clean OS X 10.8 Mountain Lion install. Commented Jul 27, 2012 at 10:25
  • @MathiasBynens, I didn't need this exact preference but I ended up borrowing quite a few things from your .macos file, thank you!
    – Matt
    Commented Aug 3, 2022 at 21:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .