.config/awesome/rc.lua

This commit is contained in:
Tom Willemsen 2012-09-15 14:28:45 +02:00
parent 1c3aacb140
commit bbc17210a1

View file

@ -62,6 +62,22 @@ function oni.mailcount_text()
oni.mailcount("ninthfloor")) oni.mailcount("ninthfloor"))
end 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 -- Returns true if all pairs in table1 are present in table2
function oni.match(table1, table2) function oni.match(table1, table2)
@ -199,12 +215,19 @@ mytextclock = awful.widget.textclock({ align = "right" })
mysystray = widget({ type = "systray" }) mysystray = widget({ type = "systray" })
-- Create a mailbox widget -- Create a mailbox widget
mymailbox = widget({ type = "textbox" }) myryumailbox = oni.mailcount_widgets("ryu", "ryuslash.org", "ryuslash")
mymailbox.text = oni.mailcount_text() 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 = timer({ timeout = 60 })
mymailboxtimer:add_signal("timeout", mymailboxtimer:add_signal(
"timeout",
function () function ()
mymailbox.text = oni.mailcount_text() 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) end)
mymailboxtimer:start() mymailboxtimer:start()
@ -285,7 +308,14 @@ for s = 1, screen.count() do
mylayoutbox[s], mylayoutbox[s],
mytextclock, mytextclock,
s == 1 and mysystray or nil, 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], mytasklist[s],
layout = awful.widget.layout.horizontal.rightleft layout = awful.widget.layout.horizontal.rightleft
} }