I use a script It is run in a loop and adds the setting to the Templates, but you can change that and make it run on existing accounts. ${USER_TEMPLATE} is the variable from the loop.
# Mouse secondary button
/usr/bin/defaults write /Library/User\\ Template/${USER_TEMPLATE}/Library/Preferences/com.apple.driver.AppleHIDMouse.plist Button2 -int 2
I have no problem with this running on Monterey.
/usr/bin/defaults write /Users/<USER HOME>/Library/Preferences/com.apple.driver.AppleHIDMouse.plist Button2 -int 2
Should, if you replace <USER HOME> with a valid account, work just fine.
Thanks so much for the quick reply! This worked well for me - not sure why I found it so difficult. BTW, what do you mean by you have it run in a loop? Also, I have seen your solution for deleting existing local accounts and am looking forward to experimenting with it, it looks perfect for lab machines-
Thanks so much for the quick reply! This worked well for me - not sure why I found it so difficult. BTW, what do you mean by you have it run in a loop? Also, I have seen your solution for deleting existing local accounts and am looking forward to experimenting with it, it looks perfect for lab machines-
A loop will be something like this. This one would loop through all of the folders it finds in the /Users folder, and apply the setting to each one. You really need to refine the output of the ls command, because you want to ignore stuff like the Shared folder.
# Look for User accounts
Accounts=$(ls -l /Users | /usr/bin/awk '{print $9}' | /usr/bin/grep -viE '(shared|Guest|.DS_Store|.localized)')
for UserAccounts in $Accounts
do
/usr/bin/defaults write /Users/$UserAccounts/Library/Preferences/com.apple.driver.AppleHIDMouse.plist Button2 -int 2
done
A loop will be something like this. This one would loop through all of the folders it finds in the /Users folder, and apply the setting to each one. You really need to refine the output of the ls command, because you want to ignore stuff like the Shared folder.
# Look for User accounts
Accounts=$(ls -l /Users | /usr/bin/awk '{print $9}' | /usr/bin/grep -viE '(shared|Guest|.DS_Store|.localized)')
for UserAccounts in $Accounts
do
/usr/bin/defaults write /Users/$UserAccounts/Library/Preferences/com.apple.driver.AppleHIDMouse.plist Button2 -int 2
done
Ah, so this would be done for existing local accounts. I'm mainly concerned with having it enabled for each new user that logs into these public/lab machines - so I imagine the script alone will suffice.
Ah, so this would be done for existing local accounts. I'm mainly concerned with having it enabled for each new user that logs into these public/lab machines - so I imagine the script alone will suffice.
For the templates you would need something like
$(ls /Library/User\\ Template/ | grep -v "__" )
as the lookup bit of the loop
There are quite a few Templates, and whilst in theory just adding this to the non-localised one should work on its own, I throw it to them all.
# Look for User templates
Templates=$(ls /Library/User\\ Template/ | grep -v "__" )
for USER_TEMPLATE in $Templates
do
/usr/bin/defaults write /Library/User\\ Template/$USER_TEMPLATE/Library/Preferences/com.apple.driver.AppleHIDMouse.plist Button2 -int 2
done
Does this work only for the Apple mouse, we are using wired Logitech mice in our classroom.
It's worth a shot, I imagine right-click on any mouse triggers the same response in the OS, so it seems like it should?
Works on our wired Cherry mouses
Works on our wired Cherry mouses
Thank you, we are in session not a lot of options to test so I appreciate the feedback