Is there a way to tweet from a keyboard command?

I use CMD space a million times a day to find files, launch apps, etc.

Wouldn't it be cool if I could press a keyboard combination and get a box to send a tweet? I know I can do it through notification center but I'm looking for a method that doesn't require me to leave the keyboard.


Solution 1:

The official Twitter app lets you define a shortcut in its settings (Global new tweet): enter image description here

As far as native Twitter integration goes, I really don't know :)

Solution 2:

You can send tweets using the Twitter libraries for Ruby or Python, but it requires signing up at dev.twitter.com.

#!/usr/bin/env ruby -KU -rubygems

require 'twitter'

Twitter.configure do |config|
  config.consumer_key = ""
  config.consumer_secret = ""
  config.oauth_token = ""
  config.oauth_token_secret = ""
end

tweet = `osascript -e 'try
tell application (path to frontmost application as text)
display dialog "" default answer ""
text returned of result
end
end'`.chomp

exit if tweet.empty?
Twitter.update(tweet)

AlfredTweet is a Twitter client written as an Alfred extension.