mirror of
https://github.com/dcarrillo/dotfiles.git
synced 2025-07-01 22:09:25 +00:00
[polybar] Add docker module and fix font issues
This commit is contained in:
24
.config/polybar/scripts/docker
Executable file
24
.config/polybar/scripts/docker
Executable file
@ -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"
|
@ -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
|
||||
|
Reference in New Issue
Block a user