os/+arch (polybar): polish + tweaks + add eth module

This commit is contained in:
Henrik Lissner 2017-04-30 00:49:25 -04:00
parent ff014c91b3
commit ccbb415d3f
2 changed files with 17 additions and 15 deletions

View file

@ -50,7 +50,7 @@ font-2 = FontAwesome:fontformat=truetype:size=11;1
modules-left = bspwm modules-left = bspwm
modules-center = date modules-center = date
modules-right = pkg mail volume redshift modules-right = eth pkg mail volume redshift
enable-ipc = true enable-ipc = true
@ -239,11 +239,11 @@ ramp-signal-foreground = ${colors.foreground-alt}
[module/eth] [module/eth]
type = internal/network type = internal/network
interface = enp0s31f6 interface = ${env:ETH:enp0s31f6}
interval = 3.0 interval = 3.0
format-connected-underline = #55aa55 ; format-connected-underline = #55aa55
format-connected-prefix = " " ; format-connected-prefix = " "
format-connected-foreground-foreground = ${colors.foreground-alt} format-connected-foreground-foreground = ${colors.foreground-alt}
label-connected = %local_ip% label-connected = %local_ip%
@ -258,7 +258,7 @@ interval = 5
date = " %A, %h %d" date = " %A, %h %d"
date-alt = " %Y-%m-%d" date-alt = " %Y-%m-%d"
time = " %I:%M %p" time = " %I:%M %p"
time-alt = %H:%M:%S time-alt = %H:%M:%S
format-prefix =  format-prefix = 
@ -275,9 +275,9 @@ format-volume = <ramp-volume>
; label-volume = " " ; label-volume = " "
label-volume-foreground = ${root.foreground} label-volume-foreground = ${root.foreground}
format-muted-prefix = " " ; format-muted-prefix = " "
format-muted-foreground = ${colors.foreground-alt} format-muted-foreground = ${colors.foreground-alt}
; label-muted = sound muted label-muted = 
bar-volume-width = 10 bar-volume-width = 10
bar-volume-foreground-0 = #55aa55 bar-volume-foreground-0 = #55aa55

View file

@ -15,14 +15,16 @@ n = 0
if os.path.isfile(CONFIG_FILE): if os.path.isfile(CONFIG_FILE):
with open(CONFIG_FILE) as fp: with open(CONFIG_FILE) as fp:
for line in fp: for line in fp:
addr, pwd = line.strip().split(",") if line:
obj = imaplib.IMAP4_SSL('imap.gmail.com', 993) addr, pwd = line.strip().split(",")
obj.login(addr, pwd) obj = imaplib.IMAP4_SSL('imap.gmail.com', 993)
obj.select() obj.login(addr, pwd)
n += len(obj.search(None, 'UnSeen')[1][0].split()) obj.select()
obj.close() n += len(obj.search(None, 'UnSeen')[1][0].split())
obj.logout() obj.close()
print("%{{F#{}}}{} {}".format(COLOR_HL if n > 0 else COLOR_NONE, ICON, n)) obj.logout()
cl = COLOR_HL if n > 0 else COLOR_NONE
print("%{{u#{}}}%{{F#{}}}{} {}".format(cl, cl, ICON, n))
else: else:
print("%{{F#{}}}{} -".format(COLOR_ERR, ICON)) print("%{{F#{}}}{} -".format(COLOR_ERR, ICON))
sys.exit(1) sys.exit(1)