AppleScript to Toggle Desktop Widgets

I’m a fan of the new Sonoma Desktop Widgets. However, I also make a living making screencasts and having all those widgets on screen can sometimes be a pain. There is a setting you can toggle under the Desktop & Dock settings:

The problem with this, of course, is that it’s a pain in the neck to get there. Who wants to do all that mousing and clicking? I wanted to automate this button so I can run a script that sets me up for screencasting and, among other things, turns off Desktop Widgets. So here’s a script that does just that. This was built with help from the AppleScript Sensei himself, Sal Soghoian. Below is a link to the zipped script file, as well as the script in plain text. I run it as part of a Keyboard Maestro macro that I’ve tied to a keyboard trigger. Enjoy.


tell application "System Settings"
	activate
	reveal anchor "Widgets" of pane id "com.apple.Desktop-Settings.extension"

	repeat
		set currentPane to get current pane
		if currentPane is pane id "com.apple.Desktop-Settings.extension" then
			exit repeat
		else
			delay 1
		end if
	end repeat
end tell

delay 1

tell application "System Events"
	tell process "System Settings"
		set targetControl to checkbox "Show Widgets" of group 6 of scroll area 1 of group 1 of group 2 of splitter group 1 of group 1 of window 1
		click targetControl
	end tell
end tell

tell application "System Settings" to quit

Apple’s Successful Beta Season

Hooray! It’s macOS Sonoma release day. This new operating system has some great features, including better dictation, small (but nice) improvements to the Apple productivity apps (Kanban in Reminders!), a bunch of messaging and video conferencing updates, PDF tools, and desktop widgets. Stephen and I will cover them in depth on this weekend’s episode of the Mac Power Users.

But there is a more significant point here. Apple had an extraordinarily successful beta season in 2023. They promised some solid updates in June at WWDC and delivered on them from the beginning. None of the new features required a “boil the ocean” effort by Apple, but all of them provided a lot of bang-for-the-buck, quality-of-life improvements.

Moreover, they got it all out with very little drama. They didn’t have to delay the iPadOS launch until weeks (or months) after the iOS release. Moreover, this macOS version is shipping just a week after the iPhone. At the same time, they are also going full tilt at an entirely new operating system with visionOS.

I am impressed with the effort all of that took. I would love to know the story behind all of this. I’ve got four pet theories, none of which have a lick of evidence:

Apple is getting better at this

They’ve been updating multiple major operating systems for over a decade now. I expect they’ve learned quite a bit.

Labor and Management Improvements

That experience also gives management a better idea of what to expect and aim for while giving engineering a better idea of what they can pull off in the time allotted.

A Lot of the Heavy Lifting is Behind Them

Apple has taken on some big tasks over the past decade as they’ve moved to SwiftUI and made significant architectural changes to the programming interface and the chipset. All of that is behind them now, which should make things easier from this point.

Forced Constraints

This theory is probably a stretch, but I think the fact that Apple has looming deadlines related to visionOS gave the company even more focus across the board. That showed up in the decisions and work done on everything else.

I expect all of these factors (and probably a few more) played a role in Apple’s success this year, but I hope their management is paying attention and figuring out how to make this the new norm.

Discover the New PDF Fill-in Feature in macOS Sonoma (MacSparky Labs)

Filling in PDF forms just got a lot easier on the Mac. This new feature reliably and quickly adds fill-in fields to your PDFs in Preview and Apple Notes.…

This is a post for MacSparky Labs Level 3 (Early Access) and Level 2 (Backstage) Members only. Care to join? Or perhaps do you need to sign in?