Spaces Script Control Problem
Hey, everyone,
During work hours, I've enabled Spaces and assigned various apps to their own Spaces. However, I game off-hours, and I've found that the keyboard shortcuts I have set up for Exposé, Dashboard and Spaces interfere with my in-game controls. (I need the function keys free.)
Being kind've a nerd (*gasp*) I thought it'd be neat to set up an Automator action such that I could hit a button, and Exposé, Dashboard and Spaces would be disabled, saving me having to go to the System Preferences each time. And I've got one that mostly works.
I set up Automator to run a shell script, which contains the following:
defaults write com.apple.dock mcx-expose-disabled -bool true
defaults write com.apple.dashboard mcx-disabled -boolean YES
/usr/libexec/PlistBuddy -c 'Set :workspaces-app-bindings:com.apple.safari 1' /Users/MyUserName/Library/Preferences/com.apple.dock.plist
/usr/libexec/PlistBuddy -c 'Set :workspaces-app-bindings:com.apple.serveradmin 1' /Users/MyUserName/Library/Preferences/com.apple.dock.plist
/usr/libexec/PlistBuddy -c 'Set :workspaces-app-bindings:com.apple.mail 1' /Users/MyUserName/Library/Preferences/com.apple.dock.plist
/usr/libexec/PlistBuddy -c 'Set :workspaces-app-bindings:com.apple.itunes 1' /Users/MyUserName/Library/Preferences/com.apple.dock.plist
defaults write com.apple.dock workspaces -bool NO
killall Dock
The first two lines disable Exposé and Dashboard. The last two lines disable Spaces and restart the Dock to make the changes take place.
Here's the problem: occasionally, I want to be in "game-mode", but I'd still like to quickly check Mail, or look something up in Safari. However, when I try to launch, say, Safari, it opens the window in its assigned Space, despite the fact that Spaces is disabled - and of course, with Spaces disabled, I can't get to the window. Attempting to open a new window through various means just opens new windows off-screen.
I can go to System Preferences and toggle the "Enable Spaces" checkbox on and off again, and then the app windows show up properly, but this sort've defeats the purpose of scripting it in the first place.
The middle four lines of the code are an attempt to change the Space assignment for the apps in which I'm interested prior to disable Spaces. I know it works, because I've checked com.apple.dock.plist, and it does in fact properly change their Space assignment - but it does not have any effect.
Since I can toggle the Spaces checkbox and achieve what I desire, I can't help thinking that all I'm lacking is a way to make Spaces understand that the preferences have changed, or to reset it, or clear a cache, or whatever happens when things are changed via the preference pane.
I've been all over Google, but I can't seem to find any help. I'm hoping somebody here'll be able to help me out?
MacBook Pro, Mac OS X (10.6.7)