10.5: Toggle Spaces on and off via AppleScript

I use a big external monitor at work, and carry my MacBook around. I've found that Spaces is not much needed when I have two monitors rather than one. However, bringing up Spaces System Preferences panel just to toggle Spaces on and off is a pain. So I wrote a small AppleScript that toggels Spaces on and off: if (do shell script "defaults read com.apple.dock workspaces") is equal to "1" then do shell script "defaults write com.apple.dock workspaces -bool no;killall Dock" say "Space turned off" else do shell script "defaults write com.apple.dock workspaces -bool yes;killall Dock" say "Space turned on" end if

published on Friday, the 1. August 2008, macosxhints