Let’s face it – Spaces, Leopard’s new virtual desktop implementation, isn’t as polished as many of us would like it to be. It has more than it’s share of undocumented features, bugs, and annoyances.
One of my personal gripes with spaces it’s lack of keyboard shortcuts for managing what Spaces calls “Application Assignments”. I’d like to be able to quickly assign an application to all Spaces with a quick keypress. Also – I often find myself hunting through my Spaces for 3 or 4 Safari windows I’ve left in various places – it’d be nice if there was an easy way to collect all windows of a given app on the current Space.
So, this morning, I sat down and started hacking at some Applescripts to do just that. After wading through the bizarre way that Application Assignments are stored, I ended up with 4 Applescripts:
- Assign to All Spaces – assigns the frontmost window to all spaces.
- Assign to Space X – opens an input dialog asking you which space to assign the frontmost window to.
- Collect on Current Space – brings all windows from the frontmost appliation to the current space.
- Remove Assignments – remove any appliaction assignments the frontmost window may have.
Here’s a zip file of all 4:
These scripts are designed to be invoked via a keyboard shortcut via Quicksilver or FastScripts.
If you have any corrects / additions / suggestions as to how to improve these scripts, drop ‘em in the comments!

Comments
Leave a response
Great work!
Any chance the assign to all spaces script could be implemented on a per window basis? I’m trying to use it for Adium, to have my buddy list be available on all spaces. But I don’t necessarily always want the chat windows available.
@Jim – Spaces works per-application, not per-windows. Sorry.
Very handy!
Thanks a lot for this.
@Jim – I had my Adium working that way by accident. Because it wasn’t what I wanted it was really annoying. Now I somehow have both in All Spaces, which is what I wanted, but I don’t know how I accomplished it or how you could reverse it to get what you are looking for, but I believe it CAN be done.
@Jim – It can be done because the Finder does it. The Finder desktop is on all spaces, but all other windows can be assigned to a particular space. The problem is that I suspect it’s not a publicly available method. I.e. only the FInder can do this… Which is pretty silly since there are other reasons an application might want to do this – as your suggestion shows.
I wonder if there’s a way to spread a given app’s windows according to task?
LIke I want to have Safari opened in every space, but I want separate windows in separate places.
In other words, I want Safari to live in every space, but with different Safari windows in each space.
Collect on Current Space FTW.
Awesome! Just got my first mac a few weeks ago and I’ve been grumbling about how Spaces is missing some pretty key management features.
Hooray! :D
That is fantastic. I’ve been lost without the keyboard shortcuts for assigning apps to different desktops that Virtue had. Thanks so much for taking the time to put these together.
As an old unix hack, I like to set up different sizes of terminals – with specific layouts, in different window manager desktops. For example: s1: coding – 3 terms side by side, each 102×80 s2: logs – 2 wide terms to watch nginx & rails dev.log stuff scroll by, nginx 315×29, rails 315×48 etc…
Perhaps I can drag terminals to different spaces, and carefully align ‘em one-by-one, but I’d rather just launch the ‘code’ window group in s1, and ‘log’ window group in s2. Particularly because my actual ‘standard’ window groups are a bit more complex than I sketched above. I’ve done this on unix desktops since sun’s openwindows in the early 90s…
I have the odd problem with some windows sticking to spaces & I’m not sure the Remove Assignments.scpt is always working correctly for me.
Is there somewhere I can trash the settings I’ve applied with the scripts?
Absolutely terrific! I was just starting to look for this function, and here it was! Well done and thank’s for sharing!
Hi Jesse,
I’m so glad you made those scripts but unfortunately the “Assign to Space” script won’t work for me.
I made a screenshot of the error message when invoking the script via FastScripts:
http://myskitch.com/halbtuerke/fastscripts_error_notice-20071223-000947.png
I hope you can help me.
Thanks in advance
Hi, I’m still looking for a script that just moves a window to a specific space.
Your “Assign to Space” is almost there, but I don’t want the app window to be tied to the selected space…
For example, if I have 3 Safari windows in a space and run your “Assign to space” script, all of the windows will be moved, while I want only the frontmost window to.
Is anything like that doable?
Xav: Thats built in. Just click and hold the title bar of the window you want moved and then press the key combo for the space you want it in. Fx: ctrl + 2.
Wonderful script! Great work man!
Any plans to create a script to backup all assigned application assignments to a file?
Helpful for transferring preferences to other accounts, etc.
Very useful!
Thank you for this!
I just tried these scripts out. Get this error message on using “Collect” script.
Error number: -1728 Message: Can’t get text 2 thru 0 of ”|:no-bundle:1498248036|:65544”.
I can’t figure out what this means but hope it can be fixed.
Thanks, Richard
Try rssnewsdigest.com, a new comprehensive news aggregator. With rssnewsdigest, you don ’t really have to go anywhere else. http://rssnewsdigest.com
thanks thats very useful.