Conky Showoff thread

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.
User avatar
all41
Level 19
Level 19
Posts: 9473
Joined: Tue Dec 31, 2013 9:12 am
Location: Computer, Car, Cage

Re: Conky Showoff thread

Post by all41 »

wow--I see the lua extensions used in ways I never imagined.-definite 8)
Jumped those hoops--spent untold hours--
Now I'm minimilist--just show the info--not the wow factor.
I am a happier person now.
Everything in life was difficult before it became easy.
User avatar
Bleys
Level 4
Level 4
Posts: 425
Joined: Wed Apr 20, 2022 4:17 am
Location: Essen, Germany

Re: Conky Showoff thread

Post by Bleys »

LUA framework for vertical bars:

Code: Select all

require 'cairo'
settings_table = {
 {
        name        =   'cpu',
        arg         =   'cpu1',
        max         =   100,
        width       =   2,
        height      =   20,
        x=156, y=100,
        bg_colour=0xffffff,
        bg_alpha=0.2,
        fg_colour=0xffffff,
        fg_alpha=0.8
    },
 {
        name        =   'cpu',
        arg         =   'cpu2',
        max         =   100,
        width       =   2,
        height      =   20,
        x=159, y=100,
        bg_colour=0xffffff,
        bg_alpha=0.2,
        fg_colour=0x97ffff,
        fg_alpha=0.8
    },
 {
        name        =   'cpu',
        arg         =   'cpu3',
        max         =   100,
        width       =   2,
        height      =   20,
        x=162, y=100,
        bg_colour=0xffffff,
        bg_alpha=0.2,
        fg_colour=0xffffff,
        fg_alpha=0.8
    },
 {
        name        =   'cpu',
        arg         =   'cpu4',
        max         =   100,
        width       =   2,
        height      =   20,
        x=165, y=100,
        bg_colour=0xffffff,
        bg_alpha=0.2,
        fg_colour=0x97ffff,
        fg_alpha=0.8
    },
 {
        name        =   'cpu',
        arg         =   'cpu5',
        max         =   100,
        width       =   2,
        height      =   20,
        x=168, y=100,
        bg_colour=0xffffff,
        bg_alpha=0.2,
        fg_colour=0xffffff,
        fg_alpha=0.8
    },
 {
        name        =   'cpu',
        arg         =   'cpu6',
        max         =   100,
        width       =   2,
        height      =   20,
        x=171, y=100,
        bg_colour=0xffffff,
        bg_alpha=0.2,
        fg_colour=0x97ffff,
        fg_alpha=0.8
    },
 {
        name        =   'cpu',
        arg         =   'cpu7',
        max         =   100,
        width       =   2,
        height      =   20,
        x=174, y=100,
        bg_colour=0xffffff,
        bg_alpha=0.2,
        fg_colour=0xffffff,
        fg_alpha=0.8
    },
 {
        name        =   'cpu',
        arg         =   'cpu8',
        max         =   100,
        width       =   2,
        height      =   20,
        x=177, y=100,
        bg_colour=0xffffff,
        bg_alpha=0.2,
        fg_colour=0x97ffff,
        fg_alpha=0.8
    },
}
function hex_to_rgba(colour,alpha)
	return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end
function draw_bar(cr,pct,pt)

    h=pct*pt['height']
    local bgc, bga, fgc, fga=pt['bg_colour'], pt['bg_alpha'], pt['fg_colour'], pt['fg_alpha']
--  Background
    cairo_rectangle(cr, pt['x'], pt['y'], pt['width'], -pt['height'])
    cairo_set_source_rgba(cr,hex_to_rgba(bgc,bga))
    cairo_fill(cr)
--  Indicator
    cairo_rectangle(cr, pt['x'], pt['y'], pt['width'], -h)
    cairo_set_source_rgba(cr,hex_to_rgba(fgc,fga))
    cairo_fill(cr)

    cairo_stroke (cr)
end

function conky_main()
    local function setup(cr,pt)
        local str=''
        local value=0
        str=string.format('${%s %s}',pt['name'],pt['arg'])
        str=conky_parse(str)
        value=tonumber(str)
        if value == nil then value = 0 end
        pct=value/pt['max']

        draw_bar(cr,pct,pt)

    end
 
    if conky_window == nil then return end
    local cs=cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
    local cr=cairo_create(cs)
    local updates=conky_parse('${updates}')
    update_num=tonumber(updates)
    if update_num>5 then
        for i in pairs(settings_table) do
            setup(cr,settings_table[i])
        end
    end
    cairo_surface_destroy(cs)
    cairo_destroy(cr)
end[attachment=0]Bildschirmfoto vom 2022-05-09 08-39-39.png[/attachment]
Attachments
Bildschirmfoto vom 2022-05-09 08-39-39.png
Bildschirmfoto vom 2022-05-09 08-39-39.png (3.88 KiB) Viewed 2093 times
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: 425
Joined: Wed Apr 20, 2022 4:17 am
Location: Essen, Germany

Re: Conky Showoff thread

Post by Bleys »

Elipse and vBars combi:

Code: Select all

require 'cairo'
settings_table = {
 {
        name='freq',            arg='1',
        max=4000,
        width=2,                height=20,
        x=137,                  y=140,
        bg_color=0xffffff,      bg_alpha=0.2,
        fg_color=0xffffff,      fg_alpha=0.8,
        typ=1
    },
 {
        name='freq',            arg='2',
        max=4000,
        width=2,                height=20,
        x=140,                  y=140,
        bg_color=0xffffff,      bg_alpha=0.2,
        fg_color=0xffffff,      fg_alpha=0.8,
        typ=1
    },
 {
        name='freq',            arg='3',
        max=4000,
        width=2,                height=20,
        x=143,                  y=140,
        bg_color=0xffffff,      bg_alpha=0.2,
        fg_color=0xffffff,      fg_alpha=0.8,
        typ=1
    },
 {
        name='freq',            arg='4',
        max=4000,
        width=2,                height=20,
        x=146,                  y=140,
        bg_color=0xffffff,      bg_alpha=0.2,
        fg_color=0xffffff,      fg_alpha=0.8,
        typ=1
    },
 {
        name='cpu',             arg='cpu1',
        max=100,
        bg_color=0xffffff,      bg_alpha=0.2,
        fg_color=0xffffff,      fg_alpha=1.0,
        x=30,                   y=108,
        thickness=3,
        width=220,              height=30,
        start_angle=-150,       end_angle=0,
        typ=2
    },
 {
        name='cpu',             arg='cpu2',
        max=100,
        bg_color=0xffffff,      bg_alpha=0.2,
        fg_color=0xffffff,      fg_alpha=1.0,
        x=34,                   y=108,
        thickness=3,
        width=220,              height=30,
        start_angle=0,          end_angle=150,
        reverse=1,
        typ=2
    },
 {
        name='cpu',             arg='cpu3',
        max=100,
        bg_color=0xffffff,      bg_alpha=0.2,
        fg_color=0xffffff,      fg_alpha=1.0,
        x=30,                   y=112,
        thickness=3,
        width=220,              height=30,
        start_angle=-150,       end_angle=0,
        typ=2
    },
 {
        name='cpu',             arg='cpu4',
        max=100,
        bg_color=0xffffff,      bg_alpha=0.2,
        fg_color=0xffffff,      fg_alpha=1.0,
        x=34,                   y=112,
        thickness=3,
        width=220,              height=30,
        start_angle=0,          end_angle=150,
        reverse=1,
        typ=2
    },
 
}
function hex_to_rgba(color,alpha)
	return ((color / 0x10000) % 0x100) / 255., ((color / 0x100) % 0x100) / 255., (color % 0x100) / 255., alpha
end

function draw_bar(cr,pct,pt)

    h=pct*pt['height']
    local bgc, bga, fgc, fga=pt['bg_color'], pt['bg_alpha'], pt['fg_color'], pt['fg_alpha']
--  Background
    cairo_rectangle(cr, pt['x'], pt['y'], pt['width'], -pt['height'])
    cairo_set_source_rgba(cr,hex_to_rgba(bgc,bga))
    cairo_fill(cr)
