Wednesday, July 30, 2008

Applescript for Space on/off

If you are using Macbook or MBP with big external monitor, you might find that you don't need Space in dual monitor setting.  However, when you find yourself without big shiny monitor, you would miss Space again.

Turning on/off from Space Preference pane every time can be very painful for most of us.

Here is the applescript i am using. This is my first script and i think that i am going to like applescript a lot.

if (do shell script "defaults read workspaces") is equal to "1" then

do shell script "defaults write workspaces -bool no;killall Dock"

say "Space turned off"


do shell script "defaults write workspaces -bool yes;killall Dock"

say "Space turned on"

end if

You can use Script Editor to use the script above or you can download little app i made for myself with growl notification and voice prompt.

Download Space Toggler here