Twidge microblog client

Tweeting from the Terminal

Article from Issue 154/2013
Author(s):

The Twidge microblogging tool is easy to learn and provides a much less cluttered environment than Twitter.

You won't find Twidge [1] on a list of the top 25 microblog clients. Such lists rarely mention command-line tools – which is too bad, because Twidge is not just more powerful than desktop tools but also easier to use in many ways.

In the classic free software tradition, Twidge was written "to scratch an itch." Long-time Debian developer and Twidge's creator John Goerzen explains, "I was using Twitter, but frustrated at having to go online to see what was waiting for me." For Goerzen, other shortcomings of the Twitter web interface included "not being able to clear most tweets as read and save some for replying to later, and not being able to use it offline." Additionally, Goerzen wanted Twitter to have the potential to interact with email – specifically, Postfix and Exim – and shell scripts, which explains the combination of "Twitter" and "bridge" in the name.

Now at version 1.10, Twidge has accomplished all these goals and gained a small following among Debian and Ubuntu users, as well as other distributions, including Arch Linux. The reason for this modest popularity is not hard to understand: Twidge is easy to learn and provides a much more uncluttered environment for reading tweets than Twitter's own web interface.

Setting up Twidge

Before you can use Twidge, you need to configure it with the following command:

twidge setup

The command opens a text wizard to instruct you. The installer searches for the Gnome keyring but does not require it. If you are not running a Gnome environment, you will receive constant warning messages about gnome-keyring not being found. However, you will still be able to use Twidge because the essential information to connect to Twitter is stored in .twidgerc in your home directory.

After you copy and paste the link to Goerzen's website from the installer to your browser, you are taken to a page on which you can authorize Twitter to accept Twidge (Figure 1). Pressing the Authorize button gives you an authorization number to paste into the installer to complete the setup (Figure 2).

Figure 1: Setting up Twidge requires a brief venture onto the web to connect with Twitter.
Figure 2: Authorizing Twidge.

The installer creates the .twidgerc file in your home directory. Because the file stores the authorization number in plain text, for the sake of security, you should limit its permissions so that only you can view it.

Reading and Writing Tweets

Like many commands that originated for Debian, Twidge uses both subcommands and options. A typical command structure looks like this:

twidge SUB-COMMAND OPTIONS ACCOUNT-NAME

A good place to start is with the command twidge lscommands, which lists the available subcommands. Twidge assumes that you know the names on the accounts that you want to read, but if you don't, you will have to refer to the web interface because Twidge lacks a search mechanism.

You might also want to get in the habit of using -s or --saveID. This option notes the ID of the last message displayed, so if you use -u or --unseen the next time you check messages, only the unread ones are displayed.

To read the tweets sent since you last ran Twidge, you can combine the subcommand lsrecent, which lists posts made by you or those you follow, with lsreplies, which lists replies to your tweet. The first time you log in after any absence, the number of tweets is likely to be long, so you can pipe the two commands through less so you can scroll back and forth easily:

(twidge lsrecent -su; twidge lsreplies -su) | less

Other commands for reading that you might use are lsdm, which lists any direct messages to you, and lsrtreplies, which lists retweets of your messages. Some of these commands, such as lsrtreplies and lsdm, are not supported in Identi.ca and will give you an error message if you use them.

If you prefer, you can add the -a or --all option to view all available tweets (Figure  3), rather than the top 20 or 100 specified by the microblogging site. To arrange information neatly in columns, you can add -l or --long (Figure 4). If you followed the instructions to set up email, -m **EMAIL or --mailto=EMAIL will route messages to the email client.

Figure 3: Twidge displays retrieved tweets in an easy-to-read format.
Figure 4: The long display gives more information about tweets.

To write a tweet, use the subcommand update, followed by your tweet in quotation marks:

twidge update "TWEET"

No status confirmation indicates that the tweet has been sent successfully. However, when a tweet exceeds Twitter's or Identi.ca's 140-character limit, Twidge's default behavior is to shorten any recognizable URL in the tweet. If a tweet is too long, Twidge fails to complete and does not send it. Twidge also includes the ability to send private tweets, which it calls direct messages. You can send a direct message with the command:

twidge dmsent ACCOUNT

Additionally, Twidge includes what might be called housekeeping subcommands. You can look back at tweets you have sent with the lsarchive subcommand or your retweets with lsrtarchives and your direct messages with lsdmarchives.

Using block or unblock followed by an account name will control whether a particular user can reply to your tweets, although they will still be able to read them. Similarly, you can use follow and unfollow to set whether you receive tweets from a particular account. None of these subcommands returns a status message after running; however, blocking an already blocked account or following an already followed account will leave the command uncompleted.

Fine-Tuning Twidge

The .twidgerc file in your home directory consists of a number of fields, some of which twidge updates as it runs and some of which can be edited manually; however, some should be left alone to be filled automatically. Most of the fields you should ignore will be in the [default] section at the start of .twidgerc, but do consult the Twidge documentation if you are uncertain which are which.

One field that you can edit freely is the savelast field, which sets Twidge to always use the -s or --saveID option, so that only unread messages are displayed when you run a command. It works closely with the lastid field, in which Twidge stores the ID of the last tweet that Twidge read.

You can also set up Twidge's URL-shortening functionality. Unless lsrecent is specifically set to no, the shortenurl field sets Twidge to shorten all URLS with the help of TinyURL.com [2]. Alternatively, you can create a section of .twidgerc containing your login name and password for using Bitly [3] as a URL shortener instead.

Another option is to create an [alias] section of the file. This section includes one entry per line, in which the alias is followed by a colon and the full command. The alias section can be used to reduce the length of existing subcommands or to run multiple commands without typing them out in full. For example, instead of beginning a Twidge session with the combined command suggested previously with its options and pipe, you could instead just enter new after adding the following line to .twidgerc:

[alias]
new: twidge lsrecent -su; twidge lsreplies -su) | less

Goerzen also supplies instructions for having Twidge send an email message when you receive a reply or for sending email as a tweet [4]. However, detailing these functions would require a separate article.

In theory, Twidge also can be set to use Identi.ca with a few edits of the [default] section of .twidgerc – aside, of course, from a few features that Identi.ca lacks. You can maintain the Identi.ca configuration file under a separate name and specify which configuration file to use with either the option -c FILE or --config=File. If you want to post simultaneously to all microbloggers, you can create a script with an instance of Twidge for both files. Alternatively, you might be able to activate simultaneous posting through a microblogger's web interface.

However, as I write, changes in Identi.ca appear to have made using Identi.ca with Twidge impossible in practice. Updated details of how to enable the use of Identi.ca may be available in the how-tos by the time you read this.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More

News