Show 0 email if script returns nothing

This commit is contained in:
Pavel Makhov 2017-02-04 10:38:46 -05:00 committed by GitHub
parent 53e39d21d8
commit 8671445a4f
1 changed files with 2 additions and 2 deletions

View File

@ -14,7 +14,7 @@ email_icon:set_image(path_to_icons .. "/mail-mark-new.png")
watch(
"python /home/<username>/.config/awesome/email-widget/count_unread_emails.py", 20,
function(widget, stdout, stderr, exitreason, exitcode)
local unread_emails_num = tonumber(stdout)
local unread_emails_num = tonumber(stdout) or 0
if (unread_emails_num > 0) then
email_icon:set_image(path_to_icons .. "/mail-mark-unread.png")
email_widget:set_text(stdout)
@ -39,4 +39,4 @@ function show_emails()
)
end
email_icon:connect_signal("mouse::enter", function() show_emails() end)
email_icon:connect_signal("mouse::enter", function() show_emails() end)