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%
@ -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,6 +15,7 @@ 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:
if line:
addr, pwd = line.strip().split(",") addr, pwd = line.strip().split(",")
obj = imaplib.IMAP4_SSL('imap.gmail.com', 993) obj = imaplib.IMAP4_SSL('imap.gmail.com', 993)
obj.login(addr, pwd) obj.login(addr, pwd)
@ -22,7 +23,8 @@ if os.path.isfile(CONFIG_FILE):
n += len(obj.search(None, 'UnSeen')[1][0].split()) n += len(obj.search(None, 'UnSeen')[1][0].split())
obj.close() obj.close()
obj.logout() obj.logout()
print("%{{F#{}}}{} {}".format(COLOR_HL if n > 0 else COLOR_NONE, ICON, n)) 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)