Skip to content

Instantly share code, notes, and snippets.

@deepakmahakale
Created October 18, 2022 17:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deepakmahakale/36d5e4a09259983f700e9b2a29ab30c9 to your computer and use it in GitHub Desktop.
Save deepakmahakale/36d5e4a09259983f700e9b2a29ab30c9 to your computer and use it in GitHub Desktop.
Bash Script | Apple Script to toggle scroll direction
#!/bin/bash
osascript <<EOD
tell application "System Preferences"
(run)
set current pane to pane "com.apple.preference.trackpad"
end tell
tell application "System Events"
tell process "System Preferences"
delay 0.6
click radio button "Scroll & Zoom" of tab group 1 of window "Trackpad"
click checkbox 1 of tab group 1 of window "Trackpad"
end tell
tell application "System Preferences" to quit
end tell
EOD
@deepakmahakale
Copy link
Author

How To Use

  1. Copy this script to ~/toggle_scroll.sh
  2. Grant execute permission to toggle_scroll.sh
    chmod 755 ~/toggle_scroll.sh
  3. BONUS: make an alias for the script
    # Add this to ~/.bashrc or ~/.zshrc
    alias toggle_scroll='~/toggle_scroll.sh'

@deepakmahakale
Copy link
Author

deepakmahakale commented Oct 18, 2022

Alternatively, you can use it from the source

curl -s https://gist.githubusercontent.com/deepakmahakale/36d5e4a09259983f700e9b2a29ab30c9/raw/2e871271ff944140ca25efbe3d26b44221faa861/toggle_scroll.sh |  bash

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment