programatically changing pointer size

[ laptop M2 with Ventura ]

I would like to set the pointer (cursor) by script.

It should work with a terminal command like

defaults write com.apple.universalaccess.plist mouseDriverCursorSize 4

which sets that value, but the cursor size on screen does not change. However

defaults read com.apple.universalaccess.plist mouseDriverCursorSize

does return the currently set value, whether I set it in the System Settings→Accessibility→Display→Pointer size, or whether I use the terminal command.

But the actual size as displayed only changes if I do it via the System Settings.


Anybody know how to do it by script?

Posted on Nov 12, 2023 12:16 PM

Reply
Question marked as Top-ranking reply

Posted on Nov 13, 2023 04:53 AM

RobertCailliau wrote:

When I give a presentation, I like the pointer to be large, so the audience can see at what I'm pointing (IFF I need to do so). Laser pointers are no good on modern very large LED displays in bright daylight.

An easier solution would be to setup a dedicated user account for your presentations. Set the pointer to be as big as you want. Then, when you want to give a presentation, copy it over to the other account, and just switch to that user. As a side benefit, you don't have to worry about anyone seeing your desktop. You can have everything neat, tidy, and branded however you want it.

Similar questions

11 replies
Question marked as Top-ranking reply

Nov 13, 2023 04:53 AM in response to RobertCailliau

RobertCailliau wrote:

When I give a presentation, I like the pointer to be large, so the audience can see at what I'm pointing (IFF I need to do so). Laser pointers are no good on modern very large LED displays in bright daylight.

An easier solution would be to setup a dedicated user account for your presentations. Set the pointer to be as big as you want. Then, when you want to give a presentation, copy it over to the other account, and just switch to that user. As a side benefit, you don't have to worry about anyone seeing your desktop. You can have everything neat, tidy, and branded however you want it.

Nov 12, 2023 03:12 PM in response to RobertCailliau

I realize the internet is chock full of instructions to use the "defaults" command to script changes to system settings. However, that was wrong the very first time it was proposed and every time since.


Let's assume that cursor size setting actually is the correct defaults value. None of this is documented, but you can easily determine these values by checking all defaults settings, making some change, and then checking all defaults settings again.


The defaults architecture is not just those persistence files on disk. Neither hacking up the plist files directly, nor using the "defaults" command is sufficient to make the change. You must also kill the appropriate "cfprefsd" task for that particular setting. Most people typically kill them all.


But you are still not done yet. Just because you've changed the persisted value, and updated the preferences tasks, that doesn't mean that the appropriate system processes are going to query those default settings and change their behaviour, by drawing a bigger cursor, for example. It is possible that they check for changes, but not guaranteed or likely. It is also possible they respond to a sighup signal à la the original Unix design, but that is also neither guaranteed nor likely. The only sure-fire way is to kill the process and get it restarted. Now you're in another pickle. There are hundreds of system processes and there is no way to tell which one is responsible for any given preference setting. There may be multiple processes. Again, none of this is documented in any way. In most cases, you can simply log out the current user. Sometimes you might have to restart the entire device. Technically this scriptable, but it may not be what you want. Such is life.


Note that any time you see anything posted on the internet about any topic, there is a similar set of caveats that describes how it all actually works.

Nov 12, 2023 11:39 PM in response to etresoft

Thanks, I suspected indeed that some daemon somewhere had to be told to actually look at the new setting.

Applescript was totally useless and horribly complex (GUI scripting… ) but should have worked.

Anyway, I have solved it using Keyboard Maestro: activate System Settings, set its window large enough, then do mouse clicks at the right places, close System Settings. This will of course go wrong as soon as Apple once more changes the interface layout, but at least it works now. And it is also linked to a keystroke (I chose control-shift-option-command-uparrow, but that choice is irrelevant)

Nov 12, 2023 11:46 PM in response to dialabrain

Of course I'm aware of the shaking bit, but it's not what I want.

When I give a presentation, I like the pointer to be large, so the audience can see at what I'm pointing (IFF I need to do so). Laser pointers are no good on modern very large LED displays in bright daylight.


Yes, not very often. My old scripts stopped working when I changed to Ventura (what did not stop working in Ventura?… ). But as said, Keyboard Maestro did the job. After having wasted a whole afternoon with GUI scripting.


So, all set for now.

Nov 13, 2023 07:03 AM in response to etresoft

I appreciate a dedicated account might work for many people, but it would be a terribly complex solution in my case.


That is because I gave up on proprietary document formats way back in 1994. I activated a web server on my machine. Instead of Word or Pages, I use HTML + CSS; instead of Illustrator or Inkscape I use SVG, and instead of Powerpoint or Keynote, I use Baratin, a trial-making program I wrote. Therefore, almost all my documents are maintained with web technologies. Admittedly, I never found a good alternative to a spreadsheet, but with a friend I'm working on something even better than Numbers and web+JavaScript based.


For presentations I keep all "slides" as independent topic pages in HTML. They adapt to any screen size and changing the "skin" is also easy (CSS!). The total of "slides" thus produced now stands at over 6'000. They are filed in a "repository", like an encyclopaedia, by subject matter. Thus, to make a presentation, I use my Baratin program to first select the language (many slides exist in English, Dutch and French), then select the slides I want to show, and finally order them in the sequence and tree-structure that I want. And most often I have to write a few new ones too. Baratin then produces a "trail", which is an HTML page with the links to the chosen pages in the repository, plus some links to shared CSS and JavaScript. The server then puts up a number of windows (pop-up blocking has to be switched off of course) which provide two views on the current slide, one on the next one, the one down in the tree, some controls, etc. One of the views on the current slide is shifted to the projector or other screen seen by the audience, the rest remains on my laptop screen, so I also never use mirroring, and my desktop is never on the audience view. The JavaScript uses clicks on control buttons or the arrow keys to walk the tree structure to show the slides (or skip branches of the tree, instantly go back to any chosen slide, and so on).

This setup allows me to re-use slides without making copies, to use them in any sequence, and even, if desired, to mix in other documents. If I spot an error, any correction I make is immediately reflected in all presentations that include that slide in their trail tree.


So I would have to put the whole system on that dedicated user account, and then I would still need to set the cursor to small when I'm working on it, and large during a presentation.


Now you are going to say that I might just share my Documents folder with that other account, and that is correct, but it would still mean a lot of twiddling (not to mention what needs to be done for the web server).


The solution I currently have is perfectly OK.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

programatically changing pointer size

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.