conky
conky copied to clipboard
Add object to set the width of an expression
Hello,
I like when my Conky show perfectly aligned things, and after some researches, I think it be useful for a lot of people to add an object to fix the width of some things, in chars or pixels.
Example : ${width 8 ${freq 1} MHz}
will print "1200 MHz"
or " 900 MHz"
(note the space).
Eventually add options to set the side of the blank space, and the width can be set in number of characters or in pixels, I don't know what is the best.
Thanks.
Fast solution for your freq
.
--- ...
${exec ~/.bin/cpufreq.py 1}
${exec ~/.bin/cpufreq.py 2}
${exec ~/.bin/cpufreq.py 3}
${exec ~/.bin/cpufreq.py 4}
]]
#!/usr/bin/env python
from sys import argv
def _get_cpuinfo():
with open("/proc/cpuinfo") as f:
return [line.split()[-1] for line in f if "cpu MHz" in line]
cpu = int(argv[-1])
print("{:>8} MHz".format(_get_cpuinfo()[cpu]))
EDIT: I'm sure you can do it with awk
and such too.
Yes, it's the type of workaround that I use currently, but having exec
everywhere is not a good solution… in that case, I can write a script who generate all the content of the conky, and use only one ${execp script}
. I think it's bad for performances and/or resources.
This issue is stale because it has been open 365 days with no activity. Remove stale label or comment, or this issue will be closed in 30 days.
I guess that it’s not a very requested feature, then…
This issue is stale because it has been open 365 days with no activity. Remove stale label or comment, or this issue will be closed in 30 days.