1
0
mirror of https://github.com/dcarrillo/dotfiles.git synced 2025-07-01 18:39:27 +00:00

[polybar] Add Syncthing status and improve output icon sizes

This commit is contained in:
2024-06-15 21:21:20 +02:00
parent 42647db6d2
commit 960573ae4e
9 changed files with 49 additions and 19 deletions

View File

@ -3,6 +3,6 @@
while true; do
UPDATES=$(checkupdates 2>/dev/null | wc -l)
[ "$UPDATES" -gt 0 ] && echo "$UPDATES" && sleep 30
[ "$UPDATES" -gt 0 ] && echo "%{T2} %{T-}$UPDATES" && sleep 30
[ "$UPDATES" -eq 0 ] && echo "" && sleep 300
done

View File

@ -1,11 +1,15 @@
#!/usr/bin/env bash
OUTPUT=""
openvpn_icon="%{T2}%{T-}"
globalprotect_icon="%{T2}%{T-}"
openvpn=$(pgrep -c openvpn$)
[ "$openvpn" -gt 0 ] && OUTPUT=$(eval printf "%.0s" "{1..$openvpn}")
output=""
if pgrep openvpn >/dev/null; then
output=${openvpn_icon}
fi
globalprotect=$(pgrep -c gpclient$)
[ "$globalprotect" -gt 0 ] && OUTPUT=${OUTPUT}$(eval printf '%.0s' "{1..$globalprotect}")
if pgrep gpclient >/dev/null; then
output="${output} ${globalprotect_icon}"
fi
echo "$OUTPUT" | sed -e 's/\(.\)/\1 /g'
echo "$output"

View File

@ -3,7 +3,7 @@
URL=${1:-1.0.0.1}
output=$(fping --quiet --outage --count=5 "$URL" 2>&1)
outage_output=" "
outage_output=""
outage_color="FFFFFF"
avg_output=""
avg_color="FFFFFF"
@ -28,7 +28,7 @@ else
fi
if [ -n "$outage_output" ] || [ -n "$avg_output" ]; then
echo "%{F#$outage_color}%{T5}${outage_output}%{F-}%{T-}%{F#$avg_color}%{T5} ${avg_output}%{F-}%{T-}"
echo "%{F#$outage_color}%{T2}${outage_output}%{F-}%{T-}%{F#$avg_color}%{T2} ${avg_output}%{F-}%{T-}"
else
echo ""
fi

View File

@ -22,7 +22,7 @@ get_icon_by_device()
;;
esac
echo $icon
echo "$icon"
}
while true; do
@ -58,9 +58,9 @@ while true; do
output=" 0.01 0.01"
fi
echo "$icon$output"
echo "%{T2}$icon%{T-}$output"
else
echo "$icon-- --"
echo "%{T2}$icon%{T-} -- --"
fi
echo "$current_values">$COUNTER_FILE

View File

@ -0,0 +1,19 @@
#!/usr/bin/env bash
output=""
while IFS="[ .]" read -r connected paused; do
if [ "$paused" == "true" ]; then
output="${output} "
continue
fi
if [ "$connected" == "false" ]; then
output="${output}󰅤 "
else
output="${output} "
fi
done <<-EOF
$(syncthing cli show connections | jq -r '.connections[] | "\(.connected) \(.paused)"')
EOF
printf "%s" "%{T2}${output%?}%{T-}"