UPDATED: Twittering Without a Client App

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.
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>/ /'
Tweet This (10)






Galley on February 17th, 2009 at 2:55 pm
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/
Soli on February 17th, 2009 at 3:25 pm
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).
Scott on February 17th, 2009 at 3:27 pm
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
Scott on February 17th, 2009 at 3:29 pm
Hahaha…of course, it stripped out everything useful. In the grep and the sed I’m now missing my ‘title’ tag captures.
Mitch on February 17th, 2009 at 4:04 pm
Looks cool, but unfortunately I get this error returned.
sed: first RE may not be empty
Matt Rodkey on February 17th, 2009 at 5:07 pm
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.
Matt Rodkey on February 17th, 2009 at 5:09 pm
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)
Matt Rodkey on February 17th, 2009 at 5:11 pm
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// /'Matt Rodkey on February 17th, 2009 at 5:12 pm
Oh well, I give up the comment system does not allow for the HTML tags to show up.
Staff Comment Nick Santilli, TheAppleBlog on February 17th, 2009 at 5:14 pm
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…
Staff Comment Nick Santilli, TheAppleBlog on February 17th, 2009 at 5:17 pm
Matt – nick DOT appleblog AT gmail me the code snippet you’re trying for and I’ll get the post updated to reflect the better way
thx
Mitch on February 17th, 2009 at 9:41 pm
I don’t want to sound narky, but is anyone actually *testing* the code? Seriously, none of these work for me.
Staff Comment Nick Santilli, TheAppleBlog on February 17th, 2009 at 10:56 pm
@Mitch – snark away :)
Actually, they do work, but the ‘code’ display is being tripped up because we’re trying to reference html tags.
we’re trying to update the update to read properly… In the meantime just know that anywhere you see or , you should remove the _. Sorry for the confusion. so here are the 3 commands:
Mine (a bit rudimentary)
curl -s -u username:password http://twitter.com/statuses/friends_timeline.rss | grep title | sed -e ’s// /’ | sed ’s// /’ | sed ’s/ //’
Scott’s (With some added customization)
curl -s -u username:password http://twitter.com/statuses/friends_timeline.rss | grep “” | sed -E ’s/^[ ]+//; s/(.+)/\1/’ | head -n 15 | tail -n 14
Matt’s
curl -s -u username:password http://twitter.com/statuses/friends_timeline.rss | grep title | sed -e ’s// /’ | sed -e ’s// /’
Hope that helps, and again, sorry for the confusion
Staff Comment Nick Santilli, TheAppleBlog on February 17th, 2009 at 11:02 pm
wow, now I’m really getting frustrated with this too…
basically, anyplace you see title, wrap it with less-than and greater-than signs, because they should be html title tags. the closing title tag /title actually looks like \/ because of the bash syntax. so when you see the \/title, include both of those slashes when you wrap it in the less-than and greater-than signs.
[sigh] the formatting really made me screw the pooch on this one. Sorry folks.
Mine (a bit rudimentary)
curl -s -u username:password http://twitter.com/statuses/friends_timeline.rss | grep title | sed -e ’s/title/ /’ | sed ’s/\/title/ /’ | sed ’s/ //’
Scott’s (With some added customization)
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’s
curl -s -u username:password http://twitter.com/statuses/friends_timeline.rss | grep title | sed -e ’s/title/ /’ | sed -e ’s/\/title/ /’
Staff Comment Josh Pigford, TheAppleBlog on February 17th, 2009 at 11:07 pm
If you’d like to post to post actual HTML then you’ll need to use something like Postable to make your HTML “comment safe.”
hum on February 18th, 2009 at 6:09 am
@Nick – maybe just link to a screenshot of what the code should look like? I tried entering the fixes per your posts #13 and #14 and I still can’t get them to work. (Well, actually, Matt’s code worked for 10 minutes or so, but then disappeared :/ …)
hum on February 18th, 2009 at 6:46 am
Oh, I got it :D
Anthony on February 18th, 2009 at 9:05 pm
I love your desktop picture!
Can you share it out?
Staff Comment Nick Santilli, TheAppleBlog on February 20th, 2009 at 11:24 pm
@Anthony – that image and plenty of other cool apple-themed wallpapers are listed here: http://tr.im/gDrd
Enjoy
Benson on February 21st, 2009 at 2:06 pm
using pastie.org might overcome some of the constraints :)
Sam on March 3rd, 2009 at 5:54 am
Just found this blog as i was looking for the same thing. Anyway i was playing round with the scripts here and there and managed to produce a script that woks perfectly:
curl -s -u username:password
http://twitter.com/statuses/friends_timeline.rss | perl -nle ‘print for m:(.*):’ | head -n 6 | tail -n 5
With this code it will only show your top 5 tweets
Tips.
Twitter only allows you to call this information on your IP address 100 times an hour. So if have been trying to get it to work and have been failing try setting the Refresh in Geektool to a larger number
Sam on March 3rd, 2009 at 6:00 am
Well i just fell for the newbie error of blogs, damn html. so on the first “title”, wrap it with less-than and greater-than signs, on the second one wrap with the slash “/title”.
curl -s -u username:password http://twitter.com/statuses/friends_timeline.rss | perl -nle ‘print for m:title(.*)/title:’ | head -n 6 | tail -n 5
Sam on March 3rd, 2009 at 6:45 am
Oh and if your wondering Thats just my name and DOB. Some people seemed to get the whole username and password this wrong.
Justin on September 13th, 2009 at 5:51 pm
Hi there,
I’m a scripting newbie trying to get twitter on my desktop via geektool.
I was able to use one the scripts posted above (thank you). However, the formatting is a little dense.
Is there a way to add a space between each twitter entry?
Any help or input is greatly appreciated.