Archived
0
0
Fork 0

added polybar updates

This commit is contained in:
Daryl Ronningen 2022-07-11 12:20:52 -07:00
parent 3773c5cb4c
commit 1eb50f10b0
Signed by: Daryl Ronningen
GPG key ID: FD23F0C934A5EC6B
2 changed files with 33 additions and 5 deletions

View file

@ -15,7 +15,7 @@ font-2 = FiraCode Nerd Font Mono:pixelsize=10;2
modules-left = bspwm RightArrow RightStripe RightArrow
modules-center = xwindow
modules-right = LeftArrow3 LeftStripe LeftArrow3 pulseaudio LeftArrow1 filesystem LeftArrow2 cpu LeftArrow1 memory LeftArrow2 date
modules-right = LeftArrow3 LeftStripe LeftArrow3 pulseaudio LeftArrow1 updates LeftArrow2 filesystem LeftArrow1 cpu LeftArrow2 memory LeftArrow1 date
cursor-click = pointer
cursor-scroll = ns-resize
@ -99,7 +99,7 @@ type = internal/cpu
interval = 2
format-background = ${colors.cyan}
format-background = ${colors.red}
label =  CPU: %percentage%%
label-foreground = ${colors.text}
@ -116,7 +116,7 @@ date-alt = " %d %B %Y"
time = %a %r
time-alt = " %A %r"
format-background = ${colors.cyan}
format-background = ${colors.red}
label =  %date% %time%
label-foreground = ${colors.text}
@ -129,7 +129,7 @@ internal = 30
mount-0 = /
format-mounted-background = ${colors.red}
format-mounted-background = ${colors.cyan}
label-mounted =  %mountpoint%: %used%/%total%
label-mounted-foreground = ${colors.text}
@ -140,7 +140,7 @@ type = internal/memory
interval = 2
format-background = ${colors.red}
format-background = ${colors.cyan}
label =  RAM: %percentage_used%%
label-foreground = ${colors.text}
@ -219,6 +219,17 @@ label-muted-foreground = ${colors.text}
type = internal/tray
[module/updates]
type = custom/script
exec = $HOME/.config/polybar/updates.sh
interval = 600
label = Updates: %output%
format-foreground = ${colors.text}
format-background = ${colors.red}
format-prefix = " "
format-prefix-foreground = ${colors.text}
[module/windows]
type = custom/script
exec = ${env:P_BSPWM_WINDOW_CMD}

17
.config/polybar/updates.sh Executable file
View file

@ -0,0 +1,17 @@
#!/bin/sh
if ! updates_arch=$(checkupdates 2> /dev/null | wc -l ); then
updates_arch=0
fi
if ! updates_aur=$(paru -Qua 2> /dev/null | wc -l); then
updates_aur=0
fi
updates=$(("$updates_arch" + "$updates_aur"))
if [ "$updates" -gt 0 ]; then
echo " $updates"
else
echo "0"
fi