Need help formatting an edit of conky code please. [SOLVED]

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
User avatar
Logansfury
Level 6
Level 6
Posts: 1237
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Need help formatting an edit of conky code please. [SOLVED]

Post by Logansfury »

Hello everyone,

I have a Temperatures section in my Conky Minimalis .conf file. It lists the temperatures of the 4 cores, which is dynamic, but after this is a static high and crit temps in parenthesis. I would like the section in paranthesis to be aligned to the right side of the widget. I tried separating the single line into two lines with an ${alignr} preceeding the second line, but it still didnt format as I wished. Here is my code:

Code: Select all

${color1}${font ConkySymbols:size=16}h${font} ${voffset -10} Temperatures» $hr${color}
${color1}${goto 35}CPU : ${color}${exec sensors coretemp-isa-0000 -u | grep 'temp[1-4]_input' | awk '{printf "Core %d: %+0.1f°F/%+0.1f°C (High: +84.0°C/Crit: +100.0°C)\n                   ", NR, $2 * 9/5 + 32, $2}'} ${alignr}${color1}
         GPU : ${color}${exec sensors | grep -A2 'radeon-pci-0100' | grep 'temp1' | awk '{printf "+%.1f°F/+%.1f°C (High: +90.0°C/Crit: +120.0°C)\n", $2 * 9/5 + 32, $2}'}
Thanks for reading,

Logan
Last edited by Logansfury on Mon Jan 22, 2024 11:27 pm, edited 1 time in total.
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
Koentje
Level 7
Level 7
Posts: 1581
Joined: Tue Jan 04, 2022 6:23 pm
Location: Netherlands

Re: Need help formatting an edit of conky code please.

Post by Koentje »

Would be nice if you gave the compleet config! I have no clue how you setup your conky...
User avatar
Logansfury
Level 6
Level 6
Posts: 1237
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Need help formatting an edit of conky code please.

Post by Logansfury »

My bad, here is the complete code :)

Code: Select all

--[[
# Minimalis Conky 1.3
# Author : archit3x
# Release date : 4 December 2020
# Tested on : Archlinux ARM - XFCE Desktop
# Email : archit3x@archlinux.us
# Feel free to modity this script ;)
]]

conky.config = {
    alignment = 'top_right',
    background = true,
    border_width = 1,
    cpu_avg_samples = 2,
    default_color = 'gray',
    default_outline_color = 'black',
    default_shade_color = 'white',
    color1 = '#e82127',
    double_buffer = true,
    draw_borders = false,
    draw_graph_borders = true,
    draw_outline = true,
    draw_shades = false,
    extra_newline = false,
    font = 'Neon 80s:size=8',
    gap_x = 30,
    gap_y = 30,
    minimum_height = 410,
    minimum_width = 340,
    net_avg_samples = 2,
    no_buffers = true,
    out_to_console = false,
    out_to_ncurses = false,
    out_to_stderr = false,
    out_to_x = true,
    own_window = true,
    own_window_class = 'Conky',
    own_window_transparent = true,
    own_window_argb_visual = true,
    own_window_type = 'desktop',
    own_window_hints ='undecorated,sticky,skip_taskbar,skip_pager,below',
    show_graph_range = false,
    show_graph_scale = false,
    stippled_borders = 0,
    update_interval = 1.0,
    uppercase = false,
    use_spacer = 'none',
    use_xft = true,
}

conky.text = [[
${color1}${font ConkySymbols:size=20}u${font} ${voffset -10}GNU/Linux» $hr ${color}
${color1}${goto 35}OS      : ${color}${execi 86400 cat `ls -atr /etc/*-release | tail -2` | grep "PRETTY_NAME" | cut -d= -f2 |  sed 's/"//g'}Linux Mint 21.3 Virginia | Cinnamon
${color1}${goto 35}Kernel : ${color}$kernel on $machine

${color1}${font ConkySymbols:size=16}f${font} ${voffset -10} System» $hr${color}
${alignr}${cpugraph cpu0 50,340 ffff00 ff0000}
${color1}${goto 35}Core 1  : ${color}${freq_g 1}GHz ${alignr}${cpu cpu0}% ${cpubar cpu0 6,100}
${alignr}${cpugraph cpu1 50,340 ffff00 ff0000}
${color1}${goto 35}Core 2 : ${color}${freq_g 2}GHz ${alignr}${cpu cpu1}% ${cpubar cpu1 6,100}
${alignr}${cpugraph cpu2 50,340 ffff00 ff0000}
${color1}${goto 35}Core 3 : ${color}${freq_g 3}GHz ${alignr}${cpu cpu2}% ${cpubar cpu2 6,100}
${alignr}${cpugraph cpu3 50,340 ffff00 ff0000}
${color1}${goto 35}Core 4 : ${color}${freq_g 4}GHz ${alignr}${cpu cpu3}% ${cpubar cpu3 6,100}

${color1}${goto 35}Uptime : ${color}$uptime_short ${alignr}${color1}Load  : ${color}${loadavg}

${color1}${font ConkySymbols:size=16}h${font} ${voffset -10} Temperatures» $hr${color}
${color1}${goto 35}CPU : ${color}${exec sensors coretemp-isa-0000 -u | grep 'temp[1-4]_input' | awk '{printf "Core %d: %+0.1f°F/%+0.1f°C (High: +84.0°C/Crit: +100.0°C)\n                   ", NR, $2 * 9/5 + 32, $2}'} ${alignr}${color1}
         GPU : ${color}${exec sensors | grep -A2 'radeon-pci-0100' | grep 'temp1' | awk '{printf "+%.1f°F/+%.1f°C (High: +90.0°C/Crit: +120.0°C)\n", $2 * 9/5 + 32, $2}'}

${color1}${font ConkySymbols:size=16}L${font} ${voffset -10}Fan Speeds» $hr${color}
        ${color1}${goto 35}Processor Fan : ${color}${exec sensors | awk '/Processor Fan:/ {print $3 " RPM"}'}
        ${color1}${goto 35}Motherboard Fan : ${color}${exec sensors | awk '/Motherboard Fan:/ {print $3 " RPM"}'}

${color1}${font ConkySymbols:size=16}J${font} ${voffset -10}Memory» $hr${color}
${color1}${goto 35}RAM : ${color}$mem/$memmax ${alignr}$memperc% ${membar 4,100}
${color1}${goto 35}SWAP: ${color}$swap/$swapmax $alignr}$swapperc% ${swapbar 4,100}

${color1}${font ConkySymbols:size=16}n${font} ${voffset -10} Processes» $hr${color}

${color1}${goto 35}CPU usage ${alignr}Memory Usage${color}
${color1}${goto 35}${stippled_hr}${color}
${goto 35}${top name 1} ${color}${top cpu 1}% ${alignr}${top_mem name 1}${top_mem mem_res 1}
${goto 35}${top name 2} ${color}${top cpu 2}% ${alignr}${top_mem name 2}${top_mem mem_res 2}
${goto 35}${top name 3} ${color}${top cpu 3}% ${alignr}${top_mem name 3}${top_mem mem_res 3}
${goto 35}${top name 4} ${color}${top cpu 4}% ${alignr}${top_mem name 4}${top_mem mem_res 4}

${color1}${goto 35}Processes: ${color}$processes ${color1}Running: ${color}$running_processes
${cpugraph cpu1 50,340 ffff00 ff0000}

${color1}${font ConkySymbols:size=16}k${font} ${voffset -10} Storage» $hr${color}
${color1}${goto 35}ROOT : ${color}${fs_used /}/${fs_size /} ${alignr}${fs_used_perc /}% ${fs_bar 4,100 /}
${diskiograph_read 50,170 ffff00 ff0000} ${alignr}${diskiograph_write 50,170 ffff00 ff0000}
${goto 35}
${color1}${font ConkySymbols:size=16}b${font} ${voffset -10} Wireless» $hr${color}
${color1}${goto 35}SSID        : ${color}${wireless_essid wlx7cb232bdeee1} ${color1}${alignr}Signal: ${color}${wireless_link_qual_perc wlx7cb232bdeee1}% ${wireless_link_bar 4,100 wlx7cb232bdeee1}
${color1}${goto 35}Bitrate     : ${color}${wireless_bitrate wlx7cb232bdeee1}
${color1}${goto 35}Total Down/Up : ${color}${totaldown wlx7cb232bdeee1}/${totalup wlx7cb232bdeee1} 
${color1}${goto 35}Speed Down/Up : ${color}${downspeed wlx7cb232bdeee1}/${upspeed wlx7cb232bdeee1}
${color1}${goto 35}Local IP : ${color}${exec ip route | grep -oP '(?<=src )(\S+)' | head -n 1}
${upspeedgraph wlx7cb232bdeee1 50,170 ffff00 ff0000} ${alignr}${downspeedgraph wlx7cb232bdeee1 50,170 ffff00 ff0000}
${color1}${goto 35}.
]]
Here is the visual result: https://imgur.com/a/IkuYlRb
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
Koentje
Level 7
Level 7
Posts: 1581
Joined: Tue Jan 04, 2022 6:23 pm
Location: Netherlands

Re: Need help formatting an edit of conky code please.

Post by Koentje »

dynamic, but after this is a static high and crit temps in parenthesis. I would like the section in paranthesis to be aligned to the right side of the widget.
I'm pretty good with english, but this sound a bit abracadabra to me.. :lol:
Doesn't mean that it's your fault, but could you paraphrase that another way.. in redneck language please :mrgreen:
What is it exactly that you want?

Edit: Already fixed the 'Linux Mint 2x.x <codename>' and desktop name/version for you! ;)
User avatar
Logansfury
Level 6
Level 6
Posts: 1237
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Need help formatting an edit of conky code please.

Post by Logansfury »

Koentje wrote: Fri Jan 19, 2024 8:09 pm What is it exactly that you want?
If you look at the imgur image, you will see under Temperatures that I have 4 lines of info displayed: the fahrenheit/celsius temps of each core, and then the text (High: +84.0°C/Crit: +100.0°C)

The same is true of the GPU temp display.

what I am looking to do, is to separate these 4 lines into 8 lines, with the temperatures aligned on the left of the widget, and the high/crits aligned to the right side with the ${alignl} & ${alignr} codes.

also wanted to split the GPU display the same way, this way the text fills the box made by the conky graphic, and bounces less.

See what I mean? Its all just visual formatting of the text display.
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
Logansfury
Level 6
Level 6
Posts: 1237
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Need help formatting an edit of conky code please.

Post by Logansfury »

Logansfury wrote: Fri Jan 19, 2024 8:26 pm
Koentje wrote: Fri Jan 19, 2024 8:09 pm What is it exactly that you want?
If you look at the imgur image, you will see under Temperatures that I have 4 lines of info displayed: the fahrenheit/celsius temps of each core, and then the text (High: +84.0°C/Crit: +100.0°C)

The same is true of the GPU temp display.

what I am looking to do, is to separate these 4 lines into 8 lines, with the temperatures aligned on the left of the widget, and the high/crits aligned to the right side with the ${alignl} & ${alignr} codes.

I still want it to be 4 lines of display, but each line split into left and right text (5 lines with GPU)

also wanted to split the GPU display the same way, this way the text fills the box made by the conky graphic, and bounces less.

See what I mean? Its all just visual formatting of the text display.
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
Koentje
Level 7
Level 7
Posts: 1581
Joined: Tue Jan 04, 2022 6:23 pm
Location: Netherlands

Re: Need help formatting an edit of conky code please.

Post by Koentje »

What's the last message for? It's just quoting yourself..

But is this what you want? Gpu does not work for me because other driver, but i did the same trick with it as with the cpu temps.
Schermafdruk van 2024-01-20 01-35-28.jpg
Schermafdruk van 2024-01-20 01-35-28.jpg (9.92 KiB) Viewed 823 times

And another thing, you need to learn to use the objects in the new conky way! Old conky's did not use the brackets {}, the new conky objects do! So it's ${hr} not $hr. Same for $mem $memmax $swap etc etc..
Always use brackets!
Another another thing, don't use spaces, but use ${goto xx} instead. That keeps everything alot more aligned, because if you use another font or fontsize somewere in the middle, a space is not the same anymore. ${goto xx} uses pixels!
Last edited by Koentje on Fri Jan 19, 2024 8:43 pm, edited 1 time in total.
User avatar
Logansfury
Level 6
Level 6
Posts: 1237
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Need help formatting an edit of conky code please.

Post by Logansfury »

Hey hey that's perfect :)

Nice and clean with text aligned both on left and right sides of the display area.

May I have the code to reproduce this?

I have been having an issue with some of my posts double and even triple posting. Im not sure whats causing it >.<
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
Koentje
Level 7
Level 7
Posts: 1581
Joined: Tue Jan 04, 2022 6:23 pm
Location: Netherlands

Re: Need help formatting an edit of conky code please.

Post by Koentje »

You probably clicked on the quote button instead of the edit button..

But here we go! I fixed a few other alignment problems and missing brackets.

Code: Select all

--[[
# Minimalis Conky 1.3
# Author : archit3x
# Release date : 4 December 2020
# Tested on : Archlinux ARM - XFCE Desktop
# Email : archit3x@archlinux.us
# Feel free to modity this script ;)
]]

conky.config = {
    alignment = 'top_right',
    background = true,
    border_width = 1,
    cpu_avg_samples = 2,
    default_color = 'gray',
    default_outline_color = 'black',
    default_shade_color = 'white',
    color1 = '#e82127',
    double_buffer = true,
    draw_borders = false,
    draw_graph_borders = true,
    draw_outline = true,
    draw_shades = false,
    extra_newline = false,
    font = 'Neon 80s:size=8',
    gap_x = 30,
    gap_y = 30,
    minimum_height = 410,
    minimum_width = 340,
    net_avg_samples = 2,
    no_buffers = true,
    out_to_console = false,
    out_to_ncurses = false,
    out_to_stderr = false,
    out_to_x = true,
    own_window = true,
    own_window_class = 'Conky',
    own_window_transparent = true,
    own_window_argb_visual = true,
    own_window_type = 'desktop',
    own_window_hints ='undecorated,sticky,skip_taskbar,skip_pager,below',
    show_graph_range = false,
    show_graph_scale = false,
    stippled_borders = 0,
    update_interval = 1.0,
    uppercase = false,
    use_spacer = 'none',
    use_xft = true,
}

conky.text = [[
${color1}${font ConkySymbols:size=20}u${font} ${voffset -10}GNU/Linux ${hr}
${color1}${goto 35}OS      : ${color}${execi 86400 cat /etc/lsb-release | grep 'DISTRIB_DESCRIPTION=' | awk -F'=' '{print $2}'} | ${execi 8640 $(echo $XDG_SESSION_DESKTOP) --version}
${color1}${goto 35}Kernel : ${color}${kernel} on ${machine}

${color1}${font ConkySymbols:size=16}f${font} ${voffset -10} System ${hr}${color}
${alignr}${cpugraph cpu0 50,340 ffff00 ff0000}
${color1}${goto 35}Core 1  : ${color}${freq_g 1}GHz ${alignr}${cpu cpu0}% ${cpubar cpu0 6,100}
${alignr}${cpugraph cpu1 50,340 ffff00 ff0000}
${color1}${goto 35}Core 2 : ${color}${freq_g 2}GHz ${alignr}${cpu cpu1}% ${cpubar cpu1 6,100}
${alignr}${cpugraph cpu2 50,340 ffff00 ff0000}
${color1}${goto 35}Core 3 : ${color}${freq_g 3}GHz ${alignr}${cpu cpu2}% ${cpubar cpu2 6,100}
${alignr}${cpugraph cpu3 50,340 ffff00 ff0000}
${color1}${goto 35}Core 4 : ${color}${freq_g 4}GHz ${alignr}${cpu cpu3}% ${cpubar cpu3 6,100}

${color1}${goto 35}Uptime : ${color}${uptime_short} ${alignr}${color1}Load  : ${color}${loadavg}

${color1}${font ConkySymbols:size=16}h${font}${voffset -10}Temperatures ${hr}${color}
${color1}${goto 35}CPU : ${color}${execp sensors coretemp-isa-0000 -u | grep 'temp[1-4]_input' | awk '{printf "\${goto 68}Core %d: %+0.1fF/%+0.1fC \${alignr}(High: +84.0C/Crit: +100.0C)\n                   ", NR, $2 * 9/5 + 32, $2}'}
${color1}${goto 35}GPU : ${color}${execp sensors | grep -A2 'radeon-pci-0100' | grep 'temp1' | awk '{printf "\${goto 69}+%.1fF/+%.1fC \${alignr}(High: +90.0C/Crit: +120.0C)\n", $2 * 9/5 + 32, $2}'}

${color1}${font ConkySymbols:size=16}L${font} ${voffset -10}Fan Speeds ${hr}${color}
${color1}${goto 35}Processor Fan : ${color}${exec sensors | awk '/Processor Fan:/ {print $3 " RPM"}'}
${color1}${goto 35}Motherboard Fan : ${color}${exec sensors | awk '/Motherboard Fan:/ {print $3 " RPM"}'}

${color1}${font ConkySymbols:size=16}J${font} ${voffset -10}Memory ${hr}${color}
${color1}${goto 35}RAM : ${color}${mem}/${memmax} ${alignr}}${memperc}% ${membar 4,100}
${color1}${goto 35}SWAP: ${color}${swap}/${swapmax} ${alignr}${swapperc}% ${swapbar 4,100}

${color1}${font ConkySymbols:size=16}n${font} ${voffset -10} Processes ${hr}${color}

${color1}${goto 35}CPU usage ${goto 230}Memory Usage${color}
${color1}${goto 35}${stippled_hr}${color}
${goto 35}${top name 1} ${color}${goto 145}${top cpu 1}% ${goto 230}${top_mem name 1}${alignr}${top_mem mem_res 1}
${goto 35}${top name 2} ${color}${goto 145}${top cpu 2}% ${goto 230}${top_mem name 2}${alignr}${top_mem mem_res 2}
${goto 35}${top name 3} ${color}${goto 145}${top cpu 3}% ${goto 230}${top_mem name 3}${alignr}${top_mem mem_res 3}
${goto 35}${top name 4} ${color}${goto 145}${top cpu 4}% ${goto 230}${top_mem name 4}${alignr}${top_mem mem_res 4}

${color1}${goto 35}Processes: ${color}${processes}${color1}${goto 150}Running: ${color}${running_processes}
${alignr}${cpugraph cpu1 50,340 ffff00 ff0000}

${color1}${font ConkySymbols:size=16}k${font} ${voffset -10} Storage ${hr}${color}
${color1}${goto 35}ROOT : ${color}${fs_used /}/${fs_size /} ${alignr}${fs_used_perc /}% ${fs_bar 4,100 /}
${alignr}${diskiograph_read 50,170 ffff00 ff0000} ${alignr}${diskiograph_write 50,170 ffff00 ff0000}
${goto 35}
${color1}${font ConkySymbols:size=16}b${font} ${voffset -10} Wireless ${hr}${color}
${color1}${goto 35}SSID        : ${color}${wireless_essid wlx7cb232bdeee1} ${color1}${alignr}Signal: ${color}${wireless_link_qual_perc wlx7cb232bdeee1}% ${wireless_link_bar 4,100 wlx7cb232bdeee1}
${color1}${goto 35}Bitrate     : ${color}${wireless_bitrate wlx7cb232bdeee1}
${color1}${goto 35}Total Down/Up : ${color}${totaldown wlx7cb232bdeee1}/${totalup wlx7cb232bdeee1}.
${color1}${goto 35}Speed Down/Up : ${color}${downspeed wlx7cb232bdeee1}/${upspeed wlx7cb232bdeee1}
${color1}${goto 35}Local IP : ${color}${exec ip route | grep -oP '(?<=src )(\S+)' | head -n 1}
${alignr}${upspeedgraph wlx7cb232bdeee1 50,170 ffff00 ff0000} ${alignr}${downspeedgraph wlx7cb232bdeee1 50,170 ffff00 ff0000}
${color1}${goto 35}.
]]
Let me know how it works!
Schermafdruk van 2024-01-20 01-56-34.jpg
User avatar
Logansfury
Level 6
Level 6
Posts: 1237
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Need help formatting an edit of conky code please.

Post by Logansfury »

Perfect formatting!

For some reason, the top graphic box is red while the other 3 are white. I didn't see any code to correct this so I overwrote the Temperature section from your .conf edit and I have the nice-looking formatting I was hoping for!

Thanks so much :D

How do you like the new graphs? I installed them with Godzilla's help right after you got me up and running with the Fan speed displays.
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
Koentje
Level 7
Level 7
Posts: 1581
Joined: Tue Jan 04, 2022 6:23 pm
Location: Netherlands

Re: Need help formatting an edit of conky code please.

Post by Koentje »

Logansfury wrote: Fri Jan 19, 2024 9:02 pm For some reason, the top graphic box is red while the other 3 are white.
My fault! I accidentally deleted a ${color}, but i corrected the mistake right after i posted, so you probably got the old code..
Thanks so much :D
You're welcome!
How do you like the new graphs? I installed them with Godzilla's help right after you got me up and running with the Fan speed displays.
Font is too small for my display.. i'm too old for such small fonts haha
But it seems to fit nicely with your color scheme! Post a screenshot if you will..
User avatar
Logansfury
Level 6
Level 6
Posts: 1237
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Need help formatting an edit of conky code please.

Post by Logansfury »

recopied the code you posted and am now using that.

Here is a screenshot: https://imgur.com/a/IkuYlRb
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
Koentje
Level 7
Level 7
Posts: 1581
Joined: Tue Jan 04, 2022 6:23 pm
Location: Netherlands

Re: Need help formatting an edit of conky code please.

Post by Koentje »

Are you sure this isn't an old screenshot?? The cores are not aligned on this one..
User avatar
Logansfury
Level 6
Level 6
Posts: 1237
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Need help formatting an edit of conky code please.

Post by Logansfury »

That might have been an old ss. Here is a current: https://imgur.com/a/TJKlfZ9
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
Koentje
Level 7
Level 7
Posts: 1581
Joined: Tue Jan 04, 2022 6:23 pm
Location: Netherlands

Re: Need help formatting an edit of conky code please.

Post by Koentje »

Cool.. everything seems to work ok!
Post Reply

Return to “Compiz, Conky, Docks & Widgets”