From ccbb415d3f0a5e54401aca6380681f296d15eec8 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sun, 30 Apr 2017 00:49:25 -0400 Subject: [PATCH] os/+arch (polybar): polish + tweaks + add eth module --- os/+arch/.config/polybar/config | 14 +++++++------- os/+arch/.config/polybar/modules/mail | 18 ++++++++++-------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/os/+arch/.config/polybar/config b/os/+arch/.config/polybar/config index f79a7262..6dc459c1 100644 --- a/os/+arch/.config/polybar/config +++ b/os/+arch/.config/polybar/config @@ -50,7 +50,7 @@ font-2 = FontAwesome:fontformat=truetype:size=11;1 modules-left = bspwm modules-center = date -modules-right = pkg mail volume redshift +modules-right = eth pkg mail volume redshift enable-ipc = true @@ -239,11 +239,11 @@ ramp-signal-foreground = ${colors.foreground-alt} [module/eth] type = internal/network -interface = enp0s31f6 +interface = ${env:ETH:enp0s31f6} interval = 3.0 -format-connected-underline = #55aa55 -format-connected-prefix = " " +; format-connected-underline = #55aa55 +; format-connected-prefix = " " format-connected-foreground-foreground = ${colors.foreground-alt} label-connected = %local_ip% @@ -258,7 +258,7 @@ interval = 5 date = " %A, %h %d" date-alt = " %Y-%m-%d" -time = " %I:%M %p" +time = " %I:%M %p" time-alt = %H:%M:%S format-prefix =  @@ -275,9 +275,9 @@ format-volume = ; label-volume = " " label-volume-foreground = ${root.foreground} -format-muted-prefix = " " +; format-muted-prefix = " " format-muted-foreground = ${colors.foreground-alt} -; label-muted = sound muted +label-muted =  bar-volume-width = 10 bar-volume-foreground-0 = #55aa55 diff --git a/os/+arch/.config/polybar/modules/mail b/os/+arch/.config/polybar/modules/mail index a449c1f8..f4a78644 100755 --- a/os/+arch/.config/polybar/modules/mail +++ b/os/+arch/.config/polybar/modules/mail @@ -15,14 +15,16 @@ n = 0 if os.path.isfile(CONFIG_FILE): with open(CONFIG_FILE) as fp: for line in fp: - addr, pwd = line.strip().split(",") - obj = imaplib.IMAP4_SSL('imap.gmail.com', 993) - obj.login(addr, pwd) - obj.select() - n += len(obj.search(None, 'UnSeen')[1][0].split()) - obj.close() - obj.logout() - print("%{{F#{}}}{} {}".format(COLOR_HL if n > 0 else COLOR_NONE, ICON, n)) + if line: + addr, pwd = line.strip().split(",") + obj = imaplib.IMAP4_SSL('imap.gmail.com', 993) + obj.login(addr, pwd) + obj.select() + n += len(obj.search(None, 'UnSeen')[1][0].split()) + obj.close() + obj.logout() + cl = COLOR_HL if n > 0 else COLOR_NONE + print("%{{u#{}}}%{{F#{}}}{} {}".format(cl, cl, ICON, n)) else: print("%{{F#{}}}{} -".format(COLOR_ERR, ICON)) sys.exit(1)