diff --git a/autostart.lua b/autostart.lua index c70efa9..5a18acf 100644 --- a/autostart.lua +++ b/autostart.lua @@ -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 &") diff --git a/mail_loop.sh b/mail_loop.sh new file mode 100755 index 0000000..a7158ed --- /dev/null +++ b/mail_loop.sh @@ -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 diff --git a/rc.lua b/rc.lua index 7e786c1..a51636b 100644 --- a/rc.lua +++ b/rc.lua @@ -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)