Skip to content

Commit 1ebc35d

Browse files
Raphael-KRdehesa
authored andcommitted
Add natural scrolling toggle script for macOS 15.6.1+
- Fix: Original script fails on macOS 15+ with domain error - Uses .GlobalPreferences domain instead of NSGlobalDomain - Tested on macOS 15.6.1 (24G90) - Includes GUI fallback method for compatibility - Maintains backward compatibility messaging
1 parent 6cea785 commit 1ebc35d

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
#!/usr/bin/osascript
2+
3+
# Required parameters:
4+
# @raycast.schemaVersion 1
5+
# @raycast.title Toggle Natural Scrolling (macOS 15+)
6+
# @raycast.mode silent
7+
# @raycast.packageName System
8+
9+
# Optional parameters:
10+
# @raycast.icon 🖱
11+
# @raycast.author Raphael-KR
12+
# @raycast.authorURL https://github.com/Raphael-KR
13+
# @raycast.description Toggle natural trackpad/mouse scrolling setting for macOS 15.6.1+
14+
15+
set macVersion to system version of (system info)
16+
17+
if macVersion is greater than or equal to "15" then
18+
try
19+
set isNaturalScrolling to (do shell script "defaults read .GlobalPreferences 'com.apple.swipescrolldirection' 2>/dev/null || echo '1'")
20+
21+
if isNaturalScrolling is "1" then
22+
do shell script "defaults write .GlobalPreferences 'com.apple.swipescrolldirection' -bool NO"
23+
display notification "Natural Scrolling: OFF" with title "Trackpad Settings"
24+
else
25+
do shell script "defaults write .GlobalPreferences 'com.apple.swipescrolldirection' -bool YES"
26+
display notification "Natural Scrolling: ON" with title "Trackpad Settings"
27+
end if
28+
29+
do shell script "/System/Library/PrivateFrameworks/SystemAdministration.framework/Resources/activateSettings -u"
30+
31+
on error e
32+
display notification "Using GUI method as fallback" with title "Trackpad Settings"
33+
34+
tell application "System Settings"
35+
activate
36+
set current pane to pane "com.apple.preference.trackpad"
37+
end tell
38+
39+
delay 0.6
40+
41+
tell application "System Events"
42+
tell process "System Settings"
43+
click radio button 2 of tab group 1 of window "Trackpad"
44+
click checkbox 1 of tab group 1 of window "Trackpad"
45+
end tell
46+
end tell
47+
48+
tell application "System Settings" to quit
49+
end try
50+
51+
else
52+
display notification "For macOS 14 and earlier, use the original script" with title "Compatibility Note"
53+
54+
tell application "System Settings"
55+
activate
56+
set current pane to pane "com.apple.preference.trackpad"
57+
end tell
58+
59+
delay 0.6
60+
61+
tell application "System Events"
62+
tell process "System Settings"
63+
click radio button 2 of tab group 1 of window "Trackpad"
64+
click checkbox 1 of tab group 1 of window "Trackpad"
65+
end tell
66+
end tell
67+
68+
tell application "System Settings" to quit
69+
end if

0 commit comments

Comments
 (0)