.config/awesome/rc.lua
This commit is contained in:
parent
1c3aacb140
commit
bbc17210a1
1 changed files with 37 additions and 7 deletions
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue