GMail icon added

This commit is contained in:
Kolan Sh 2014-08-15 00:06:35 +04:00
parent f5148dab24
commit a841ef8588
3 changed files with 44 additions and 0 deletions

18
gmail_unread.py Executable file
View File

@ -0,0 +1,18 @@
#!/usr/bin/python
# Create credentials.py with gmail_login and gmail_password variables
import imaplib
#default imap port is 993, change otherwise
M=imaplib.IMAP4_SSL("imap.gmail.com", 993)
from credentials import gmail_login,gmail_password
M.login(gmail_login,gmail_password)
status, counts = M.status("Inbox","(MESSAGES UNSEEN)")
unread = counts[0].split()[4][:-1]
print(int(unread))
M.logout()

25
rc.lua
View File

@ -222,6 +222,26 @@ mytasklist.buttons = awful.util.table.join(
if client.focus then client.focus:raise() end if client.focus then client.focus:raise() end
end)) end))
-- 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.timer:start()
mymailicon = wibox.widget.imagebox()
mymailicon:set_image(beautiful.widget_mymail)
-- Wi-Fi / Ethernet widgets -- Wi-Fi / Ethernet widgets
wifi_widget_down = wibox.widget.textbox() wifi_widget_down = wibox.widget.textbox()
wifi_widget_up = wibox.widget.textbox() wifi_widget_up = wibox.widget.textbox()
@ -271,6 +291,11 @@ for s = 1, screen.count() do
-- Widgets that are aligned to the right -- Widgets that are aligned to the right
local right_layout = wibox.layout.fixed.horizontal() local right_layout = wibox.layout.fixed.horizontal()
if s == 1 then right_layout:add(wibox.widget.systray()) end if s == 1 then right_layout:add(wibox.widget.systray()) end
right_layout:add(spacer)
right_layout:add(mymailicon)
right_layout:add(gmail_mail)
right_layout:add(spacer) right_layout:add(spacer)
right_layout:add(cpuicon) right_layout:add(cpuicon)
right_layout:add(cpu) right_layout:add(cpu)

View File

@ -113,6 +113,7 @@ theme.arch_icon = home_path .. '.config/awesome/themes/default/icon/Arch.png'
-- theme.widget_disk = awful.util.getdir("config") .. "/themes/default/widgets/disk.png" -- theme.widget_disk = awful.util.getdir("config") .. "/themes/default/widgets/disk.png"
theme.widget_disk = "/home/kolan/.config/awesome/Icons/16x16/hdd_clear.png" theme.widget_disk = "/home/kolan/.config/awesome/Icons/16x16/hdd_clear.png"
theme.widget_cpu = awful.util.getdir("config") .. "/themes/default/widgets/cpu.png" theme.widget_cpu = awful.util.getdir("config") .. "/themes/default/widgets/cpu.png"
theme.widget_mymail = awful.util.getdir("config") .. "/themes/default/widgets/mailnew.png"
theme.widget_ac = awful.util.getdir("config") .. "/themes/default/widgets/ac.png" theme.widget_ac = awful.util.getdir("config") .. "/themes/default/widgets/ac.png"
theme.widget_acblink = awful.util.getdir("config") .. "/themes/default/widgets/acblink.png" theme.widget_acblink = awful.util.getdir("config") .. "/themes/default/widgets/acblink.png"
theme.widget_blank = awful.util.getdir("config") .. "/themes/default/widgets/blank.png" theme.widget_blank = awful.util.getdir("config") .. "/themes/default/widgets/blank.png"