Uzsolt newsreader (newsbeuter, liferea) information

An external solution is here (you'll need overwrite to use in awesome 3.x). But if you want it with lua, see above.

You'll need lua-sqlite3, and add require("sqlite3") to your rc.lua, and a textbox (e.g. tb_rss). Create a hook e.g. hook_rss_*.

Newsbeuter "version"
function hook_rss_newsbeuter db = sqlite3.open("/home/zsolt/.newsbeuter/cache.db") row = db:first_irow("SELECT COUNT(*) FROM rss_item WHERE unread=1;") tb_rss.text = "Unread items: " .. row[1] db:close end

Liferea "version"
function hook_rss_liferea db = sqlite3.open("/home/zsolt/.liferea_1.7/liferea.db") row = db:first_irow("SELECT COUNT(*) FROM items where read = 0 and comment = 0;") tb_rss.text = "Unread items: " .. row[1] db:close end

You should change /home/zsolt to your home directory, or use os.getenv("HOME").

And register it:

awful.hooks.timer.register(60,hook_rss_newsbeuter)

I think, that refresh in every minutes (60 secs) is enough. But if you want more, you can overwrite 60 ;)

Another and complicated version
In this case you don't need any external lua library!

You should create a script, named by liferea-unread-items:

LOGFILE=$HOME/logfiles/liferea-unread-items sqlite3 ~/.liferea_1.8/liferea.db "SELECT COUNT(*) FROM items WHERE read=0 AND comment=0 ; \   SELECT node.title,GROUP_CONCAT(items.title,'@') \        FROM items JOIN node ON node.node_id=items.node_id \        WHERE items.read=0 AND items.comment=0 \        GROUP BY items.node_id ORDER BY node.title;" > $LOGFILE
 * 1) !/bin/bash

If you prefer newsbeuter:

LOGFILE=$HOME/logfiles/newsbeuter-unread-items sqlite3 ~/.config/newsbeuter/cache.db "SELECT COUNT(*) FROM rss_item WHERE unread=1; \                                                                                     SELECT                                                                                                                                                                      rss_feed.title,                                                                                                                                                         GROUP_CONCAT(rss_item.title,'@')                                                                                                                                    FROM rss_item \                                                                                                                                                         JOIN rss_feed ON rss_feed.rssurl=rss_item.feedurl \ WHERE unread=1 GROUP BY rss_feed.rssurl;" > $LOGFILE
 * 1) !/bin/bash

These scripts will feeds the LOGFILE file (see in hook_rss and tooltip.timer_function too): first line is the unread items, after this unread items grouped by folder: FolderName|UnreadItems (items are separated by @ character). Each line is each folder.

Put this script to crontab (per user)! In my case it runs in every minutes.

You should create a textbox (textboxes["rss"] in my case) to display number of unread items and create a timer to fill textbox's field (if your LOGFILE is newsbeuter-unread-items please change it):

function hook_rss local f = io.open(os.getenv("HOME") .. "/logfiles/liferea-unread-items") local s = f:read("*line") f:close textboxes["rss"].text = coloring(s,"#00ff00") end

You can create a tooltip to textboxes["rss"]:

tooltip["rss"] = awful.tooltip({                                                                                                                                           objects = { iconboxes["rss"], textboxes["rss"] },                                                                                                                       timer_function = function                                                                                                                                                 local maximum_per_node = 3        local f = io.open(os.getenv("HOME") .. "/logfiles/liferea-unread-items")                                                                                                                                             local line = f:read("*line")                                                                                                                                                         if (line=="0") then            return awful.util.escape(" << No unread news >> ")        end        local line = f:read("*line")                                                                                                local ret = ""                                                                                                                                            while (line~=nil) do                                                                                                                                                        local i,j = line:find("|") local tag = line:sub(1,j-1) ret = ( (ret=="") and "" or (ret .. "\n") ) .. awful.util.escape( " << " .. tag .. " >>") line = line:sub(j+1,-1) local item_number = 0 while (line~="") do                                                                                                                                                        local ii,ij = line:find("@") ij = ij and ij or 0 ret = ret .. "\n\t" .. awful.util.escape(line:sub(1,ij-1)) line = (ij==0) and "" or line:sub( ij+1,-1) item_number = item_number + 1 if (item_number==maximum_per_node) then if (line~="") then line = "" ret = ret .. "\n\t [ ... ]" end end end line = f:read("*line") end f:close return ret end, })

It will displays unread items grouped by folder (max. maximum_per_node per folder).