26 Comments

Summary:

Many of us are hip to Twitter these days, and there are a myriad of options for keeping track of the resulting tweets. I personally bounce between the webpage itself and Tweetdeck (while on my Mac). But sometimes I want to trim down my open windows […]

twitter

Many of us are hip to Twitter these days, and there are a myriad of options for keeping track of the resulting tweets. I personally bounce between the webpage itself and Tweetdeck (while on my Mac). But sometimes I want to trim down my open windows to the bare minimum. Here’s one way to keep up with your Twittering, without having any windows open.

Twitter w/o Windows

Twitter w/o Windows

You’ll need Geek Tool to monitor incoming tweets. (Geek Tool is a free utility that runs as a Preference Pane and lets you embed shell output, URLs, and more in your desktop.) I set up a new Shell Command entry, with the following command (all on one line):

curl -s -u username:password http://twitter.com/statuses/friends_timeline.rss | grep title | sed -e 's// /' | sed 's// /' | sed 's/ //'

This command uses the shell command curl to pull the RSS update feed of those you follow. Be sure to substitute username:password with your own Twitter credentials. The sed commands mainly perform a find and replace to clean up the output, removing html title tags and leading spaces. If you’re looking for more information on the curl and sed commands, pop open your Terminal.app (/Applications/Utilities), and type man curl or man sed for the manual of usages for each. Geek Tool offers other customizations like font and positioning on screen so play until you find your sweet spot.

Using either Quicksilver or Google’s Quick Search Box (Quicksilver’s new sibling), will allow you to post tweets easily without a client app front and center. With either, you can quickly invoke the input window, type your 140 characters, and send it off to Twitter — and like that, the interface vanishes until you need it again. Using Quicksilver requires that you download an Applescript which gives you a ‘Tweet’ action, and then modify a Keychain setting for your Twitter login credentials — the latter can be a bit messy for a novice. Quick Search Box is much easier in comparison, only asking you to add your Twitter account details in one of the preference windows. Once you’ve setup Quicksilver or Quick Search Box, invoke the interface, type your Tweet, and send it off. Easy peezy, lemon squeezy.

This setup may not be useful for everyone, but it is nice when you want minimal interference while you work. I’m quickly finding this interface to be my preferred mode of interaction with Twitter.The GeekTool/Quick Search Box (or Quicksilver) combo do nicely to sit in the background until you’re ready, and then fade back out as soon as you’re through with them.

Update

Two TAB readers were kind enough to provide some modified code that are a bit cleaner than what I posted and are tweaked a bit to their liking.

Scott: “Here is the updated code that I’m using, which only uses one sed invocation so avoiding another process spawn (the head and tail are obviously because I only want the most recent 14 entries and don’t want the top line):”

curl -s -u username:password http://twitter.com/statuses/friends_timeline.rss | grep "<title>" | sed -E 's/^[ ] //; s/<title>(. )</title>/1/' | head -n 15 | tail -n 14

Matt: curl -s -u username:password http://twitter.com/statuses/friends_timeline.rss | grep title | sed -e 's/<title>/ /' | sed -e 's/</title>/ /'

  1. Don’t forget Safari140 from the makers of NewsFire and Inquisitor.

    post direct-to-twitter from safari.
    auto-fills with the current site.
    auto-shortens long urls.

    http://www.newsfirex.com/safari140/

    Share
  2. Why piping three seds ? One invocation with three ‘-e’ should work.
    Moreover your regexps didn’t make it properly to the HTML (I guess, especially if you wanted to remove the and part).

    Share
  3. I think the wrong bash script ended up in your post as at least the first 2 sed commands don’t contain any matching element.

    Something like this would be okay:

    curl -s -u username:password http://twitter.com/statuses/friends_timeline.rss | grep “” | sed -E ‘s/^[ ]+//; s/(.+)/1/’ | head -n 10

    Share
  4. Hahaha…of course, it stripped out everything useful. In the grep and the sed I’m now missing my ‘title’ tag captures.

    Share
  5. Looks cool, but unfortunately I get this error returned.

    sed: first RE may not be empty

    Share
  6. this modification of the original works for me:
    | grep title | sed -e ‘s// /’ | sed ‘s// /’

    The part up to the URL remains the same. I am not sure what the 3rd sed call was supposed to be removing, perhaps the leading TAB.

    Share
  7. ah, I can see the problem now has I read my own comment the site removed the following from between the opening // in each of the seds

    (adding spaces between chars to hopefully prevent removal)
    1)
    2)

    Share
  8. one more try with code tags.

    curl -s -u username:password http://twitter.com/statuses/friends_timeline.rss | | grep title | sed -e 's// /' | sed 's// /'

    Share
  9. Oh well, I give up the comment system does not allow for the HTML tags to show up.

    Share
  10. Scott and Matt: Thanks for the cleaner commands. I haven’t been eyeballs deep in bash in several years, and even then I wasn’t extremely savvy. So the command I posted above was a rough slap-together job that was workable for my needs.

    And Matt, yes, the leading TAB was the culprit. Of course using negative alignment in Geek Tool is another way to handle that for those preferring not to mess with sed any more than necessary…

    Share

Comments have been disabled for this post