1

I want to toggle natural scrolling without using third-party software, as is done here and here. However, these scripts no longer work in macOS Sonoma 14.0 because the layout of the System Settings application has changed.

This is not a duplicate of similar older questions. Those questions have solutions that work on older versions of macOS, but that do not work on Sonoma. Please do not mark this question as a duplicate.

2 Answers 2

2

After a lot of trial and error, I finally managed to make a script that works in Sonoma. Try this:

-- Open trackpad settings
open location "x-apple.systempreferences:com.apple.Trackpad-Settings.extension"

tell application "System Events"
    tell application process "System Settings"
        tell group 1 of group 2 of splitter group 1 of group 1 of window 1
            
            -- Select "Scroll & Zoom" tab
            repeat until tab group 1 exists
                delay 0
            end repeat
            tell tab group 1
                click radio button 2
            end tell
            
            -- Toggle "Natural scrolling" flag
            repeat until group 1 of scroll area 1 exists
                delay 0
            end repeat
            tell group 1 of scroll area 1
                click checkbox 1
            end tell
            
            delay 0.1
            tell application "System Settings"
                quit
            end tell
            
        end tell
    end tell
end tell
1
  • This is perfect! Thank you for taking the time to share this. Feb 15 at 17:19
0

That's the problem with GUI scripting that automates human actions moving the pointer, rather than scripting the actual command required. If the UI changes, the script breaks.

Have you tried using:

defaults write -g com.apple.swipescrolldirection -bool NO

in the Terminal? You'll need to log out and back in to see the result.

1
  • Unfortunately logging out and logging back in every time I plug in a mouse defeats the purpose of automating this: saving time. Nov 15, 2023 at 20:25

You must log in to answer this question.

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