1
0
mirror of https://github.com/eoli3n/dotfiles synced 2024-11-22 23:12:32 +01:00

test tooltip for pkg module

This commit is contained in:
eoli3n 2020-12-23 15:50:23 +01:00
parent 5ff405e1c1
commit 86b1fa191d
3 changed files with 8 additions and 4 deletions

@ -37,7 +37,8 @@
"custom/pkg": { "custom/pkg": {
"format": "{}", "format": "{}",
"interval": 3600, "interval": 3600,
"exec": "~/.config/waybar/modules/pkg.sh" "exec": "~/.config/waybar/modules/pkg.sh",
"return-type": "json"
}, },
"network": { "network": {
"format-wifi": "<span foreground='#929292'></span> {essid} <span foreground='#929292'>{signalStrength}%</span>", "format-wifi": "<span foreground='#929292'></span> {essid} <span foreground='#929292'>{signalStrength}%</span>",

@ -19,13 +19,16 @@ pacman_check() {
} }
xbps_check(){ xbps_check(){
pkg=$(xbps-install -nu | wc -l) pkg=$(xbps-install -nu)
pkg_count=$(wc -l <<< "$pkg")
if [[ $pkg -eq "0" ]] || [[ ! $pkg =~ [0-9]+ ]] if [[ $pkg -eq "0" ]] || [[ ! $pkg =~ [0-9]+ ]]
then then
exit 0 exit 0
fi fi
echo "<span foreground='#929292'></span> $pkg" text="<span foreground='#929292'></span> $pkg_count"
tooltip=$(awk '{print $1}' <<< "$pkg")
printf {"text": "$text", "tooltip": "$tooltip"}
} }
if grep -i "arch" /etc/os-release &>/dev/null if grep -i "arch" /etc/os-release &>/dev/null

@ -32,6 +32,6 @@ else
printf "$json_fmt" "$pcent" "warning" printf "$json_fmt" "$pcent" "warning"
elif [[ $pcent -ge $critical ]] elif [[ $pcent -ge $critical ]]
then then
printf "$json_fmt" "$pcent" "critical" printf "$json_fmt" "$pcent" "critical"
fi fi
fi fi