Simple arithmetic in Conky?



  • Hello. Do any Linux users here use Conky, & with it display your network download & upload speeds in kbps or Mbps? How?

    Using downspeedf & upspeedf as per http://conky.sourceforge.net/variables.html annoyingly produces output in kBps or MBps, which is opposite to what i want. Who willingly uses speeds in *Bytes per second instead of *bits per second?

    So far i've not found a native Conky Object for what i want, so then i tried to understand if i could do simple arithmetic in my Conky file to convert.

    TEXT
    ${color2}Download ${color0}${alignr}${downspeedf*8 enp2s0} kbps
    ${color2}Download ${color0}${alignr}${downspeedf enp2s0} kBps
    

    As you can see, this was entirely unsuccessful:

    0_1510905605540_20171117_005.png

    I tried moving the multiplication to other parts of the string, but all my iterations were still useless.

    From further research i began to sense that i might need to create a lua script file to do this simple calculation, & call it from my Conky file. However i am clueless on all specifics related to actually doing this; i have no familiarity with lua scripting, & the examples i've seen online seem massively complex for such a simple need as mine.

    Any ideas pls?



  • Don't think you can do maths directly in conky and after looking, doesn't appear to be an easy way to show downspeed in mbits in conky, or even a terminal command you could use.
    For me, the units used aren't that important as long as I can see at a glance if my downloads are running at maximum.
    I know about 580 Kilobytes is my max down speed.
    I use a lua script to draw a bar graph for up/down speeds in a conky panel I have running at the bottom of my screen.
    0_1511361205874_257.jpg
    If interested I can post a conky config and lua script.



  • @cantankrus Hi, ta, uh, ok. Sad but understandable... no, actually it's not really that understandable. I'm pretty surprised, given the popularity of Conky, that this was not solved/fixed years ago.

    You know, later that same day/night that i did my post, i discovered how to achieve my goal outside of Conky, via a Plasma5 widget i put into the bottom panel [& it does use the right units]. If a Conky solution was available, i'd use that on my desktop too, but oh well, i can get by like this.

    Thank you.


Log in to reply
 

Looks like your connection to Vivaldi Forum was lost, please wait while we try to reconnect.