Archive. This is an archive of the Apple Support Community. Discussions are being restored and soon you will be able to read and post here again.

Create a Shortcut to toggle macOS pointer size

How can I create a toggle pointer size shortcut?


I'm using macOS 27. I want to use Shortcuts to change the size of my pointer. I want to click once and it will change from normal to large. Then I want to click it again and the pointer will go back to the normal size.


The reason I want this is that I often take my laptop to a classroom with a large TV. I don't want to go into system settings, accessibility, display and change the pointer to large. That's 4 clicks. I want 1 click.

17 replies

You can achieve this using AppleScript. Based on this discussion on Reddit (https://www.reddit.com/r/applescript/comments/1mtuji0/script_to_toggle_pointer_size/), I wrapped the AppleScript code in a shortcut for the Shortcuts app. (You can actually use Automator without using Shortcuts to run this script but you may be more confortable with Shortcuts.)


Here is the shortcut: Toggle Large Pointer. When you run it, the pointer becomes large if it is small, or vice versa. I tested the shortcut in macOS Sequoia 15.8.1. I don't know if it works in later macOS releases.

Unfortunately, you cannot directly toggle the macOS pointer size with a native "Set Pointer Size" action inside the Apple Shortcuts app. macOS does not expose a single-click toggle command for the display cursor size because system preference settings like pointer scale do not have a direct API toggle in Shortcuts.


The Alternative Approach via Shortcuts and AppleScript

Because modifying com.apple.universalaccess via command-line defaults write does not dynamically refresh the live pointer size on your screen without a UI refresh, a pure background toggle is restricted by macOS security and accessibility layers. 


Instead, you can set up an Accessibility shortcut key or use the built-in macOS Shake mouse pointer to locate feature as a quick visual aid:


Shake to Enlarge (Built-in Alternative):

  • Go to Apple menu  > System Settings > Accessibility > Display.
  • Turn on Shake mouse pointer to locate.
  • Rapidly wiggle your finger on the trackpad or mouse to temporarily blow up the size of the pointer


Shake to Enlarge looks like this:


More info from Apple: Make the pointer easier to see on Mac - Apple Support


Quicker Access via Accessibility Shortcut Menu:

  • You can assign a keyboard shortcut to open Accessibility options directly by going to System Settings > Accessibility > Shortcut (at the bottom)

Could you take a screenshot of the System Settings > Accessibility > Display? (Try to capture the whole window.) I’m suspecting that macOS has changed the order or the number of elements in that window since macOS Sequoia. The script relies on a very specific presentation of the window.


I’ll see if I can pinpoint the differences.

Actually, this early a.m., the script got grumbly until I added a short delay right after frontmost.

use scripting additions

set pointerSize to {1.0, 2.0, 3.0, 4.0}

open location "x-apple.systempreferences:com.apple.Accessibility-Settings.extension?Display"

tell application "System Events"
	activate
	tell process "System Settings"
		set frontmost to true
		delay 0.5
		-- get entire contents of window 1
		set origSliderValue to value of (slider "Pointer size" of group 3 of scroll area 1 of group 1 of group 3 of splitter group 1 of group 1 of window "Display")
		log (origSliderValue) as number
		set value of (slider "Pointer size" of group 3 of scroll area 1 of group 1 of group 3 of splitter group 1 of group 1 of window "Display") to (item 3 of pointerSize)
		delay 5
		set value of (slider "Pointer size" of group 3 of scroll area 1 of group 1 of group 3 of splitter group 1 of group 1 of window "Display") to origSliderValue
	end tell
end tell
return



As for the GUI syntax, see that -- get entire contents of window 1 that is commented out? That dumps a monstrous amount of UI content from which one looks for slider "Pointer size" and then retrieves that long UI hierarchy.

The range of the pointer size slider is 1 - 4 in decimal or decimal fractions. Here is a GUI scripting solution that sets the pointer size on macOS Golden Gate 27.2 to a much larger size (e.g. 3.0). As with any GUI scripting solution, Apple can change System Settings UI Elements in the future that will break this code.


use scripting additions

set pointerSize to {1.0, 2.0, 3.0, 4.0}
 
open location "x-apple.systempreferences:com.apple.Accessibility-Settings.extension?Display"

tell application "System Events"
	activate
	tell process "System Settings"
		set frontmost to true
		-- get entire contents of window 1
		set origSliderValue to value of slider "Pointer size" of group 3 of scroll area 1 of group 1 of group 3 of splitter group 1 of group 1 of window "Display"
		set value of (slider "Pointer size" of group 3 of scroll area 1 of group 1 of group 3 of splitter group 1 of group 1 of window "Display") to (item 1 of pointerSize)
	end tell
end tell


echoda wrote:
How can I create a toggle pointer size shortcut?

FWIW, Where's My Mouse will do what you want and then some. It's free and compatible with Golden Gate.

I got this error when running the Toggle Large Pointer shortcut. I'm using macOS 27.


System Events got an error:

Can't get group 1 of group 2 of splitter group 1 of group 1 of window "Display" of application process "System Settings".

Invalid index.

SHOW OK

6x6 wrote:
Could you take a screenshot of the System Settings > Accessibility > Display? (Try to capture the whole window.) I’m suspecting that macOS has changed the order or the number of elements in that window since macOS Sequoia. The script relies on a very specific presentation of the window.
I’ll see if I can pinpoint the differences.

I am not the OP, but I hope this is useful:



Hi echoda, I looked at the screenshot Luis provided. I can't find any major difference in the presentation of the Accessibility > Display window but the error you see indicates that macOS modified the hierarchy of the controls in that window.


Unfortunately I won't be able to help you correct the script for macOS Golden Gate as I don't have a Mac running that version of macOS. I'll ping other AppleScript experts on this forum to see if they can intervene in this discussion.

Thanks to @VikingOSX's input, I've updated the shortcut to reflect the updated control hierarchy: Toggle Large Pointer (macOS Golden Gate). Please let us know if it works correctly as I can't test it.


As you might have realized by now, the AppleScript solution is fragile and it might break in a future release of macOS. (The Reddit discussion was itself a fix for macOS Sonoma.)


The solution offered by @MrHoffman might be as fragile as it relies on an undocumented Apple framework that Apple could change at any time.

Thanks, VikingOSX! The "get entire contents of window 1" is exactly what I was looking for. (I was making the mistake of running it from Automator, which does not yield anything as good as what Script Editor returns.)

echoda wrote:
I'm confused. Which solution works on macOS 27?

If you still want to pursue the Shortcuts solution, please see my 10/26 reply. It contains an updated link to a shortcut that should work in macOS Golden Gate 27 (thanks to VikingOSX’s assistance).

I don't want to shake to enlarge the mouse pointer. I want it to stay large until I want it to go back to normal size.

Thanks, Luis! This is what I was looking for.

I'm confused. Which solution works on macOS 27?

Where's My Mouse works with macOS 27.