I'll throw in too.
Good job Doruletz, in working your way through it, but also, you can take it further(or less, if you know what I mean).
MrEen's solution is good. A minimal amount of processing would probably be the goal so that works nicely.
Here's two examples I came up with by using the search term "grep return text after match". These always produce great returns, and you can hone the search term as you see the types of results you are getting(or not getting). I find myself searching first then realizing I didn't use a great choice of terms but I can get there eventually.
I used grep because you mentioned it, but another good search might be "bash return text after match".
anyway:
Code: Select all
cat /etc/lsb-release | sed -n -e 's/^.*DISTRIB_DESCRIPTION=//p'
and:
Code: Select all
awk -F"TION=" '/DISTRIB_DESCRIPTION=/{print $2}' /etc/lsb-release
although both return the enclosed quotes.
But it's a good exploration to go searching and learn more about the possibilities.
Also, found one from some previous testing on here(I went looking to test the timing of these different options), probably from someone else's post about it.
you can test in terminal:
Code: Select all
lsb_release -d | awk '/Description:/ {print $2,$3,$4,$5}'
and in the conky config:
Code: Select all
${exec lsb_release -d | awk '/Description:/ {print $2,$3,$4,$5}'}
But check in terminal:
lsb_release --help
and the print $variables could pull out each individual space-separated piece of info as needed. $2-$5 was needed using the -d parameter, and $1 was not used because it was the label for that info. (see:
lsb_release -d
)
In the end if you could come up with a quick result using the least amount of processing that's good, being that a typical config might be a string of processing commands after processing commands. And also, using conky, if you can get an opportunity to use the
$no_update
variable, for data that is not changed during the running of the config, that's even better! (well but you have to use existing conky-provided variables/objects which there is not one for this data)
Extra credit. I used a lua timing function to test each of these. And in the end they are all coming out so similarly, and they do each vary a bit during each pass, but they were all almost equal overall.
I removed the passes where they all had exactly the same timing, I let it run about 10 passes.
elapsed time 1: 0.000005
elapsed time 2: 0.000004
elapsed time 3: 0.000005
elapsed time 4: 0.000005
elapsed time 1: 0.000004
elapsed time 2: 0.000009
elapsed time 3: 0.000004
elapsed time 4: 0.000005
elapsed time 1: 0.000005
elapsed time 2: 0.000004
elapsed time 3: 0.000004
elapsed time 4: 0.000004
elapsed time 1: 0.000008
elapsed time 2: 0.000007
elapsed time 3: 0.000007
elapsed time 4: 0.000008
I guess #3 looks the best though.
Code: Select all
${lua conky_time_start}\
${exec cat /etc/lsb-release | sed -n -e 's/^.*DISTRIB_DESCRIPTION=//p'}
${lua conky_time_stop 1}
${lua conky_time_start}\
${exec awk -F"TION=" '/DISTRIB_DESCRIPTION=/{print $2}' /etc/lsb-release}
${lua conky_time_stop 2}
${lua conky_time_start}\
${exec lsb_release -d | awk '/Description:/ {print $2,$3,$4,$5}'}
${lua conky_time_stop 3}
${lua conky_time_start}\
${exec inxi -S | grep -o "Desktop:.*"}
${lua conky_time_stop 4}