I have the exact same issue as Creating Conky text variables with zero padding? for displaying network speed. Except that I'm piping conky to dzen2. It seems lua_parse is not working within that setup.
I've tried :
- Formatting the string directly :
${lua_parse format %2s ${downspeed re0}}
- Using
goto
:${downspeed re0}${goto 100}
- Setting a custom function in
~/.xmonad/conky_lua_script.lua
:
function conky_format( format, number )
return string.format( format, conky_parse( number ) )
end
Then in conkyrc:
lua_load = "~/.xmonad/conky_lua_script.lua"
conky.text = [[
${lua_parse format %5.0f ${downspeed re0}}%
]];
Minimal working example :
conky.config = {
background = true,
out_to_console = true,
out_to_x = false,
update_interval = 1.0,
use_spacer = 'none',
use_xft = true
};
conky.text = [[
${downspeed re0}
]];
Run it with conky | dzen2
.
Edit The following works :
conky.config = {
lua_load = "~/.xmonad/conky_lua_script.lua"
....
};
conky.text = [[
${lua format %7s ${downspeed re0}}
]];
format_human_readable = false,
withuse_spacer = 'left',
in conky? – meuh Feb 19 '21 at 16:27DejaVu Sans Mono
in conky but it seems like it did nothing. With a monospace font in dzen instead anduser_spacer = 'left'
in conky, it's much better. Text still moves when switching units though. I did not setformat_human_readable = false
, as it made speeds hard to read. So the best solution for now is to useddownspeedf
instead ofdownspeed
for fixed text. I still prefer the output ofdownspeed
though :) – alex_reader Feb 19 '21 at 17:18