I am trying to update my conky config (cobbled together from other people’s fantastic work) and running into some strange display issue that I am not educated enough to solve.
When the GPU clock is >0 everything displays correctly.
However, once the card clocks down to zero, there is an unsightly linebreak happening.
My guess is that when the clock speed reaches 0, the file /sys/class/drm/card0/device/pp_dpm_sclk is gone, or deleted, or something, making the grep in this line:
…not return anything.
I’m guessing you could, perhaps should, build an if statement to check if the file exists, and if it does, print the clock speed and if it doesn’t, print 0Mhz. Or some such.
I no longer get the double output, which was great!
However firing up a game quickly revealed the flaw of the solution because we no longer get any output in conky past 500 Mhz, since regex is looking for “*” in line 1.
Sadly this is no longer true when running a game since the file contents are now:
Solution for conky outputting double zero Mhz GPU values:
After a dipping my toes into the arcane wizardry that is Regex with utter bewilderment, I instead managed to solve it by using the -m 1 switch for grep.