mirror of
https://github.com/dcarrillo/dotfiles.git
synced 2024-12-22 12:48:01 +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"
|
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",
|
||||||
|
@ -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
|
||||||
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
@ -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
|
||||||
|
@ -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"
|
||||||
|
@ -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
|
||||||
|
@ -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
|
||||||
|
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