polybar: redo icons + add app watcher modules

This commit is contained in:
Henrik Lissner 2017-10-07 18:02:37 +02:00
parent 125798b010
commit d2da342f62
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
5 changed files with 34 additions and 14 deletions

View file

@ -49,7 +49,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 wlan eth volume redshift modules-right = pkg mail wlan eth volume app-redshift app-rslsync
enable-ipc = true enable-ipc = true
@ -230,18 +230,18 @@ format-connected = <ramp-signal>
format-disconnected-underline = ${colors.alert} format-disconnected-underline = ${colors.alert}
label-connected = label-connected =
label-disconnected = ! label-disconnected = !
label-disconnected-foreground = ${xrdb:color1} label-disconnected-foreground = ${xrdb:color1}
ramp-signal-0 = ramp-signal-0 =
ramp-signal-0-foreground = #22e5e8e6 ramp-signal-0-foreground = #22e5e8e6
ramp-signal-1 = ramp-signal-1 =
ramp-signal-1-foreground = ${xrdb:color3} ramp-signal-1-foreground = ${xrdb:color3}
ramp-signal-2 = ramp-signal-2 =
ramp-signal-2-foreground = ${xrdb:color11} ramp-signal-2-foreground = ${xrdb:color11}
ramp-signal-3 = ramp-signal-3 =
ramp-signal-3-foreground = #ffe5e8e6 ramp-signal-3-foreground = #ffe5e8e6
ramp-signal-4 = ramp-signal-4 =
ramp-signal-4-foreground = ${xrdb:color2} ramp-signal-4-foreground = ${xrdb:color2}
[module/eth] [module/eth]
@ -405,11 +405,18 @@ hook-0 = ~/.config/polybar/modules/mail
initial = 1 initial = 1
click-left = polybar-msg -p %pid% hook mail 1 click-left = polybar-msg -p %pid% hook mail 1
[module/redshift] [module/app-redshift]
type = custom/script type = custom/script
interval = 30 interval = 120
label-padding = 1 label-padding = 1
exec = ~/.config/polybar/modules/redshift exec = ~/.config/polybar/modules/app-redshift
exec-if = "pgrep redshift >/dev/null" exec-if = "pgrep redshift >/dev/null"
[module/app-rslsync]
type = custom/script
interval = 60
label-padding = 1
exec = ~/.config/polybar/modules/app-rslsync
exec-if = "pgrep rslsync >/dev/null"
; vim:ft=dosini ; vim:ft=dosini

View file

@ -0,0 +1,9 @@
#!/usr/bin/env bash
icon=""
if pgrep -x rslsync &> /dev/null; then
echo "%{F#e5e8e6}$icon"
else
echo "%{F#65737E}$icon"
fi

View file

@ -11,7 +11,7 @@ CONFIG_FILE = os.path.expanduser("~/.private/config/email")
CACHE_FILE = "/tmp/polybar-mail" CACHE_FILE = "/tmp/polybar-mail"
COLOR_HL = "3E86B8" COLOR_HL = "3E86B8"
COLOR_NONE = "5C6370" COLOR_NONE = "22e5e8e6"
COLOR_ERR = "CC626A" COLOR_ERR = "CC626A"
# #
@ -80,7 +80,10 @@ def main():
ding() ding()
color = COLOR_HL if total > 0 else COLOR_NONE color = COLOR_HL if total > 0 else COLOR_NONE
print("%{{u#{}}}%{{F#{}}}{} {}".format(color, color, ICON, total)) if total == 0:
print("%{{u#{}}}%{{F#{}}}{} ".format(color, color, ICON))
else:
print("%{{u#{}}}%{{F#{}}}{} {}".format(color, color, ICON, total))
cache.write_text(str(total)) cache.write_text(str(total))
else: else:

View file

@ -4,13 +4,14 @@ aur=$(cower -u | wc -l)
last=$(</tmp/polybar-updates) last=$(</tmp/polybar-updates)
check=$((pac + aur)) check=$((pac + aur))
icon=""
if [[ "$check" != "0" ]]; then if [[ "$check" != "0" ]]; then
echo "%{F#e5e8e6}%{F-} $pac,$aur" echo "%{F#e5e8e6}${icon}%{F-} $pac,$aur"
if [[ $last != "$pac$aur" ]]; then if [[ $last != "$pac$aur" ]]; then
notify-send "$((pac+aur)) updates available" notify-send "$((pac+aur)) updates available"
aplay -N -q ~/.config/polybar/sounds/robni7-news-ting.wav aplay -N -q ~/.config/polybar/sounds/robni7-news-ting.wav
echo "$pac$aur" >/tmp/polybar-updates echo "$pac$aur" >/tmp/polybar-updates
fi fi
else else
echo "%{F#22e5e8e6}%{F-} " echo "%{F#22e5e8e6}${icon}%{F-} "
fi fi