--  Indicator
    cairo_rectangle(cr, pt['x'], pt['y'], pt['width'], -h)
    cairo_set_source_rgba(cr,hex_to_rgba(fgc,fga))
    cairo_fill(cr)

    cairo_stroke (cr)
end

function draw_ring(cr,t,pt)
	local w,h=conky_window.width,conky_window.height	
	local xc,yc,ring_r,ring_w,sa,ea=pt['x'],pt['y'],pt['radius'],pt['thickness'],pt['start_angle'],pt['end_angle']
	local bgc, bga, fgc, fga=pt['bg_color'], pt['bg_alpha'], pt['fg_color'], pt['fg_alpha']
    local dir=pt['reverse']
	local angle_0=sa*(2*math.pi/360)-math.pi/2
	local angle_f=ea*(2*math.pi/360)-math.pi/2
	local t_arc=t*(angle_f-angle_0)
    local width=pt['width']
    local height=pt['height']

	-- background ring
    cairo_save (cr)
    cairo_translate (cr, xc + width / 2.0, yc + height / 2.0)
    cairo_scale (cr, width / 2.0, height / 2.0)
    cairo_arc (cr, 0.0, 0.0, 1.0, angle_0, angle_f)
    cairo_restore (cr) 
	cairo_set_source_rgba(cr,hex_to_rgba(bgc,bga))
	cairo_set_line_width(cr,ring_w)
	cairo_stroke(cr)
	
	-- indicator ring)

    cairo_save (cr)
    cairo_translate (cr, xc + width / 2.0, yc + height / 2.0)
    cairo_scale (cr, width / 2.0, height / 2.0)
    if dir==1 then
        cairo_arc (cr, 0.0, 0.0, 1.0, angle_0, angle_0+t_arc)
    else
        cairo_arc (cr, 0.0, 0.0, 1.0,angle_f-t_arc,angle_f)
    end
    cairo_restore (cr) 
	cairo_set_source_rgba(cr,hex_to_rgba(fgc,fga))
	cairo_set_line_width(cr,ring_w)
	cairo_stroke(cr)	
end

function conky_main()
    local function get_conky_values(cr,pt)
        local str=''
        local value=0
        str=string.format('${%s %s}',pt['name'],pt['arg'])
        str=conky_parse(str)
        value=tonumber(str)
        if value == nil then value = 0 end
        pct=value/pt['max']
        if pt['typ'] == 1 then
            draw_bar(cr,pct,pt)
        else
            draw_ring(cr,pct,pt)
        end
    end
 
    if conky_window == nil then return end
    local cs=cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
    local cr=cairo_create(cs)
    local updates=conky_parse('${updates}')
    update_num=tonumber(updates)
    if update_num>3 then
        for i in pairs(settings_table) do
            get_conky_values(cr,settings_table[i])
        end
    end
    cairo_surface_destroy(cs)
    cairo_destroy(cr)
end[attachment=0]Bildschirmfoto vom 2022-05-09 09-13-12.png[/attachment]
Attachments
Bildschirmfoto vom 2022-05-09 09-13-12.png
Bildschirmfoto vom 2022-05-09 09-13-12.png (6.95 KiB) Viewed 2085 times
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: 425
Joined: Wed Apr 20, 2022 4:17 am
Location: Essen, Germany

Re: Conky Showoff thread

Post by Bleys »

It always frustrated me to see the most incredible concys, where I just couldn't understand the included LUA scripts. So i started to lern LUA and Cairo.
I hope my little "tutorial" fetches a bit against this frustration ;)
Last edited by Bleys on Tue Jul 05, 2022 11:10 pm, edited 1 time in total.
Ryzen 5 5600G, 16GB RAM, 2TB M.2 Crucial P3, Asrock Deskmeet X300, Samsung Odyssey 49", Linux Mint 21
User avatar
rossdv8
Level 7
Level 7
Posts: 1737
Joined: Wed Apr 23, 2014 4:48 am
Location: Within 2,000 kilometres of Alice Springs, Australia
Contact:

Re: Conky Showoff thread

Post by rossdv8 »

For those of us 'oldies' who started out in the days where there just weren't any GUIs to do things, I suppose it was different, because often we had write programs to place things so they could be printed out in particular positions on a sheet of paper.
So figuring out the Conky scripts and positioning them on a screen, and even using specific colours, like my Minty Green conky, are fairly simple/

The ones I am especially pleased to see are those who have never really had to program anything manually, who sit patiently and learn how the scripts work - then do relatively wonderful things that float on the layer of screen between the wallpaper and the Apps :-)
Current main OS: MInt 21.3 with KDE Plasma 5.27 (using Compiz as WM) - Kernel: 6.5.0-15 on Lenovo m900 Tiny, i5-6400T (intel HD 530 graphics) 16GB RAM.
Sharks usually only attack you if you are wet
User avatar
trytip
Level 14
Level 14
Posts: 5371
Joined: Tue Jul 05, 2016 1:20 pm

Re: Conky Showoff thread

Post by trytip »

Image

ANCLOCK_HARRISON_H4_CONKY

path: (create a folder named clocks inside your $HOME.conky and drop the h4 folders there)

Code: Select all

.conky/clocks/ANCLOCK_HARRISON_H4
.conky/clocks/ANCLOCK_HARRISON_H4_BIG
ps: made for 1920x1080, you can edit for resolution
Last edited by trytip on Tue May 24, 2022 6:46 pm, edited 1 time in total.
Image
User avatar
Bleys
Level 4
Level 4
Posts: 425
Joined: Wed Apr 20, 2022 4:17 am
Location: Essen, Germany

Re: Conky Showoff thread

Post by Bleys »

i still play with lua ;)
Bildschirmfoto.jpg
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: 425
Joined: Wed Apr 20, 2022 4:17 am
Location: Essen, Germany

Re: Conky Showoff thread

Post by Bleys »

trytip wrote: Mon May 09, 2022 7:51 am ANCLOCK_HARRISON_H4_CONKY
Access denied...
Bildschirmfoto.jpg
Ryzen 5 5600G, 16GB RAM, 2TB M.2 Crucial P3, Asrock Deskmeet X300, Samsung Odyssey 49", Linux Mint 21
User avatar
karlchen
Level 23
Level 23
Posts: 18157
Joined: Sat Dec 31, 2011 7:21 am
Location: Germany

Re: Conky Showoff thread

Post by karlchen »

<mod>
Split off help request by TinMan1325 can be found in this dedicated thread now: How to get Specific Conky scripts to work?.
</mod>
Image
The people of Alderaan have been bravely fighting back the clone warriors sent out by the unscrupulous Sith Lord Palpatine for 750 days now.
Lifeline
User avatar
trytip
Level 14
Level 14
Posts: 5371
Joined: Tue Jul 05, 2016 1:20 pm

Re: Conky Showoff thread

Post by trytip »

edit:
Last edited by trytip on Tue May 24, 2022 6:46 pm, edited 1 time in total.
Image
User avatar
Bleys
Level 4
Level 4
Posts: 425
Joined: Wed Apr 20, 2022 4:17 am
Location: Essen, Germany

Re: Conky Showoff thread

Post by Bleys »

trytip wrote: Tue May 24, 2022 11:51 am
Bleys wrote: Fri May 20, 2022 11:37 pm Access denied...
don't understand. is download not possible? what are you asking?
Bildschirmfoto vom 2022-05-24 19-34-38.png
Translation: "You need access
Request access or switch to an account with access permission."
Ryzen 5 5600G, 16GB RAM, 2TB M.2 Crucial P3, Asrock Deskmeet X300, Samsung Odyssey 49", Linux Mint 21
User avatar
trytip
Level 14
Level 14
Posts: 5371
Joined: Tue Jul 05, 2016 1:20 pm

Re: Conky Showoff thread

Post by trytip »

edit:
Last edited by trytip on Tue May 24, 2022 6:47 pm, edited 1 time in total.
Image
User avatar
Bleys
Level 4
Level 4
Posts: 425
Joined: Wed Apr 20, 2022 4:17 am
Location: Essen, Germany

Re: Conky Showoff thread

Post by Bleys »

trytip wrote: Tue May 24, 2022 4:14 pm i still do not know what you mean. it's on a google account , are you signed in to google? looks like google protocol limit user now only to those signed in. i have no where else to upload it to, and i do not want to make new accounts. please be specific as to why you can not download.
Of course I am logged in with my Google account. You have restricted access to the file.

By the way. A clock via Lua should not load the computer: https://vimeo.com/713438288
Ryzen 5 5600G, 16GB RAM, 2TB M.2 Crucial P3, Asrock Deskmeet X300, Samsung Odyssey 49", Linux Mint 21
User avatar
trytip
Level 14
Level 14
Posts: 5371
Joined: Tue Jul 05, 2016 1:20 pm

Re: Conky Showoff thread

Post by trytip »

Bleys wrote: Tue May 24, 2022 4:30 pm
try this, looks like google restricted all my files without telling me.
ANCLOCK_HARRISON_H4_CONKY
Image
User avatar
Bleys
Level 4
Level 4
Posts: 425
Joined: Wed Apr 20, 2022 4:17 am
Location: Essen, Germany

Re: Conky Showoff thread

Post by Bleys »

trytip wrote: Tue May 24, 2022 6:44 pm try this, looks like google restricted all my files without telling me.
a few changes that prevent RAM from filling up:

Code: Select all

require 'cairo'

image_path = os.getenv ('HOME')..'/.conky/clocks/ANCLOCK_HARRISON_H4/images/'

function conky_main(w,x,y)
	if conky_window==nil then return ' ' end
        local w = w or 200
        local x = x or conky_window.width / 2
        local y = y or conky_window.height / 2

	local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
	local cr = cairo_create (cs)
    	local function fDrawImage(path,x,y,w,h,arc)
    		cairo_save (cr)
	    	local img =  cairo_image_surface_create_from_png(path)
	    	local w_img, h_img = cairo_image_surface_get_width(img), cairo_image_surface_get_height(img)		
	    	cairo_translate (cr, x, y)
	    	if arc then
	        	cairo_rotate (cr, arc)
	    	end
	    	cairo_scale (cr, w/w_img, h/h_img)
	    	cairo_set_source_surface (cr, img, -w_img/2, -h_img/2)
	    	cairo_paint (cr)		
	    	cairo_surface_destroy (img)
	    	collectgarbage ()
    		cairo_restore (cr)
    	end

	local arc_s = (2 * math.pi / 60) * os.date("%S")
	local arc_m = (2 * math.pi / 60) * os.date("%M") + arc_s / 60
	local arc_h = (2 * math.pi / 12) * os.date("%I") + arc_m / 12

    	fDrawImage(image_path..'base.png',x,y,w,w)
    	fDrawImage(image_path..'h.png',x,y,w,w,arc_h)
    	fDrawImage(image_path..'m.png',x,y,w,w,arc_m)
    	fDrawImage(image_path..'s.png',x,y,w,w,arc_s)

	cairo_surface_destroy(cs)
    	cairo_destroy(cr)
    	return ' '
end
Ryzen 5 5600G, 16GB RAM, 2TB M.2 Crucial P3, Asrock Deskmeet X300, Samsung Odyssey 49", Linux Mint 21
User avatar
trytip
Level 14
Level 14
Posts: 5371
Joined: Tue Jul 05, 2016 1:20 pm

Re: Conky Showoff thread

Post by trytip »

Bleys wrote: Tue May 24, 2022 7:10 pm a few changes that prevent RAM from filling up:
i'll test that, thanx. the big clock uses more cpu and ram because the base.png is LARGE 1500x1500. if i lower the resolution for base.png my cpu usage for conky is also lower. i made it this large without thinking of optimizing it yet. but for today's modern 8 core cpu there should be no issues. one of these days i'll have one of those fancy new computers and won't need to optimize for performance.
thanx again for the code
Image
User avatar
rossdv8
Level 7
Level 7
Posts: 1737
Joined: Wed Apr 23, 2014 4:48 am
Location: Within 2,000 kilometres of Alice Springs, Australia
Contact:

Re: Conky Showoff thread

Post by rossdv8 »

i'll test that, thanx. the big clock uses more cpu and ram because the base.png is LARGE 1500x1500. if i lower the resolution for base.png my cpu usage for conky is also lower.
If you still like that png, but want to reduce its size without losing too much quality, you could play around with imagemagick, (search giggle or duckduckgo for fred's imnagemagick scripts for more about that) or possibly, check out pngquant, which is in the repos.
https://pngquant.org/ sudo apt install pngquant
Don't be too put off by 'lossy' in the description. I used it a lot for web maintenance when clients submitted huge png files that had to go in their websites and blogs. It is worth having a play with, particularly as it retains any transparency in the png.

Both are command line tools so you can just open a Terminal in the folder where your image is and copy/paste the filename.
Current main OS: MInt 21.3 with KDE Plasma 5.27 (using Compiz as WM) - Kernel: 6.5.0-15 on Lenovo m900 Tiny, i5-6400T (intel HD 530 graphics) 16GB RAM.
Sharks usually only attack you if you are wet
User avatar
Bleys
Level 4
Level 4
Posts: 425
Joined: Wed Apr 20, 2022 4:17 am
Location: Essen, Germany

Re: Conky Showoff thread

Post by Bleys »

Posting a Conky screenshot ends with "File too large"? A nearly 300kb large image? Seriously?

Sorry, but either find a hoster that 300kb are not too big (lol...) or work with an image editor on the quality until it is no longer too large. For this I simply lack the desire...

by the way: there is not even an information how large images may be.

I'm out of here
Ryzen 5 5600G, 16GB RAM, 2TB M.2 Crucial P3, Asrock Deskmeet X300, Samsung Odyssey 49", Linux Mint 21
User avatar
Koentje
Level 6
Level 6
Posts: 1488
Joined: Tue Jan 04, 2022 6:23 pm
Location: Netherlands

Re: Conky Showoff thread

Post by Koentje »

Bleys wrote: Wed Jun 01, 2022 9:09 pm Posting a Conky screenshot ends with "File too large"? A nearly 300kb large image? Seriously?

Sorry, but either find a hoster that 300kb are not too big (lol...) or work with an image editor on the quality until it is no longer too large. For this I simply lack the desire...

by the way: there is not even an information how large images may be.

I'm out of here
Glad i'm not the only one who finds that limit ridiculous!
User avatar
rossdv8
Level 7
Level 7
Posts: 1737
Joined: Wed Apr 23, 2014 4:48 am
Location: Within 2,000 kilometres of Alice Springs, Australia
Contact:

Re: Conky Showoff thread

Post by rossdv8 »

Bleys wrote: Wed Jun 01, 2022 9:09 pm Posting a Conky screenshot ends with "File too large"? A nearly 300kb large image? Seriously?

Sorry, but either find a hoster that 300kb are not too big (lol...) or work with an image editor on the quality until it is no longer too large. For this I simply lack the desire...

by the way: there is not even an information how large images may be.

I'm out of here
The image size limit is simply to keep people like me posting huge .png files and clogginh up the forum's servers. Hosting costs quite a lot, even these days, and especially considering the number of people who use Mint Forums.

Imgur is a good example of a FREE hosting site, and is 'drag and drop', so you can just dump your screenshot onto the page, grab a link from the list (choose the link for Forums and Bulletin boards'), and paste it into your post. Not sure about the lack of desire part of the post, but it is so easy, even I manage it!

https://imgur.com/
Current main OS: MInt 21.3 with KDE Plasma 5.27 (using Compiz as WM) - Kernel: 6.5.0-15 on Lenovo m900 Tiny, i5-6400T (intel HD 530 graphics) 16GB RAM.
Sharks usually only attack you if you are wet
Locked

Return to “Compiz, Conky, Docks & Widgets”