Monday, September 21, 2009

Reading RSS feeds in GNU screen

As a lot of system administrator I use GNU screen most of the time.

GNU screen is a really wonderfull tool to keep your working sessions along days.

Screen can be configured to have a status line witch can display various standard format strings. A particularly useful configuration directive is the backtick directive. This directive allows to run a custom command and update the hardstatus line each time the command emit a new line.

Using this features I developped screenfeeder: an rss reader witch can display rss feed into my harstatus line.

Configuring your ~/.screenrc

Here is my hardstatus and backtick configuration:

#Run the rss reader as #42 backtick 
backtick 42 0 0 "/home/fv/.screenfeeder/screenfeeder" "/home/fv/.screenfeeder/feeds"
# CTRL+A f open the webbrowser to the current feed entry url
bind f screen -t 'rss_feed' 10 /home/fv/.screenfeeder/screenfeeder
# display the #42 backtick in the hardstatus line 
hardstatus alwayslastline "%{+b kw}%H%{kg}|%c|%42`|%{ky}%d.%m.%Y|%{kr}(load:%l)%-0=%{kw}"

Copy the screenfeeder script into ~/.screenfeeder/screenfeeder
Put your favorits feeds into ~/.screenfeeder/feeds like this (one feed per line):

http://www.openframeworks.cc/forum/rss.php
http://www.lemonde.fr/rss/une.xml
http://linuxfr.org/backend/news/rss20.rss

The script works by saving the current url into a file named ~/currenturl-. The pid of the parent process id (the current screen process id). When screenfeeder is invoked without arguments from the same screen process it calls the webborowser module to open the url stored in this file by gessing the parent process id.

As a result. When you use CRTL-a f shortcut, the browser should open the current item.


screenfeeder demo:


Screenfeeder from dopuskh3 on Vimeo.


References:
screen manual page
screenfeeder project page on github

No comments:

Post a Comment