Save mail counts in /tmp (tmpfs) directory.

This commit is contained in:
Kolan Sh 2014-08-15 20:24:13 +04:00
parent b1746089e1
commit 880ec14064
2 changed files with 7 additions and 4 deletions

View File

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

4
rc.lua
View File

@ -240,14 +240,14 @@ end
mymail_mail = wibox.widget.textbox( "?" ) mymail_mail = wibox.widget.textbox( "?" )
mymail_mail.timer = timer{timeout=20} mymail_mail.timer = timer{timeout=20}
mymail_mail.timer:connect_signal("timeout", mymail_mail.timer:connect_signal("timeout",
function () mymail_mail:set_text ( mail_count(os.getenv("HOME") .. "/.mymail_count") ) end) function () mymail_mail:set_text ( mail_count("/tmp/"..os.getenv("USERNAME").."-mail_loop".."/mymail_count") ) end)
mymail_mail.timer:start() mymail_mail.timer:start()
mymailicon = wibox.widget.imagebox() mymailicon = wibox.widget.imagebox()
mymailicon:set_image(beautiful.widget_mymail) mymailicon:set_image(beautiful.widget_mymail)
gmail_mail = wibox.widget.textbox( "?" ) gmail_mail = wibox.widget.textbox( "?" )
gmail_mail.timer = timer{timeout=20} gmail_mail.timer = timer{timeout=20}
gmail_mail.timer:connect_signal("timeout", gmail_mail.timer:connect_signal("timeout",
function () gmail_mail:set_text ( mail_count(os.getenv("HOME") .. "/.gmail_count") ) end) function () gmail_mail:set_text ( mail_count("/tmp/"..os.getenv("USERNAME").."-mail_loop".."/gmail_count") ) end)
gmail_mail.timer:start() gmail_mail.timer:start()
mymailicon = wibox.widget.imagebox() mymailicon = wibox.widget.imagebox()
mymailicon:set_image(beautiful.widget_mymail) mymailicon:set_image(beautiful.widget_mymail)