1
0
mirror of https://github.com/dcarrillo/dotfiles.git synced 2024-09-19 01:12:38 +00:00

[polybar] Add Syncthing status and improve output icon sizes

This commit is contained in:
Daniel Carrillo 2024-06-15 21:21:20 +02:00
parent 42647db6d2
commit 960573ae4e
Signed by: dcarrillo
GPG Key ID: E4CD5C09DAED6E16
9 changed files with 49 additions and 19 deletions

View File

@ -1,5 +1,5 @@
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then if not (vim.uv or vim.loop).fs_stat(lazypath) then
vim.fn.system({ vim.fn.system({
"git", "git",
"clone", "clone",

View File

@ -53,7 +53,7 @@ foreground = ${colors.foreground}
; https://www.nerdfonts.com/cheat-sheet ; https://www.nerdfonts.com/cheat-sheet
font-0 = "RobotoMono Nerd Font Mono:style=Regular:size=16:antialias=true;4" font-0 = "RobotoMono Nerd Font Mono:style=Regular:size=16:antialias=true;4"
; https://fontawesome.com/cheatsheet/free ; https://fontawesome.com/cheatsheet/free
font-1 = "FontAwesome:size=16:antialias=true;2" font-1 = "FontAwesome:size=16:antialias=true;4"
font-2 = "Material Icons:size=16:antialias=true;1" font-2 = "Material Icons:size=16:antialias=true;1"
font-3 = "NotoSans-Regular:size=18:weight=bold:antialias=true;6" font-3 = "NotoSans-Regular:size=18:weight=bold:antialias=true;6"
font-4 = "NotoSans-Regular:size=28:weight=bold:antialias=true;-11 font-4 = "NotoSans-Regular:size=28:weight=bold:antialias=true;-11
@ -62,7 +62,7 @@ font-6 = "Font Awesome 6 Brands-Regular-400:size=32:antialias=true;1"
modules-left = polywins modules-left = polywins
modules-center = custom_date modules-center = custom_date
modules-right = updates cpu_bar memory_bar docker vpn network_status network_usage alsa_bar tray modules-right = updates cpu_bar memory_bar docker vpn network_status network_usage syncthing_status alsa_bar tray
cursor-click = pointer cursor-click = pointer
cursor-scroll = ns-resize cursor-scroll = ns-resize

View File

@ -15,7 +15,7 @@ function wait_for_polybar
fi fi
while [ "$(pgrep -u "$(id -u)" -x polybar >/dev/null)" = $condition ]; do while [ "$(pgrep -u "$(id -u)" -x polybar >/dev/null)" = $condition ]; do
sleep 0.2 sleep 1
done done
} }

View File

@ -27,7 +27,7 @@ interval = 5
[module/memory_bar] [module/memory_bar]
type = internal/memory type = internal/memory
format = <bar-used> format = <bar-used>
format-prefix = "%{A1:$TERMINAL_CMD top -o RES &:} %{A}" format-prefix = "%{A1:$TERMINAL_CMD top -o RES &:}%{T2}%{T-}%{A}"
format-prefix-foreground = ${colors.foreground-alt} format-prefix-foreground = ${colors.foreground-alt}
bar-used-width = 10 bar-used-width = 10
@ -120,7 +120,7 @@ click-left = gnome-calendar
type = internal/alsa type = internal/alsa
format-volume = <label-volume> <bar-volume> format-volume = <label-volume> <bar-volume>
label-volume = "%{A3:$TERMINAL_CMD pulsemixer &:}%{A}" label-volume = "%{A3:$TERMINAL_CMD pulsemixer &:}%{T4}%{T-}%{A}"
label-volume-foreground = ${root.foreground} label-volume-foreground = ${root.foreground}
format-muted-prefix = "" format-muted-prefix = ""
@ -161,6 +161,13 @@ label = "%output%"
label-padding = 0 label-padding = 0
tail = true tail = true
[module/syncthing_status]
type = custom/script
exec = ~/.config/polybar/scripts/syncthing_status
interval = 10
exec-if = syncthing cli show system > /dev/null
click-left = $BROWSER_CMD $(syncthing cli show system | jq -r .guiAddressUsed)
[module/battery] [module/battery]
type = internal/battery type = internal/battery
@ -179,7 +186,7 @@ type = custom/script
exec = ~/.config/polybar/scripts/docker exec = ~/.config/polybar/scripts/docker
exec-if = docker ps -q exec-if = docker ps -q
interval = 10 interval = 10
label = "%output%" label = "%{T2}%{T-}%output%"
[module/tray] [module/tray]
type = internal/tray type = internal/tray

View File

@ -3,6 +3,6 @@
while true; do while true; do
UPDATES=$(checkupdates 2>/dev/null | wc -l) 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 [ "$UPDATES" -eq 0 ] && echo "" && sleep 300
done done

View File

@ -1,11 +1,15 @@
#!/usr/bin/env bash #!/usr/bin/env bash
OUTPUT="" openvpn_icon="%{T2}%{T-}"
globalprotect_icon="%{T2}%{T-}"
openvpn=$(pgrep -c openvpn$) output=""
[ "$openvpn" -gt 0 ] && OUTPUT=$(eval printf "%.0s" "{1..$openvpn}") if pgrep openvpn >/dev/null; then
output=${openvpn_icon}
fi
globalprotect=$(pgrep -c gpclient$) if pgrep gpclient >/dev/null; then
[ "$globalprotect" -gt 0 ] && OUTPUT=${OUTPUT}$(eval printf '%.0s' "{1..$globalprotect}") 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} URL=${1:-1.0.0.1}
output=$(fping --quiet --outage --count=5 "$URL" 2>&1) output=$(fping --quiet --outage --count=5 "$URL" 2>&1)
outage_output=" " outage_output=""
outage_color="FFFFFF" outage_color="FFFFFF"
avg_output="" avg_output=""
avg_color="FFFFFF" avg_color="FFFFFF"
@ -28,7 +28,7 @@ else
fi fi
if [ -n "$outage_output" ] || [ -n "$avg_output" ]; then 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 else
echo "" echo ""
fi fi

View File

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