0

I spend the first 45 minutes of my workday walking 4.7 mph on my treadmill which requires a very mellow mouse experience or every click turns into a drag. I can manually change the mouse tracking speed and turn off the pointer acceleration, but I prefer some automation in the way of a script I can trigger from Raycast. So, I captured the changes in the preferences via defaults read before and after differences and created this script.

#!/bin/bash

# Set mouse settings for walking on treadmill or stationary at desk. Argument starting with t == treadmill
# Must change the defaults and then get them reloaded for them to take effect in the current session.

indicator=${1:0:1}

if [ "$indicator" == 't' ]; then
   defaults write 'Apple Global Domain' com.apple.mouse.linear 1
   defaults write 'Apple Global Domain' com.apple.mouse.scaling 0
else
   defaults write 'Apple Global Domain' com.apple.mouse.linear 0
   defaults write 'Apple Global Domain' com.apple.mouse.scaling 0.5
fi

# Reload the preferences
/System/Library/PrivateFrameworks/SystemAdministration.framework/Resources/activateSettings -u

This worked flawlessly for a few weeks. But then about 2 weeks ago it stopped working, maybe due to an IT dept change on my machine. I am stumped. The behavior I now observe is this:

  1. Giving the "t" argument to the script changes the pointer acceleration such that I can read back the defaults and see it is changed to a value of 1. However, The GUI interface shows it is not set to linear. If I manually change it via the GUI, the difference is apparent.
  2. When I have it manually set and run the script without the "t", it succeeds in turning acceleration back on.

So, the automated way of turning acceleration on succeeds, but turning it off fails. I have, of course, repeated my process of seeing if there are any other changes in the defaults with the GUI change and I found nothing new.

Suggestions are appreciated.

HW = 16" MacBook Pro 2023, Apple M2 Pro

0

You must log in to answer this question.

Browse other questions tagged .