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
|
if client.focus then client.focus:raise() end
|
||||||
end))
|
end))
|
||||||
|
|
||||||
mymaillist = wibox.widget.textbox()
|
function mailwidget(name, lighter)
|
||||||
mymaillist:set_text(
|
widget = wibox.widget.textbox()
|
||||||
string.format(" ryu: %d pfx: %d gmail: %d 9f: %d ",
|
widget.set_mailcount = function (self)
|
||||||
new_mail('ryuslash.org/inbox'),
|
self:set_text(string.format(" %s: %d", lighter,
|
||||||
new_mail('picturefix/inbox'),
|
new_mail(name .. '/inbox')))
|
||||||
new_mail('gmail/inbox'),
|
end
|
||||||
new_mail('ninthfloor/inbox')))
|
widget:set_mailcount()
|
||||||
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()
|
|
||||||
|
|
||||||
if avandu then
|
return widget
|
||||||
myrsslist = wibox.widget.textbox()
|
end
|
||||||
myrsslist:set_markup(" " .. (avandu.unread() or '?') .. " <span face=\"FontAwesome\"></span>")
|
|
||||||
myrsslisttimer = timer({ timeout = 60 })
|
mailwidgets = {ryuslash = mailwidget('ryuslash.org', 'ryu'),
|
||||||
myrsslisttimer:connect_signal(
|
picturefix = mailwidget('picturefix', 'pfx'),
|
||||||
"timeout",
|
gmail = mailwidget('gmail', 'gmail'),
|
||||||
function ()
|
ninthfloor = mailwidget('ninthfloor', '9f')}
|
||||||
myrsslist:set_markup(" " .. (avandu.unread() or '?') .. " <span face=\"FontAwesome\"></span>")
|
|
||||||
end
|
myrsslist = wibox.widget.textbox()
|
||||||
)
|
myrsslist.set_count = function (self, count)
|
||||||
myrsslisttimer:start()
|
if count then
|
||||||
|
self:set_markup(" " .. count
|
||||||
|
.. " <span face=\"FontAwesome\"></span>")
|
||||||
|
else
|
||||||
|
self:set_text("")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function unlocked()
|
function unlocked()
|
||||||
|
@ -296,7 +289,11 @@ for s = 1, screen.count() do
|
||||||
local right_layout = wibox.layout.fixed.horizontal()
|
local right_layout = wibox.layout.fixed.horizontal()
|
||||||
if s == 1 then
|
if s == 1 then
|
||||||
if avandu then right_layout:add(myrsslist) end
|
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(mykeyringlist)
|
||||||
right_layout:add(wibox.widget.systray())
|
right_layout:add(wibox.widget.systray())
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue