From bbc17210a1d3b0c69c36207891d9fb18fd8759f9 Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Sat, 15 Sep 2012 14:28:45 +0200 Subject: .config/awesome/rc.lua --- .config/awesome/rc.lua | 44 +++++++++++++++++++++++++++++++++++++------- 1 file changed, 37 insertions(+), 7 deletions(-) diff --git a/.config/awesome/rc.lua b/.config/awesome/rc.lua index 0cc96ae..e3d4548 100644 --- a/.config/awesome/rc.lua +++ b/.config/awesome/rc.lua @@ -62,6 +62,22 @@ function oni.mailcount_text() oni.mailcount("ninthfloor")) end +function oni.mailcount_widgets(label, account, name) + widgets = {} + widgets.label = widget({ type = "textbox" }) + widgets.label.text = string.format(" %s: ", label) + widgets.count = widget({ type = "textbox" }) + widgets.count.text = string.format(" %d ", oni.mailcount(account)) + widgets.count.bg = beautiful.bg_focus + widgets.count:buttons( + awful.util.table.join( + awful.button({ }, 1, + function (c) + awful.util.spawn("emacsclient -e '(oni:view-mail \"" .. name .. "\")'") + end))) + + return widgets +end -- Returns true if all pairs in table1 are present in table2 function oni.match(table1, table2) @@ -199,13 +215,20 @@ mytextclock = awful.widget.textclock({ align = "right" }) mysystray = widget({ type = "systray" }) -- Create a mailbox widget -mymailbox = widget({ type = "textbox" }) -mymailbox.text = oni.mailcount_text() +myryumailbox = oni.mailcount_widgets("ryu", "ryuslash.org", "ryuslash") +myaethonmailbox = oni.mailcount_widgets("aet", "aethon", "aethon") +mygmailmailbox = oni.mailcount_widgets("gmail", "gmail", "gmail") +my9fmailbox = oni.mailcount_widgets("9f", "ninthfloor", "ninthfloor") + mymailboxtimer = timer({ timeout = 60 }) -mymailboxtimer:add_signal("timeout", - function () - mymailbox.text = oni.mailcount_text() - end) +mymailboxtimer:add_signal( + "timeout", + function () + myryumailbox.count.text = string.format(" %d ", oni.mailcount("ryuslash.org")) + myaethonmailbox.count.text = string.format(" %d ", oni.mailcount("aethon")) + mygmailmailbox.count.text = string.format(" %d ", oni.mailcount("gmail")) + my9fmailbox.count.text = string.format(" %d ", oni.mailcount("ninthfloor")) + end) mymailboxtimer:start() -- Create a wibox for each screen and add it @@ -285,7 +308,14 @@ for s = 1, screen.count() do mylayoutbox[s], mytextclock, s == 1 and mysystray or nil, - s == 1 and mymailbox or nil, + s == 1 and my9fmailbox.count or nil, + s == 1 and my9fmailbox.label or nil, + s == 1 and mygmailmailbox.count or nil, + s == 1 and mygmailmailbox.label or nil, + s == 1 and myaethonmailbox.count or nil, + s == 1 and myaethonmailbox.label or nil, + s == 1 and myryumailbox.count or nil, + s == 1 and myryumailbox.label or nil, mytasklist[s], layout = awful.widget.layout.horizontal.rightleft } -- cgit v1.2.3-54-g00ecf