Jump to content

Recommended Posts

Posted

Hi,

 

I've found a script (below) to change the setting in Big Sur to enable the right mouse click on our 'magic' mice (the ones that you can't charge and use at the same time).

It runs perfectly fine, and changes the tick box in the system settings menu, but unless I toggle it manually, it doesn't take effect. (new users and existing users).

 

Is there anything else that I can add to make it work?

 

Many Thanks,

CP

 

#!/bin/sh# Turn on right-click for mouse and trackpadfor USER_TEMPLATE in "/Library/User Template"/*    do    if [ ! "${USER_TEMPLATE}" = "/Library/User Template/__permissions.plist" ]     then    /usr/bin/defaults write "${USER_TEMPLATE}"/Library/Preferences/com.apple.AppleHIDMouse.plist Button2 -int 2    /usr/bin/defaults write "${USER_TEMPLATE}"/Library/Preferences/com.apple.AppleMultitouchMouse.plist MouseButtonMode -string TwoButton    /usr/bin/defaults write "${USER_TEMPLATE}"/Library/Preferences/com.apple.AppleMultitouchTrackpad.plist TrackpadRightClick -int 1    /usr/bin/defaults write "${USER_TEMPLATE}"/Library/Preferences/com.apple.driver.AppleBluetoothMultitouch.trackpad.plist TrackpadRightClick -int 1    fi    donefor USER_HOME in /Users/*    do        USER_UID=`basename "${USER_HOME}"`        if [ ! "${USER_UID}" = "Shared" ]         then             if [ ! -d "${USER_HOME}"/Library/Preferences ]            then            mkdir -p "${USER_HOME}"/Library/Preferences            chown "${USER_UID}" "${USER_HOME}"/Library            chown "${USER_UID}" "${USER_HOME}"/Library/Preferences            fi            if [ -d "${USER_HOME}"/Library/Preferences ]            then                killall -u $USER_UID cfprefsd                /usr/bin/defaults write "${USER_HOME}"/Library/Preferences/com.apple.AppleHIDMouse.plist Button2 -int 2                /usr/bin/defaults write "${USER_HOME}"/Library/Preferences/com.apple.AppleMultitouchMouse.plist MouseButtonMode -string TwoButton                /usr/bin/defaults write "${USER_HOME}"/Library/Preferences/com.apple.AppleMultitouchTrackpad.plist TrackpadRightClick -int 1            chown "${USER_UID}" "${USER_HOME}"/Library/Preferences/com.apple.AppleMultitouchMouse.plist            chown "${USER_UID}" "${USER_HOME}"/Library/Preferences/com.apple.AppleMultitouchTrackpad.plist            chown "${USER_UID}" "${USER_HOME}"/Library/Preferences/com.apple.AppleHIDMouse.plist            chown "${USER_UID}" "${USER_HOME}"/Library/Preferences/com.apple.driver.AppleBluetoothMultitouch.trackpad.plist            fi        fidone

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...