Check mail in separate process to prevent freezing of the interface.

This commit is contained in:
Kolan Sh 2014-08-15 13:43:49 +04:00
parent d54799aece
commit b1746089e1
3 changed files with 26 additions and 24 deletions

View File

@ -8,5 +8,6 @@ os.execute ("pgrep firefox || (firefox || firefox-bin) &")
os.execute ("pgrep geary || geary &")
os.execute ("smbnetfs "..os.getenv("HOME").."/smb")
os.execute (os.getenv("HOME").."/.config/awesome/set_wall.sh "..os.getenv("HOME").."/.config/awesome/wallpaper.slink")
os.execute ("pgrep mail_loop.sh || "..os.getenv("HOME").."/.config/awesome/mail_loop.sh &")
os.execute ("pgrep lightsOn.sh || "..os.getenv("HOME").."/.config/awesome/lightsOn.sh &")
os.execute ("pgrep nm-applet || nm-applet &")

11
mail_loop.sh Executable file
View File

@ -0,0 +1,11 @@
#!/bin/bash
# mymail_gmail_loop.sh
while [ 1 ]; do
val=$(~/.config/awesome/mymail_unread.py)
echo $val > ~/.mymail_count
sleep 30
val=$(~/.config/awesome/gmail_unread.py)
echo $val > ~/.gmail_count
sleep 30
done

38
rc.lua
View File

@ -222,42 +222,32 @@ mytasklist.buttons = awful.util.table.join(
if client.focus then client.focus:raise() end
end))
-- My MyMail updater widget
function mymail_count()
os.execute("~/.config/awesome/mymail_unread.py > ~/.mymail_count")
local f = io.open(os.getenv("HOME") .. "/.mymail_count")
-- My Mail updater widget
function mail_count(filename)
local f = io.open(filename)
local l = nil
if f ~= nil then
l = f:read()
if l == nil then
l = "?"
end
else
l = "?"
end
f:close()
return l
end
mymail_mail = wibox.widget.textbox( mymail_count() )
mymail_mail.timer = timer{timeout=60}
mymail_mail.timer:connect_signal("timeout", function () mymail_mail:set_text ( mymail_count() ) end)
mymail_mail = wibox.widget.textbox( "?" )
mymail_mail.timer = timer{timeout=20}
mymail_mail.timer:connect_signal("timeout",
function () mymail_mail:set_text ( mail_count(os.getenv("HOME") .. "/.mymail_count") ) end)
mymail_mail.timer:start()
mymailicon = wibox.widget.imagebox()
mymailicon:set_image(beautiful.widget_mymail)
-- My GMail updater widget
function gmail_count()
os.execute("~/.config/awesome/gmail_unread.py > ~/.gmail_count")
local f = io.open(os.getenv("HOME") .. "/.gmail_count")
local l = nil
if f ~= nil then
l = f:read()
else
l = "?"
end
f:close()
return l
end
gmail_mail = wibox.widget.textbox( gmail_count() )
gmail_mail.timer = timer{timeout=60}
gmail_mail.timer:connect_signal("timeout", function () gmail_mail:set_text ( gmail_count() ) end)
gmail_mail = wibox.widget.textbox( "?" )
gmail_mail.timer = timer{timeout=20}
gmail_mail.timer:connect_signal("timeout",
function () gmail_mail:set_text ( mail_count(os.getenv("HOME") .. "/.gmail_count") ) end)
gmail_mail.timer:start()
mymailicon = wibox.widget.imagebox()
mymailicon:set_image(beautiful.widget_mymail)