mirror of
https://github.com/dcarrillo/dotfiles.git
synced 2024-11-12 21:51:13 +00:00
[polybar] Add Syncthing status and improve output icon sizes
This commit is contained in:
parent
42647db6d2
commit
960573ae4e
@ -1,5 +1,5 @@
|
||||
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({
|
||||
"git",
|
||||
"clone",
|
||||
|
@ -53,7 +53,7 @@ foreground = ${colors.foreground}
|
||||
; https://www.nerdfonts.com/cheat-sheet
|
||||
font-0 = "RobotoMono Nerd Font Mono:style=Regular:size=16:antialias=true;4"
|
||||
; 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-3 = "NotoSans-Regular:size=18:weight=bold:antialias=true;6"
|
||||
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-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-scroll = ns-resize
|
||||
|
@ -15,7 +15,7 @@ function wait_for_polybar
|
||||
fi
|
||||
|
||||
while [ "$(pgrep -u "$(id -u)" -x polybar >/dev/null)" = $condition ]; do
|
||||
sleep 0.2
|
||||
sleep 1
|
||||
done
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@ interval = 5
|
||||
[module/memory_bar]
|
||||
type = internal/memory
|
||||
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}
|
||||
|
||||
bar-used-width = 10
|
||||
@ -120,7 +120,7 @@ click-left = gnome-calendar
|
||||
type = internal/alsa
|
||||
|
||||
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}
|
||||
|
||||
format-muted-prefix = ""
|
||||
@ -161,6 +161,13 @@ label = "%output%"
|
||||
label-padding = 0
|
||||
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]
|
||||
type = internal/battery
|
||||
|
||||
@ -179,7 +186,7 @@ type = custom/script
|
||||
exec = ~/.config/polybar/scripts/docker
|
||||
exec-if = docker ps -q
|
||||
interval = 10
|
||||
label = "%output%"
|
||||
label = "%{T2}%{T-}%output%"
|
||||
|
||||
[module/tray]
|
||||
type = internal/tray
|
||||
|
@ -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
|
||||
|
@ -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"
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
19
.config/polybar/scripts/syncthing_status
Executable file
19
.config/polybar/scripts/syncthing_status
Executable 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-}"
|
Loading…
Reference in New Issue
Block a user