push changes
This commit is contained in:
@@ -26,17 +26,17 @@ markup_escape() {
|
||||
icon_markup() {
|
||||
local icon="$1"
|
||||
local color="$2"
|
||||
printf '<span font_desc="SauceCodePro Nerd Font 15" foreground="%s">%s</span>' "$color" "$icon"
|
||||
printf '<span font_desc="SauceCodePro Nerd Font 14" foreground="%s">%s</span>' "$color" "$icon"
|
||||
}
|
||||
|
||||
if mountpoint -q "$MOUNT"; then
|
||||
read -r used avail pcent <<< "$(df -h --output=used,avail,pcent "$MOUNT" | tail -1)"
|
||||
text="<span foreground=\"#D8DEE9\">$(markup_escape "$LABEL $used/$avail ($pcent)")</span> $(icon_markup "$ICON_MOUNT" "#A3BE8C")"
|
||||
text="$(icon_markup "$ICON_MOUNT" "#A3BE8C") <span foreground=\"#D8DEE9\">$(markup_escape "$LABEL $used/$avail ($pcent)")</span>"
|
||||
tooltip="$(markup_escape "$MOUNT mounted - used: $used, free: $avail ($pcent)")"
|
||||
printf '{"text":"%s","tooltip":"%s","class":"mounted"}\n' \
|
||||
"$(json_escape "$text")" "$(json_escape "$tooltip")"
|
||||
else
|
||||
text="<span foreground=\"#EBCB8B\">$(markup_escape "$LABEL N/A")</span> $(icon_markup "$ICON_DOWN" "#BF616A")"
|
||||
text="$(icon_markup "$ICON_DOWN" "#BF616A") <span foreground=\"#EBCB8B\">$(markup_escape "$LABEL N/A")</span>"
|
||||
tooltip="$(markup_escape "$MOUNT is NOT mounted")"
|
||||
printf '{"text":"%s","tooltip":"%s","class":"unmounted"}\n' \
|
||||
"$(json_escape "$text")" "$(json_escape "$tooltip")"
|
||||
|
||||
@@ -27,7 +27,7 @@ markup_escape() {
|
||||
icon_markup() {
|
||||
local icon="$1"
|
||||
local color="$2"
|
||||
printf '<span font_desc="SauceCodePro Nerd Font 15" foreground="%s">%s</span>' "$color" "$icon"
|
||||
printf '<span font_desc="SauceCodePro Nerd Font 14" foreground="%s">%s</span>' "$color" "$icon"
|
||||
}
|
||||
|
||||
truncate_text() {
|
||||
@@ -151,7 +151,7 @@ art_url=$(playerctl -p "$PLAYER" metadata mpris:artUrl 2>/dev/null || true)
|
||||
state_class=$(printf '%s' "$status" | tr '[:upper:]' '[:lower:]')
|
||||
|
||||
if [[ "$state_class" == "stopped" ]]; then
|
||||
text_markup="<span foreground=\"#D8DEE9\">Stopped</span> $(icon_markup "" "#D08770") $(icon_markup "" "#A3BE8C")"
|
||||
text_markup="$(icon_markup "" "#D08770") $(icon_markup " " "#A3BE8C")<span foreground=\"#D8DEE9\">Stopped</span>"
|
||||
printf '{"text":"%s","class":"stopped","alt":"stopped"}\n' "$(json_escape "$text_markup")"
|
||||
exit 0
|
||||
fi
|
||||
@@ -209,7 +209,7 @@ Left click: play/pause | Scroll: next/prev
|
||||
EOF
|
||||
)
|
||||
|
||||
text_markup="<span foreground=\"$track_color\">$(markup_escape "$display_track")</span> $(icon_markup "$state_icon" "$state_color") $(icon_markup "$app_icon" "$app_color")"
|
||||
text_markup="$(icon_markup "$state_icon" "$state_color") $(icon_markup "$app_icon " "$app_color")<span foreground=\"$track_color\">$(markup_escape "$display_track")</span>"
|
||||
|
||||
printf '{"text":"%s","tooltip":"%s","class":"%s","alt":"%s"}\n' \
|
||||
"$(json_escape "$text_markup")" \
|
||||
|
||||
@@ -23,7 +23,7 @@ markup_escape() {
|
||||
icon_markup() {
|
||||
local icon="$1"
|
||||
local color="$2"
|
||||
printf '<span font_desc="SauceCodePro Nerd Font 15" foreground="%s">%s</span>' "$color" "$icon"
|
||||
printf '<span font_desc="SauceCodePro Nerd Font 14" foreground="%s">%s</span>' "$color" "$icon"
|
||||
}
|
||||
|
||||
icon_for_condition() {
|
||||
@@ -59,14 +59,14 @@ icon_for_condition() {
|
||||
}
|
||||
|
||||
if ! command -v curl >/dev/null 2>&1; then
|
||||
text="<span foreground=\"#EBCB8B\">--°C Unavailable</span> $(icon_markup "" "#D08770")"
|
||||
text="$(icon_markup " " "#D08770")<span foreground=\"#EBCB8B\">--°C Unavailable</span>"
|
||||
printf '{"text":"%s","tooltip":"curl is required for weather","class":"weather-unavailable"}\n' "$(json_escape "$text")"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
raw=$(curl -fsS --max-time 6 "$URL" 2>/dev/null || true)
|
||||
if [[ -z "$raw" || "$raw" != *"|"* ]]; then
|
||||
text="<span foreground=\"#EBCB8B\">--°C Unavailable</span> $(icon_markup "" "#D08770")"
|
||||
text="$(icon_markup " " "#D08770")<span foreground=\"#EBCB8B\">--°C Unavailable</span>"
|
||||
printf '{"text":"%s","tooltip":"Weather unavailable for Norrkoping","class":"weather-unavailable"}\n' "$(json_escape "$text")"
|
||||
exit 0
|
||||
fi
|
||||
@@ -75,7 +75,7 @@ temp=${raw%%|*}
|
||||
condition=${raw#*|}
|
||||
icon=$(icon_for_condition "$condition")
|
||||
updated=$(date '+%H:%M')
|
||||
text="<span foreground=\"#D8DEE9\">$(markup_escape "$temp $condition")</span> $(icon_markup "$icon" "#88C0D0")"
|
||||
text="$(icon_markup "$icon " "#88C0D0")<span foreground=\"#D8DEE9\">$(markup_escape "$temp $condition")</span>"
|
||||
tooltip=$(cat <<EOF
|
||||
Norrkoping, Sweden
|
||||
$temp - $condition
|
||||
|
||||
Reference in New Issue
Block a user