conky: use the same percent symbol even in battery_estimate

This commit is contained in:
Colin 2023-12-28 17:43:34 +00:00
parent 70ee98736a
commit b0ddb1b31c
2 changed files with 11 additions and 1 deletions

View File

@ -12,12 +12,14 @@ usage() {
echo " --minute-suffix <string>: use the provided string as a minutes suffix"
echo " --hour-suffix <string>: use the provided string as an hours suffix"
echo " --icon-suffix <string>: use the provided string as an icon suffix"
echo " --percent-suffix <string>: use the provided string when displaying percents"
}
# these icons come from sxmo; they only render in nerdfonts
icon_bat_chg=("󰢟" "󱊤" "󱊥" "󰂅")
icon_bat_dis=("󰂎" "󱊡" "󱊢" "󱊣")
suffix_icon="" # thin space
suffix_percent="%"
# suffix_icon=" "
# render time like: 2ʰ08ᵐ
@ -141,7 +143,7 @@ pretty_output() {
duration="$(($full * 60 * $perc / (-100 * $rate)))"
fi
fi
fmt_minutes "$icon" "$perc%" "$duration"
fmt_minutes "$icon" "$perc$suffix_percent" "$duration"
fi
}
@ -166,6 +168,11 @@ while [ "$#" -gt 0 ]; do
symbol_min="$1"
shift
;;
"--percent-suffix")
shift
suffix_percent="$1"
shift
;;
*)
usage
exit 1

View File

@ -63,6 +63,9 @@ end
if vars.minute_suffix ~= nil then
bat_args = bat_args .. " --minute-suffix '" .. vars.minute_suffix .. "'"
end
if vars.percent ~= nil then
bat_args = bat_args .. " --percent-suffix '" .. vars.percent .. "'"
end
-- N.B.: `[[ <text> ]]` is Lua's multiline string literal
conky.text = [[