conky icon indicating copy to clipboard operation
conky copied to clipboard

Add object to set the width of an expression

Open Br31zh opened this issue 6 years ago • 4 comments

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.

Br31zh avatar Feb 08 '19 17:02 Br31zh

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.

lasers avatar Feb 08 '19 20:02 lasers

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.

Br31zh avatar Feb 08 '19 20:02 Br31zh

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.

github-actions[bot] avatar Jul 15 '23 02:07 github-actions[bot]

I guess that it’s not a very requested feature, then…

Br31zh avatar Jul 15 '23 02:07 Br31zh

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.

github-actions[bot] avatar Jul 16 '24 01:07 github-actions[bot]