conky/battery_estimate: render stylized
This commit is contained in:
parent
104e76de47
commit
4f3706622c
|
@ -9,16 +9,21 @@ usage() {
|
||||||
echo
|
echo
|
||||||
echo "options:"
|
echo "options:"
|
||||||
echo " --debug: output additional information, to stderr"
|
echo " --debug: output additional information, to stderr"
|
||||||
|
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"
|
||||||
}
|
}
|
||||||
|
|
||||||
# these icons come from sxmo; they only render in nerdfonts
|
# these icons come from sxmo; they only render in nerdfonts
|
||||||
icon_bat_chg=("" "" "" "")
|
icon_bat_chg=("" "" "" "")
|
||||||
icon_bat_dis=("" "" "" "")
|
icon_bat_dis=("" "" "" "")
|
||||||
|
suffix_icon=" " # thin space
|
||||||
|
# suffix_icon=" "
|
||||||
|
|
||||||
# render time like: 2ʰ08ᵐ
|
# render time like: 2ʰ08ᵐ
|
||||||
# unicode sub/super-scripts: <https://en.wikipedia.org/wiki/Unicode_subscripts_and_superscripts>
|
# unicode sub/super-scripts: <https://en.wikipedia.org/wiki/Unicode_subscripts_and_superscripts>
|
||||||
symbol_hr="ʰ"
|
# symbol_hr="ʰ"
|
||||||
symbol_min="ᵐ"
|
# symbol_min="ᵐ"
|
||||||
|
|
||||||
# render time like: 2ₕ08ₘ
|
# render time like: 2ₕ08ₘ
|
||||||
# symbol_hr="ₕ"
|
# symbol_hr="ₕ"
|
||||||
|
@ -32,6 +37,14 @@ symbol_min="ᵐ"
|
||||||
# symbol_hr=":"
|
# symbol_hr=":"
|
||||||
# symbol_min=
|
# symbol_min=
|
||||||
|
|
||||||
|
# render time like: 2꞉08⧗
|
||||||
|
symbol_hr="꞉"
|
||||||
|
symbol_min="⧗"
|
||||||
|
# variants:
|
||||||
|
# symbol_hr=":"
|
||||||
|
# symbol_min="⧖"
|
||||||
|
# symbol_min="⌛"
|
||||||
|
|
||||||
# render time like: 2'08"
|
# render time like: 2'08"
|
||||||
# symbol_hr="'"
|
# symbol_hr="'"
|
||||||
# symbol_min='"'
|
# symbol_min='"'
|
||||||
|
@ -110,7 +123,7 @@ fmt_minutes() {
|
||||||
hr=$(($3 / 60))
|
hr=$(($3 / 60))
|
||||||
hr_in_min=$(($hr * 60))
|
hr_in_min=$(($hr * 60))
|
||||||
min=$(($3 - $hr_in_min))
|
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
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,6 +148,21 @@ while [ "$#" -gt 0 ]; do
|
||||||
shift
|
shift
|
||||||
BATTERY_ESTIMATE_DEBUG=1
|
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
|
usage
|
||||||
exit 1
|
exit 1
|
||||||
|
|
|
@ -3,6 +3,11 @@
|
||||||
-- - can also use #rrggbb syntax
|
-- - can also use #rrggbb syntax
|
||||||
-- example configs: <https://forum.manjaro.org/t/conky-showcase-2022/97123>
|
-- example configs: <https://forum.manjaro.org/t/conky-showcase-2022/97123>
|
||||||
-- example configs: <https://www.reddit.com/r/Conkyporn/>
|
-- example configs: <https://www.reddit.com/r/Conkyporn/>
|
||||||
|
--
|
||||||
|
-- exec options:
|
||||||
|
-- `exec <cmd>` => executes the command, synchronously, renders its output as text
|
||||||
|
-- `texeci <interval_sec> <cmd>` => executes the command periodically, async (to not block render), renders as text
|
||||||
|
-- `pexec <cmd>` => executes the command, synchronously, parses its output
|
||||||
|
|
||||||
conky.config = {
|
conky.config = {
|
||||||
out_to_wayland = true,
|
out_to_wayland = true,
|
||||||
|
@ -33,18 +38,39 @@ conky.config = {
|
||||||
default_color = '#ffffff',
|
default_color = '#ffffff',
|
||||||
color1 = '000000',
|
color1 = '000000',
|
||||||
color2 = '404040',
|
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 <interval_sec> <cmd>: 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.: `[[ <text> ]]` is Lua's multiline string literal
|
||||||
conky.text = [[
|
conky.text = [[
|
||||||
${color1}${shadecolor 707070}${font sans-serif:size=50:style=Bold}${alignc}${exec date +"%H:%M"}${font}
|
${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}
|
${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}
|
${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}
|
${color2}${shadecolor a4d7d0}${font sans-serif:size=16}${alignc}⇅ ${downspeedf wlan0}${Kbps}${font}
|
||||||
${font sans-serif:size=16}${alignc}☵ $memperc% $cpu%${font}
|
${font sans-serif:size=16}${alignc}☵ $memperc${percent} $cpu${percent}${font}
|
||||||
]]
|
]]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user