One-Click Dashboard Control/Freeware

The script below expands Ptulec’s 2010 revision of Adam Bell’s 2005 toggle dashboard script (in Code Exchange). It presents three buttons, Overlay, As Space and Off. Rather than toggle the dashboard state (after which you have to click into Dashboard to launch widgets – or whatever), one click to the dialog box and the widgets are launched straightaway. Similar to the prior scripts, “Off“ disables Dashboard (doesn’t only toggle dashboard to ‘Off’ in Mission Control).


do shell script "defaults write com.apple.dashboard mcx-disabled -boolean NO"
quit application "Dock"

tell me to activate
set SwitchDashboard to display dialog "                                                                                                      Change State of Dashboard?" buttons {"As Space", "As Overlay", "Off"} default button "Off" with title "Toggle Dashboard"

if button returned of result is "Off" then
	do shell script "defaults write com.apple.dashboard mcx-disabled -boolean YES"
	quit application "Dock"
	
else if button returned of result is "As Space" then
	tell application "System Preferences"
		set the current pane to pane id "com.apple.preference.expose"
		tell application "System Events"
			tell process "System Preferences"
				tell group 2 of window 1
					click pop up button 1
					click menu item "As Space" of menu 1 of pop up button 1
					tell application "System Preferences" to quit
					
					ignoring application responses
						tell application "Dashboard"
							activate
						end tell
					end ignoring
					
				end tell
			end tell
		end tell
	end tell
	
else if button returned of result is "As Overlay" then
	tell application "System Preferences"
		set the current pane to pane id "com.apple.preference.expose"
		tell application "System Events"
			tell process "System Preferences"
				tell group 2 of window 1
					click pop up button 1
					click menu item "As Overlay" of menu 1 of pop up button 1
					tell application "System Preferences" to quit
					
					ignoring application responses
						tell application "Dashboard"
							activate
						end tell
					end ignoring
					
				end tell
			end tell
		end tell
	end tell
end if

(Tested on 10.10.5 and 10.12. My guess (although I don’t know) is that it also works on 10.11 and High Sierra as well.)

More efficient than the above, are simple standalone apps. I put an Overlay and Off app in Applications and throw them in the dock - when I’m testing. This way, one click on the Overlay icon in the dock and widgets are launched to the desktop.

If anyone wants to download the Overlay, Space, Off or Toggle apps, feel free: They’re here:

www.digitalmiracles/freeware.html

If you just want the scripts, the apps aren’t run-only. Feel free. (Btw, if you download the apps, Accessibility will nag you)

I got into this because I needed to launch a standalone widget as part of a larger piece of software I’m finishing. Part of my problem was to figure out a way to use applescript to toggle the user’s dashboard into desktop mode, no matter what state dashboard happens to be in, on the user’s machine (which the overlay app does).

I hope to reach out later - and ask a question about this. I’ve licked most of my problem except one part…but later for that…thanks much