Skip to content

Instantly share code, notes, and snippets.

@jeremy4971
Last active January 6, 2024 10:30
Show Gist options
  • Save jeremy4971/4b4b86f58cb28dbb526716b086a5dc10 to your computer and use it in GitHub Desktop.
Save jeremy4971/4b4b86f58cb28dbb526716b086a5dc10 to your computer and use it in GitHub Desktop.
#!/bin/bash
###
#
# Created : 2022-12-29
# Last Modified : 2022-12-29
# Version : 1.0
# Tested with : macOS 13.1
#
###
# Several settings need a computer restart to be effective.
# Read logged in user
loggedInUser=$(scutil <<< "show State:/Users/ConsoleUser" | awk '/Name :/ && ! /loginwindow/ { print $3 }')
echo "Coucou, je suis $loggedInUser"
# Show language menu in the top right corner of the login screen
defaults write /Library/Preferences/com.apple.loginwindow showInputMenu -bool true
# Show the input sources in the desktop menu bar
sudo -u $loggedInUser defaults write com.apple.TextInputMenu visible -bool true
# Add the additional input source to the list of input sources
sudo -u $loggedInUser defaults write com.apple.HIToolbox AppleEnabledInputSources -array-add '<dict><key>InputSourceKind</key><string>Keyboard Layout</string><key>KeyboardLayout ID</key><integer>1111</integer><key>KeyboardLayout Name</key><string>French - numerical</string></dict>'
# Disable force click and haptic feedback
sudo -u $loggedInUser defaults write com.apple.AppleMultitouchTrackpad ForceSuppressed -int 1
# Enable Look up and data detectors : tap with 3 fingers
sudo -u $loggedInUser defaults write com.apple.AppleMultitouchTrackpad TrackpadThreeFingerTapGesture -int 2
sudo -u $loggedInUser defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadThreeFingerTapGesture -int 2
# Enable right click on Magic Mouse
sudo -u $loggedInUser defaults write com.apple.AppleMultitouchMouse MouseButtonMode -string "TwoButton"
sudo -u $loggedInUser defaults write com.apple.driver.AppleBluetoothMultitouch.mouse MouseButtonMode -string "TwoButton"
# Primary click : Press with one finger
sudo -u $loggedInUser defaults write com.apple.AppleMultitouchTrackpad Clicking -bool false
sudo -u $loggedInUser defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool false
sudo -u $loggedInUser defaults -currentHost write 'Apple Global Domain' com.apple.mouse.tapBehavior 0
sudo -u $loggedInUser defaults write NSGlobalDomain com.apple.mouse.tapBehavior -int 0
# Primary click : Tap with one finger
sudo -u $loggedInUser defaults write com.apple.AppleMultitouchTrackpad Clicking -bool true
sudo -u $loggedInUser defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool true
sudo -u $loggedInUser defaults -currentHost write 'Apple Global Domain' com.apple.mouse.tapBehavior 1
sudo -u $loggedInUser defaults write NSGlobalDomain com.apple.mouse.tapBehavior -int 1
# Secondary click : With two fingers
sudo -u $loggedInUser defaults write com.apple.AppleMultitouchTrackpad TrackpadCornerSecondaryClick -int 0
sudo -u $loggedInUser defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadCornerSecondaryClick -int 0
sudo -u $loggedInUser defaults write com.apple.AppleMultitouchTrackpad TrackpadRightClick -bool true
sudo -u $loggedInUser defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadRightClick -bool true
sudo -u $loggedInUser defaults -currentHost write 'Apple Global Domain' com.apple.trackpad.trackpadCornerClickBehavior -int 0
sudo -u $loggedInUser defaults write NSGlobalDomain com.apple.trackpad.trackpadCornerClickBehavior -int 0
sudo -u $loggedInUser defaults -currentHost write 'Apple Global Domain' com.apple.trackpad.enableSecondaryClick -bool true
sudo -u $loggedInUser defaults write NSGlobalDomain com.apple.trackpad.enableSecondaryClick -bool true
# Secondary click : Click in bottom-right corner
sudo -u $loggedInUser defaults write com.apple.AppleMultitouchTrackpad TrackpadCornerSecondaryClick -int 2
sudo -u $loggedInUser defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadCornerSecondaryClick -int 2
sudo -u $loggedInUser defaults write com.apple.AppleMultitouchTrackpad TrackpadRightClick -bool false
sudo -u $loggedInUser defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadRightClick -bool false
sudo -u $loggedInUser defaults -currentHost write 'Apple Global Domain' com.apple.trackpad.trackpadCornerClickBehavior -int 1
sudo -u $loggedInUser defaults write NSGlobalDomain com.apple.trackpad.trackpadCornerClickBehavior -int 1
sudo -u $loggedInUser defaults -currentHost write 'Apple Global Domain' com.apple.trackpad.enableSecondaryClick -bool false
sudo -u $loggedInUser defaults write NSGlobalDomain com.apple.trackpad.enableSecondaryClick -bool false
#Scrolling : Natural
sudo -u $loggedInUser defaults write NSGlobalDomain com.apple.swipescrolldirection -bool true
#Scrolling : Alternative
sudo -u $loggedInUser defaults write NSGlobalDomain com.apple.swipescrolldirection -bool false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment