[SOLVED] Parse conkyobject value to a bash script?

Add functionality to your desktop
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Post Reply
Koentje
Level 5
Level 5
Posts: 717
Joined: Tue Jan 04, 2022 6:23 pm

[SOLVED] Parse conkyobject value to a bash script?

Post by Koentje »

I am trying to parse a value of a conky object to a bash script and i'm stuck..

${execp ./script.sh ${cpu cpu0}}
sh: 1: Bad substitution

${execp ./script.sh "${cpu cpu0}"}
sh: 1: Bad substitution

${execp ./script.sh '${cpu cpu0}'}
(standard_in) 1: illegal character: $
(standard_in) 1: syntax error
(standard_in) 2: syntax error


${execp ./script.sh `${cpu cpu0}`}
sh: 1: Bad substitution
(standard_in) 1: syntax error
(standard_in) 2: syntax error


Then i googled a bit (not much to find) and found this "solution", but it does not work..
${eval $${execp ./script.sh ${cpu cpu0}}}
It does not give me an error, but also conky doesn't output anything...

Does anyone knows how i can do this?
Last edited by Koentje on Fri Sep 08, 2023 4:30 pm, edited 1 time in total.
User avatar
Bleys
Level 4
Level 4
Posts: 228
Joined: Wed Apr 20, 2022 4:17 am
Location: Essen, Germany

Re: Parse conkyobject value to a bash script?

Post by Bleys »

I would use LUA for this. Just one small Function:

Code: Select all

function conky_execute(name,arg)
    home_path = os.getenv ('HOME')
	str=string.format('${%s %s}',name,arg)
	str=conky_parse(str)		
	value=tonumber(str)
    result=conky_parse('${exec '..home_path..'/.conky/script.sh '..value..'}')
    return result
end 
save this function e.g. as helper.lua
Add this line before the conky.text area:

Code: Select all

lua_load = './helper.lua',
Calling the function:

Code: Select all

${lua execute cpu cpu0}
Ryzen 5 5600G, 16GB RAM, 2TB M.2 Crucial P3, Asrock Deskmeet X300, Samsung Odyssey 49", Linux Mint 21
Koentje
Level 5
Level 5
Posts: 717
Joined: Tue Jan 04, 2022 6:23 pm

Re: Parse conkyobject value to a bash script?

Post by Koentje »

I already solved it by creating another small conky script that outputs the cpu usage to the terminal. Then in the original conky script i use this command:
${execp ./cpugauge.sh $(conky -i8 -c ./cpu-percent | tail -n1)}

This works, but i will try yours also.. but my lua skills are of the kind that i can make small adjustments to existing lua scripts. ;)
Koentje
Level 5
Level 5
Posts: 717
Joined: Tue Jan 04, 2022 6:23 pm

Re: Parse conkyobject value to a bash script?

Post by Koentje »

Nope, doesn't work... when i start the conky script it takes about 15 seconds before anything shows and then every 10 seconds it's gone for a second and pups up again...almost always with the same value.

I think i'll keep my own solution. Maybe not the prettiest, but works flaweless! ;)
User avatar
Bleys
Level 4
Level 4
Posts: 228
Joined: Wed Apr 20, 2022 4:17 am
Location: Essen, Germany

Re: [SOLVED] Parse conkyobject value to a bash script?

Post by Bleys »

that's really strange.
The same behavior here. Tested it again with a Conky Appimage Version: Works correctly.

Conky Version System: 1.12.2
Conky Appimage Version: 1.11.5
Ryzen 5 5600G, 16GB RAM, 2TB M.2 Crucial P3, Asrock Deskmeet X300, Samsung Odyssey 49", Linux Mint 21
User avatar
Bleys
Level 4
Level 4
Posts: 228
Joined: Wed Apr 20, 2022 4:17 am
Location: Essen, Germany

Re: [SOLVED] Parse conkyobject value to a bash script?

Post by Bleys »

If I move this function completely to LUA, it works.
Can you possibly post your cpugauge.sh script?
I would like to try to implement this in LUA.
Ryzen 5 5600G, 16GB RAM, 2TB M.2 Crucial P3, Asrock Deskmeet X300, Samsung Odyssey 49", Linux Mint 21
Koentje
Level 5
Level 5
Posts: 717
Joined: Tue Jan 04, 2022 6:23 pm

Re: [SOLVED] Parse conkyobject value to a bash script?

Post by Koentje »

Sure!
screenshot.png
screenshot.png (40.57 KiB) Viewed 329 times
steampunk-cpu-gauge-1.1.tar.gz
(159.54 KiB) Downloaded 23 times


If you do the graphics in lua, then it would also be nice if the moving of the dial is more floating to the new value.
At the moment it jumps from one value to the next.
Koentje
Level 5
Level 5
Posts: 717
Joined: Tue Jan 04, 2022 6:23 pm

Re: [SOLVED] Parse conkyobject value to a bash script?

Post by Koentje »

And?
User avatar
Bleys
Level 4
Level 4
Posts: 228
Joined: Wed Apr 20, 2022 4:17 am
Location: Essen, Germany

Re: [SOLVED] Parse conkyobject value to a bash script?

Post by Bleys »

Koentje wrote: Tue Sep 12, 2023 2:17 pmAnd?
The basis stands. What's missing is the number tape. Haven't found a way to make it flow yet.
Screen Capture_select-area_20230912204039.jpg
PS: What a cramp, you can't even post a 230kb small gif here....
Ryzen 5 5600G, 16GB RAM, 2TB M.2 Crucial P3, Asrock Deskmeet X300, Samsung Odyssey 49", Linux Mint 21
Koentje
Level 5
Level 5
Posts: 717
Joined: Tue Jan 04, 2022 6:23 pm

Re: [SOLVED] Parse conkyobject value to a bash script?

Post by Koentje »

Bleys wrote: Tue Sep 12, 2023 2:41 pm
Koentje wrote: Tue Sep 12, 2023 2:17 pmAnd?
The basis stands. What's missing is the number tape.
Missing the numbers tape? You mean the picture with all the numbers on it?

PS: What a cramp, you can't even post a 230kb small gif here....
Yeah.. i know! Also, you can't even send a picture in a PM. :roll:


(this one?)
gauge_numbers.png
User avatar
Bleys
Level 4
Level 4
Posts: 228
Joined: Wed Apr 20, 2022 4:17 am
Location: Essen, Germany

Re: [SOLVED] Parse conkyobject value to a bash script?

Post by Bleys »

No... the Number Picture is not missing. I write the values directly as text. This way I can simulate the glide.
Ryzen 5 5600G, 16GB RAM, 2TB M.2 Crucial P3, Asrock Deskmeet X300, Samsung Odyssey 49", Linux Mint 21
Koentje
Level 5
Level 5
Posts: 717
Joined: Tue Jan 04, 2022 6:23 pm

Re: [SOLVED] Parse conkyobject value to a bash script?

Post by Koentje »

Aaah ok.. :lol:
User avatar
zcot
Level 9
Level 9
Posts: 2640
Joined: Wed Oct 19, 2016 6:08 pm

Re: [SOLVED] Parse conkyobject value to a bash script?

Post by zcot »

Koentje wrote: Sun Sep 10, 2023 11:46 am If you do the graphics in lua, then it would also be nice if the moving of the dial is more floating to the new value.
At the moment it jumps from one value to the next.
HAHAH! But you do realize, this is not just some 2 or 3 lines, easy solution!

It is a great idea!

I love the idea!

I think I would try to write multiple functions for the movement.

One will just handle animation positive or negative.

Probably do another to strictly handle "floating". I don't know a good term related to German or Dutch. But a liquid gauge like this will have some smooth movement toward the final value, but there will either be some slowing down to the final number, or there will be some positive/negative variation near the final number until it settles on the exact value.

This one is tricky because it will tend to show a lot of movement constantly!

I think I would try to write to write multiple functions to handle these specific different conditions.

And maybe, it will be good to try to normalize some of the actual value changes, to where the animation is restricted to a more moderate, lesser, reality!

We can do really great cool things with conky, but also, at least for me, I really tend to want to restrict the conky processing to the most minimal amount of load. I do want the conky system to show some really cool stuff, but I never want to feel like it might restrict the system when I might need to possibly do some really heavy loading! (although in reality I very rarely, or never, see a condition where the system is loaded near maximum, -so there is always processing room!)
Koentje
Level 5
Level 5
Posts: 717
Joined: Tue Jan 04, 2022 6:23 pm

Re: [SOLVED] Parse conkyobject value to a bash script?

Post by Koentje »

Yeah i do realize it's more then 1 or 2 lines, but it would be so cool! 8)
But i'm already satisfied if it just goes a little smoother to the next value, instead of a jump. A bit more realistic.

I also try to make my conky's so that they use the least amount of processor/ram/diskio usage because i have so many conky's running. That's why i made the 'conky usage' conky to keep track of that.. ;)
This one was just for fun.

The only time my 6 cores go to 100% is when i process or convert video's. Handbrake does not have a restriction on the use of cores! :roll:
User avatar
Bleys
Level 4
Level 4
Posts: 228
Joined: Wed Apr 20, 2022 4:17 am
Location: Essen, Germany

Re: [SOLVED] Parse conkyobject value to a bash script?

Post by Bleys »

Koentje wrote: Wed Sep 13, 2023 3:34 am Yeah i do realize it's more then 1 or 2 lines, but it would be so cool! 8)
This weekend I have time for it again. Still a little patience :)
Ryzen 5 5600G, 16GB RAM, 2TB M.2 Crucial P3, Asrock Deskmeet X300, Samsung Odyssey 49", Linux Mint 21
User avatar
zcot
Level 9
Level 9
Posts: 2640
Joined: Wed Oct 19, 2016 6:08 pm

Re: [SOLVED] Parse conkyobject value to a bash script?

Post by zcot »

Koentje wrote: Wed Sep 13, 2023 3:34 am That's why i made the 'conky usage' conky to keep track of that.. ;)
Yea, I saw that. I'm usually surprised the processing is not higher.
Koentje
Level 5
Level 5
Posts: 717
Joined: Tue Jan 04, 2022 6:23 pm

Re: [SOLVED] Parse conkyobject value to a bash script?

Post by Koentje »

Bleys wrote: Wed Sep 13, 2023 7:29 am This weekend I have time for it again. Still a little patience :)
I'm very curious what you make of it! (no pressure :wink: )

zcot wrote: Wed Sep 13, 2023 9:30 am Yea, I saw that. I'm usually surprised the processing is not higher.
If conky usage is 10% and cpu load says 30% then conky uses around 10% of that 30%. But the top4 shows what your heaviest conky's are, and suprisingly mine is the clock with 14,2%! Fully Lua... but i guess the multiple moving graphical layers makes it heavy? Th next one is 2.5% and then it gets lower quickly..
My total is around 35% of around 20-25% cpu load. And you know how many shit i have running! :lol:

But i noticed that a lot of graphical action makes the conky a little on the heavier side. Like is said in the PM, that 'hightech' theme with all these animated graphics.. some image folders had 100 png files in it, just to get a turning world image. Every conky update a new image! :roll:

Edit: btw, i send you two links in the last pm, have you checked them?
Post Reply

Return to “Compiz, Conky, Docks & Widgets”