Use passive widgets
This way awesome won't block when trying to get something and it takes a long time (like getting number of unread RSS articles without an internet connection).
This commit is contained in:
parent
cebd95b07a
commit
7b7ebbbc7c
1 changed files with 28 additions and 31 deletions
|
@ -203,37 +203,30 @@ mytasklist.buttons = awful.util.table.join(
|
|||
if client.focus then client.focus:raise() end
|
||||
end))
|
||||
|
||||
mymaillist = wibox.widget.textbox()
|
||||
mymaillist:set_text(
|
||||
string.format(" ryu: %d pfx: %d gmail: %d 9f: %d ",
|
||||
new_mail('ryuslash.org/inbox'),
|
||||
new_mail('picturefix/inbox'),
|
||||
new_mail('gmail/inbox'),
|
||||
new_mail('ninthfloor/inbox')))
|
||||
mymaillisttimer = timer({ timeout = 60 })
|
||||
mymaillisttimer:connect_signal(
|
||||
"timeout",
|
||||
function ()
|
||||
mymaillist:set_text(
|
||||
string.format(" ryu: %d pfx: %d gmail: %d 9f: %d ",
|
||||
new_mail('ryuslash.org/inbox'),
|
||||
new_mail('picturefix/inbox'),
|
||||
new_mail('gmail/inbox'),
|
||||
new_mail('ninthfloor/inbox')))
|
||||
end)
|
||||
mymaillisttimer:start()
|
||||
function mailwidget(name, lighter)
|
||||
widget = wibox.widget.textbox()
|
||||
widget.set_mailcount = function (self)
|
||||
self:set_text(string.format(" %s: %d", lighter,
|
||||
new_mail(name .. '/inbox')))
|
||||
end
|
||||
widget:set_mailcount()
|
||||
|
||||
if avandu then
|
||||
myrsslist = wibox.widget.textbox()
|
||||
myrsslist:set_markup(" " .. (avandu.unread() or '?') .. " <span face=\"FontAwesome\"></span>")
|
||||
myrsslisttimer = timer({ timeout = 60 })
|
||||
myrsslisttimer:connect_signal(
|
||||
"timeout",
|
||||
function ()
|
||||
myrsslist:set_markup(" " .. (avandu.unread() or '?') .. " <span face=\"FontAwesome\"></span>")
|
||||
end
|
||||
)
|
||||
myrsslisttimer:start()
|
||||
return widget
|
||||
end
|
||||
|
||||
mailwidgets = {ryuslash = mailwidget('ryuslash.org', 'ryu'),
|
||||
picturefix = mailwidget('picturefix', 'pfx'),
|
||||
gmail = mailwidget('gmail', 'gmail'),
|
||||
ninthfloor = mailwidget('ninthfloor', '9f')}
|
||||
|
||||
myrsslist = wibox.widget.textbox()
|
||||
myrsslist.set_count = function (self, count)
|
||||
if count then
|
||||
self:set_markup(" " .. count
|
||||
.. " <span face=\"FontAwesome\"></span>")
|
||||
else
|
||||
self:set_text("")
|
||||
end
|
||||
end
|
||||
|
||||
function unlocked()
|
||||
|
@ -296,7 +289,11 @@ for s = 1, screen.count() do
|
|||
local right_layout = wibox.layout.fixed.horizontal()
|
||||
if s == 1 then
|
||||
if avandu then right_layout:add(myrsslist) end
|
||||
right_layout:add(mymaillist)
|
||||
|
||||
for k, w in pairs(mailwidgets) do
|
||||
right_layout:add(w)
|
||||
end
|
||||
|
||||
-- right_layout:add(mykeyringlist)
|
||||
right_layout:add(wibox.widget.systray())
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue