Update with pass
This commit is contained in:
parent
3719d589b1
commit
b0530350e8
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
import imaplib
|
import imaplib
|
||||||
import email
|
import email
|
||||||
|
import sys
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import credentials
|
import credentials
|
||||||
|
|
|
@ -16,6 +16,36 @@ email_icon:set_image(path_to_icons .. "/mail-mark-new.png")
|
||||||
|
|
||||||
local previous_value = 0
|
local previous_value = 0
|
||||||
|
|
||||||
|
local password1 = ''
|
||||||
|
local password2 = ''
|
||||||
|
local password3 = ''
|
||||||
|
|
||||||
|
awful.spawn.easy_async_with_shell('pass web/mail.ovh.com; pass web/webmail.gandi.net; pass web/inp-toulouse.fr;', function(stdout)
|
||||||
|
s = split(stdout, '\n')
|
||||||
|
password1 = s[1]
|
||||||
|
password2 = s[2]
|
||||||
|
password3 = s[3]
|
||||||
|
|
||||||
|
watch(
|
||||||
|
"bash -c '" .. home .. "/.config/awesome/awesome-wm-widgets/email-widget/count_unread_emails.py " .. password1 .. " " .. password2 .. " " .. password3 .. "'", 60,
|
||||||
|
function(widget, stdout, stderr, exitreason, exitcode)
|
||||||
|
local unread_emails_num = tonumber(stdout) or 0
|
||||||
|
|
||||||
|
if previous_value < unread_emails_num then
|
||||||
|
previous_value = unread_emails_num
|
||||||
|
show_emails(10)
|
||||||
|
end
|
||||||
|
|
||||||
|
email_widget:set_text(stdout)
|
||||||
|
if (unread_emails_num > 0) then
|
||||||
|
email_icon:set_image(path_to_icons .. "/mail-mark-unread.png")
|
||||||
|
elseif (unread_emails_num == 0) then
|
||||||
|
email_icon:set_image(path_to_icons .. "/mail-message-new.png")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
)
|
||||||
|
end)
|
||||||
|
|
||||||
function split(str, delimiter)
|
function split(str, delimiter)
|
||||||
if str == nil then
|
if str == nil then
|
||||||
return {}
|
return {}
|
||||||
|
@ -34,28 +64,8 @@ function split(str, delimiter)
|
||||||
return ret
|
return ret
|
||||||
end
|
end
|
||||||
|
|
||||||
watch(
|
|
||||||
"bash -c " .. home .. "/.config/awesome/awesome-wm-widgets/email-widget/count_unread_emails.py", 60,
|
|
||||||
function(widget, stdout, stderr, exitreason, exitcode)
|
|
||||||
local unread_emails_num = tonumber(stdout) or 0
|
|
||||||
|
|
||||||
if previous_value < unread_emails_num then
|
|
||||||
previous_value = unread_emails_num
|
|
||||||
show_emails(10)
|
|
||||||
end
|
|
||||||
|
|
||||||
email_widget:set_text(stdout)
|
|
||||||
if (unread_emails_num > 0) then
|
|
||||||
email_icon:set_image(path_to_icons .. "/mail-mark-unread.png")
|
|
||||||
elseif (unread_emails_num == 0) then
|
|
||||||
email_icon:set_image(path_to_icons .. "/mail-message-new.png")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
function show_emails(timeout)
|
function show_emails(timeout)
|
||||||
awful.spawn.easy_async_with_shell(home .. "/.config/awesome/awesome-wm-widgets/email-widget/read_unread_emails.py",
|
awful.spawn.easy_async_with_shell(home .. "/.config/awesome/awesome-wm-widgets/email-widget/read_unread_emails.py " .. password1 .. " " .. password2 .. " " .. password3,
|
||||||
function(stdout, stderr, reason, exit_code)
|
function(stdout, stderr, reason, exit_code)
|
||||||
|
|
||||||
s = split(stderr, '\n')
|
s = split(stderr, '\n')
|
||||||
|
|
Loading…
Reference in New Issue