Spaces 'Application Assignments' and Applescript

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:

Spaces Applescripts

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!

Tweet - Update Twitter via Quicksilver

Tweet, a Twitter Quicksilver Action, is my favorite Twitter updating vehicle as of late – except for one thing. It uses Keychain Scripting to access your saved Twitterrific username and password – which, for some ungodly reason, takes about 30 seconds on my Mac Book Pro.

I’ve made some updates to Tweet.scpt to fix the slowness:

  • Now uses the Twitter Rubygem to talk to Twitter
  • Uses the username and password stored in ~/.twitter, via the Twitter Gem
  • Uses Twitterrific’s icon, if you have it installed.

Requirements

Installation Directions

  1. Download Tweet.scpt
  2. Move Tweet.scpt to ~/Library/Application Support/Quicksilver/Actions
  3. Restart Quicksilver (Cmd+Ctrl+Q)
  4. Setup a Trigger – I use Cmd+Opt+Ctrl+T :

This, combined with Twitter Monitor, is the way I’m using Twitter most often these days. Like it or not, I think Twitter has a lot of potential. I’d love to throw some AI at the trends of public twitters – you’d see the string “coffee” grow in popularity in the AM and wane in the PM. Add Geocoding support – a way to set your ‘Location’ as well as your status – and Twitter becomes useful in another dimension. I’m interested to see what Twitter has in it’s future.

Ruby and Quicksilver: Executing Ruby one-liners with Quicksilver

To plug Ruby directly into your brain, take three short breaths, mutter a prayer to Matz, and then follow these instructions:

Prerequisites: Mac OS X Panther or greater and Quicksilver

  1. Download this humble Applescript
    using terms from application "Quicksilver"
        on process text t
            do shell script "ruby -00 -e '" & t & "'"
        end process text
    end using terms from
  2. Unzip the script and copy it to ~/Library/Application Support/Quicksilver/Actions/
  3. Restart Quicksilver

Once you’ve plugged in, Ruby is just a blink away:

  1. Invoke Quicksilver (CTRL-Space)
  2. Type a period (.) followed by your one-line stroke of genius, such as:
    [ "in", "me", "plug" ].reverse_each {|x| print x.upcase, " " }
  3. Press TAB
  4. Type until ruby is displayed in the second pane
  5. Press Return

The results of your Ruby one-liner (‘PLUG ME IN’ in this case) are placed back into the first pane of Quicksilver for your digestion.

_Thanks to bsg for the inspiration. _