diff --git a/.config/polybar/bar.ini b/.config/polybar/bar.ini index a869d73..198ad93 100644 --- a/.config/polybar/bar.ini +++ b/.config/polybar/bar.ini @@ -58,17 +58,18 @@ fixed-center = true background = ${colors.background} foreground = ${colors.foreground} -font-0 = "Droid Sans Mono:size=16:antialias=true;1" +font-0 = "RobotoMono-Regular:size=16:antialias=true;1" ; https://fontawesome.com/cheatsheet/free font-1 = "FontAwesome:size=16:antialias=true;2" font-2 = "Material Icons:size=16:antialias=true;1" -font-3 = NotoSans-Regular:size=18:weight=bold:antialias=true;2 -font-4 = NotoSans-Regular:size=28:weight=bold:antialias=true;-12 +font-3 = "NotoSans-Regular:size=18:weight=bold:antialias=true;2" +font-4 = "NotoSans-Regular:size=28:weight=bold:antialias=true;-12" font-5 = "FontAwesome:size=21:antialias=true;4" +font-6 = "Font Awesome 5 Brands-Regular-400:size=32:antialias=true;1" modules-left = polywins modules-center = custom_date -modules-right = updates cpu_bar memory_bar vpn network_usage alsa_bar +modules-right = updates cpu_bar memory_bar docker vpn network_usage alsa_bar cursor-click = pointer cursor-scroll = ns-resize diff --git a/.config/polybar/modules.ini b/.config/polybar/modules.ini index 9c60af6..9e4c478 100644 --- a/.config/polybar/modules.ini +++ b/.config/polybar/modules.ini @@ -174,3 +174,10 @@ label-charging = %percentage%%  format-discharging = label-discharging = %percentage%%  label-full =  + +[module/docker] +type = custom/script +exec = ~/.config/polybar/scripts/docker +exec-if = docker ps -q +interval = 30 +label = "%output%" diff --git a/.config/polybar/scripts/docker b/.config/polybar/scripts/docker new file mode 100755 index 0000000..6f5b27c --- /dev/null +++ b/.config/polybar/scripts/docker @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +declare -A STATUS=( + [running]=#43A047 + [exited]=#A14242 + [restarting]=#E53935 + [dead]=#E53935 + [created]=#1A4F76 + [paused]=#654321 + [removing]=#8E6995 +) + +output="" +containers=$(docker ps --all --format="{{.State}}") +if [ "$(echo "$containers" | wc -l)" -gt 0 ]; then + for status in "${!STATUS[@]}"; do + count=$(echo "$containers" | grep -c "$status") + if [ "$count" -gt 0 ]; then + output="$output %{F${STATUS[$status]}}$count%{F-}" + fi + done +fi + +echo "$output" diff --git a/.config/polybar/scripts/network_usage b/.config/polybar/scripts/network_usage index cd98a97..025e734 100755 --- a/.config/polybar/scripts/network_usage +++ b/.config/polybar/scripts/network_usage @@ -58,9 +58,9 @@ while true; do output=" 0.01 0.01" fi - echo "$icon $output" + echo "$icon$output" else - echo "$icon -- --" + echo "$icon-- --" fi echo "$current_values">$COUNTER_FILE