diff --git a/hosts/common/programs/conky/battery_estimate b/hosts/common/programs/conky/battery_estimate index da73efe3..a05ef4ab 100755 --- a/hosts/common/programs/conky/battery_estimate +++ b/hosts/common/programs/conky/battery_estimate @@ -9,16 +9,21 @@ usage() { echo echo "options:" echo " --debug: output additional information, to stderr" + echo " --minute-suffix : use the provided string as a minutes suffix" + echo " --hour-suffix : use the provided string as an hours suffix" + echo " --icon-suffix : use the provided string as an icon suffix" } # these icons come from sxmo; they only render in nerdfonts icon_bat_chg=("󰢟" "󱊤" "󱊥" "󰂅") icon_bat_dis=("󰂎" "󱊡" "󱊢" "󱊣") +suffix_icon=" " # thin space +# suffix_icon=" " # render time like: 2ʰ08ᵐ # unicode sub/super-scripts: -symbol_hr="ʰ" -symbol_min="ᵐ" +# symbol_hr="ʰ" +# symbol_min="ᵐ" # render time like: 2ₕ08ₘ # symbol_hr="ₕ" @@ -32,6 +37,14 @@ symbol_min="ᵐ" # symbol_hr=":" # symbol_min= +# render time like: 2꞉08⧗ +symbol_hr="꞉" +symbol_min="⧗" +# variants: +# symbol_hr=":" +# symbol_min="⧖" +# symbol_min="⌛" + # render time like: 2'08" # symbol_hr="'" # symbol_min='"' @@ -110,7 +123,7 @@ fmt_minutes() { hr=$(($3 / 60)) hr_in_min=$(($hr * 60)) min=$(($3 - $hr_in_min)) - printf "%s %d%s%02d%s" "$1" "$hr" "$symbol_hr" "$min" "$symbol_min" + printf "%s%s%d%s%02d%s" "$1" "$suffix_icon" "$hr" "$symbol_hr" "$min" "$symbol_min" fi } @@ -135,6 +148,21 @@ while [ "$#" -gt 0 ]; do shift BATTERY_ESTIMATE_DEBUG=1 ;; + "--icon-suffix") + shift + suffix_icon="$1" + shift + ;; + "--hour-suffix") + shift + symbol_hr="$1" + shift + ;; + "--minute-suffix") + shift + symbol_min="$1" + shift + ;; *) usage exit 1 diff --git a/hosts/common/programs/conky/conky.conf b/hosts/common/programs/conky/conky.conf index 32d6feca..e814e3fc 100644 --- a/hosts/common/programs/conky/conky.conf +++ b/hosts/common/programs/conky/conky.conf @@ -3,6 +3,11 @@ -- - can also use #rrggbb syntax -- example configs: -- example configs: +-- +-- exec options: +-- `exec ` => executes the command, synchronously, renders its output as text +-- `texeci ` => executes the command periodically, async (to not block render), renders as text +-- `pexec ` => executes the command, synchronously, parses its output conky.config = { out_to_wayland = true, @@ -33,18 +38,39 @@ conky.config = { default_color = '#ffffff', color1 = '000000', color2 = '404040', + -- Kbps = 'K/s', + Kbps = 'ᴷᐟˢ', + -- percent = '%', + -- percent = '﹪', + percent = '٪', + -- percent = '⁒', + -- percent = '%', + icon_suffix = nil, + hour_suffix = nil, + minute_suffix = '${font sans-serif:size=14}${color2}⧗', } --- texeci : run the command periodically, _in a separate thread_ so as not to block rendering +bat_args = "" +if conky.config.icon_suffix ~= nil then + bat_args = bat_args .. " --icon-suffix '" .. conky.config.icon_suffix .. "'" +end +if conky.config.hour_suffix ~= nil then + bat_args = bat_args .. " --hour-suffix '" .. conky.config.hour_suffix .. "'" +end +if conky.config.minute_suffix ~= nil then + bat_args = bat_args .. " --minute-suffix '" .. conky.config.minute_suffix .. "'" +end + +-- N.B.: `[[ ]]` is Lua's multiline string literal conky.text = [[ ${color1}${shadecolor 707070}${font sans-serif:size=50:style=Bold}${alignc}${exec date +"%H:%M"}${font} ${color2}${shadecolor a4d7d0}${font sans-serif:size=20}${alignc}${exec date +"%a %d %b"}${font} -${color1}${shadecolor}${font sans-serif:size=22:style=Bold}${alignc}${exec @bat@ }${font} +${color1}${shadecolor}${font sans-serif:size=22:style=Bold}${alignc}${execp @bat@ ]] .. bat_args .. [[ }${font} ${color1}${shadecolor}${font sans-serif:size=20:style=Bold}${alignc}${texeci 600 @weather@ }${font} -${color2}${shadecolor a4d7d0}${font sans-serif:size=16}${alignc}⇅ ${downspeedf wlan0}K/s${font} -${font sans-serif:size=16}${alignc}☵ $memperc%  $cpu%${font} +${color2}${shadecolor a4d7d0}${font sans-serif:size=16}${alignc}⇅ ${downspeedf wlan0}${Kbps}${font} +${font sans-serif:size=16}${alignc}☵ $memperc${percent}  $cpu${percent}${font} ]]