using Conky to display an image without a window [SOLVED]
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
- Logansfury
- Level 6
- Posts: 1237
- Joined: Fri Oct 27, 2023 4:08 pm
- Location: Las Vegas NV, USA
using Conky to display an image without a window [SOLVED]
Hello everyone,
I would like to run a script to have conky display a .png on the center of my monitor. The .png is a triangular graphic against a transparent background square. I would like conky to display it with no windows visible as if it were opened by an image app.
How would I go about this please?
Thanks for reading,
Logan
I would like to run a script to have conky display a .png on the center of my monitor. The .png is a triangular graphic against a transparent background square. I would like conky to display it with no windows visible as if it were opened by an image app.
How would I go about this please?
Thanks for reading,
Logan
Last edited by Logansfury on Fri Jan 26, 2024 9:22 pm, edited 1 time in total.
- Logansfury
- Level 6
- Posts: 1237
- Joined: Fri Oct 27, 2023 4:08 pm
- Location: Las Vegas NV, USA
Re: using Conky to display an image without a window
I tried to get chatgpt3.5 to assist and it gave the following code:
This was recognized by conky manager 2 as a valid script, and displays the .conf in the widgets selection window, but running it does not display the image on either monitor. I have minimized everything to be sure the image wasnt hiding under a window, it's definitely not being displayed.
Code: Select all
conky.config = {
-- Other conky configurations go here
own_window = true,
own_window_type = 'override',
own_window_transparent = true,
own_window_hints = 'undecorated,below,sticky,skip_taskbar,skip_pager',
double_buffer = true,
}
conky.text = [[
${image /home/logansfury/Pictures/biohazzard.png -p 256,256 -s 500x500}
]]
Re: using Conky to display an image without a window
Logansfury wrote: ⤴Fri Jan 26, 2024 5:20 am
Code: Select all
conky.config = { -- Other conky configurations go here own_window = true, own_window_type = desktop, own_window_transparent = false, own_window_hints = 'undecorated,sticky,skip_taskbar,skip_pager,below', own_window_argb_visual = true, own_window_argb_value = 0, own_window_colour = '000000', double_buffer = true, minimum_width = 500, minimum_height = 500, alignment = 'middle_middle', } conky.text = [[ ${image /home/logansfury/Pictures/biohazzard.png -p 256,256 -s 500x500} ]]
Ryzen 5 5600G, 16GB RAM, 2TB M.2 Crucial P3, Asrock Deskmeet X300, Samsung Odyssey 49", Linux Mint 21
- Logansfury
- Level 6
- Posts: 1237
- Joined: Fri Oct 27, 2023 4:08 pm
- Location: Las Vegas NV, USA
Re: using Conky to display an image without a window
Hello Bleys,
Thank you for the reply!
I edited the code slightly to conform to the picture dimensions but got a bad display:
https://imgur.com/a/w20xPw3
Here is the code:
any ideas why I have only a partial display and my blacks are transparent?
Thank you for the reply!
I edited the code slightly to conform to the picture dimensions but got a bad display:
https://imgur.com/a/w20xPw3
Here is the code:
Code: Select all
conky.config = {
-- Other conky configurations go here
own_window = true,
own_window_type = desktop,
own_window_transparent = false,
own_window_hints = 'undecorated,sticky,skip_taskbar,skip_pager,below',
own_window_argb_visual = true,
own_window_argb_value = 0,
own_window_colour = '000000',
double_buffer = true,
minimum_width = 600, minimum_height = 525,
alignment = 'middle_middle',
}
conky.text = [[
${image /home/logansfury/Pictures/biohazzard.png -p 256,256 -s 600x525}
]]
Re: using Conky to display an image without a window
You will be stuck with a border around the image or a washed out image, good luck!Logansfury wrote: ⤴Fri Jan 26, 2024 5:04 am I would like conky to display it with no windows visible as if it were opened by an image app.
viewtopic.php?p=2216420&hilit=conky#p2216420
Thinkcentre M720Q - LM21.3 cinnamon, 4 x T430 - LM21.3 cinnamon, Homebrew desktop i5-8400+GTX1080 Cinnamon 19.0
- Logansfury
- Level 6
- Posts: 1237
- Joined: Fri Oct 27, 2023 4:08 pm
- Location: Las Vegas NV, USA
Re: using Conky to display an image without a window
Well that's a bummer. I am having issues with a calendar that uses an .lua that is causing a background I dont want. I see your conky is using a beautiful calendar with no boarders or background. May I have the code please?AndyMH wrote: ⤴Fri Jan 26, 2024 10:30 am You will be stuck with a border around the image or a washed out image, good luck!
viewtopic.php?p=2216420&hilit=conky#p2216420
- Logansfury
- Level 6
- Posts: 1237
- Joined: Fri Oct 27, 2023 4:08 pm
- Location: Las Vegas NV, USA
Re: using Conky to display an image without a window
My result was a partial display of the image, completely washed out.AndyMH wrote: ⤴Fri Jan 26, 2024 10:30 am You will be stuck with a border around the image or a washed out image, good luck!
viewtopic.php?p=2216420&hilit=conky#p2216420
Would you know how to edit the code I have to display the image properly with a boarder?
Re: using Conky to display an image without a window
The problem seems that the same calendar that looks great without border on Mint 20 produces a border on Mint 21. Since your on 21.3 that border is there...Logansfury wrote: ⤴Fri Jan 26, 2024 10:57 am Well that's a bummer. I am having issues with a calendar that uses an .lua that is causing a background I dont want. I see your conky is using a beautiful calendar with no boarders or background. May I have the code please?
Re: using Conky to display an image without a window
What i do when i'm working with transparent windows, set theLogansfury wrote: ⤴Fri Jan 26, 2024 11:00 am My result was a partial display of the image, completely washed out.
Would you know how to edit the code I have to display the image properly with a boarder?
own_window_colour = '000000',
temporary to 200000
. This way you get a redish window and now you see the borders of the window you are working with.I see you set your window dimension
minimum_width = 600, minimum_height = 525,
but you place you picture halve way the window ${image /home/logansfury/Pictures/biohazzard.png -p 256,256 -s 600x525}
with 256,256. No wonder you get half the picture! Change these values to 1,1
. If it still does not fit, increase the window dimension, or decrease the picture size.Problem with black is that it is transparent if arg value is 0. Why do you think your window is transparent on
000000
but completely white on FFFFFF
. Conky and transparency is a b.i.t.c.h.! - Logansfury
- Level 6
- Posts: 1237
- Joined: Fri Oct 27, 2023 4:08 pm
- Location: Las Vegas NV, USA
Re: using Conky to display an image without a window
Hey hey!
That got me somewhere!
The whole image is now displayed but the yellow is washed out and the black areas are showing transparent
That got me somewhere!
The whole image is now displayed but the yellow is washed out and the black areas are showing transparent
- Logansfury
- Level 6
- Posts: 1237
- Joined: Fri Oct 27, 2023 4:08 pm
- Location: Las Vegas NV, USA
Re: using Conky to display an image without a window
Has anyone got time to provide an example of code to display this image in a window? I would like to see what that looks like and if it does prevent the washout and black color-transparency issue.
Re: using Conky to display an image without a window
If the image is to be displayed without transparency, LUA must be used:Logansfury wrote: ⤴Fri Jan 26, 2024 2:05 pm The whole image is now displayed but the yellow is washed out and the black areas are showing transparent
save as pic.lua
Code: Select all
--[[
2024 Bleys
]]
require 'cairo'
require "imlib2"
home_path = os.getenv ('HOME')
function fDrawImage(cr,path,xx,yy,ww,hh,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, xx, yy)
if arc then
cairo_rotate (cr, arc)
end
cairo_scale (cr, ww/w_img, hh/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
function conky_main()
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>4 then
fDrawImage(cr,'/home/logansfury/Pictures/biohazzard.png',0,0,500,500)
end
cairo_surface_destroy(cs)
cairo_destroy(cr)
end
Code: Select all
--[[
Bleys 2024
]]
conky.config = {
-- — Conky settings
background = false,
update_interval = 1,
total_run_times = 0,
no_buffers = true,
-- — Window specifications with Background
own_window = true,
own_window_type = desktop,
own_window_transparent = false,
own_window_hints = 'undecorated,sticky,skip_taskbar,skip_pager,below',
own_window_argb_visual = true,
own_window_argb_value = 0,
own_window_colour = '000000',
double_buffer = true,
minimum_width = 500, minimum_height = 500,
alignment = 'middle_middle',
gap_x = 20,
gap_y = 20,
-- Lua Load
lua_load = './pic.lua',
lua_draw_hook_post = 'main',
};
conky.text = [[
]];
Ryzen 5 5600G, 16GB RAM, 2TB M.2 Crucial P3, Asrock Deskmeet X300, Samsung Odyssey 49", Linux Mint 21
- Logansfury
- Level 6
- Posts: 1237
- Joined: Fri Oct 27, 2023 4:08 pm
- Location: Las Vegas NV, USA
Re: using Conky to display an image without a window
I have copied these scripts into the proper files, only editing the 500x500 dimensions to the 600x525 that is the actual image size. I am getting no display when running the conkyrc from CM2 windowBleys wrote: ⤴Fri Jan 26, 2024 6:07 pmIf the image is to be displayed without transparency, LUA must be used:Logansfury wrote: ⤴Fri Jan 26, 2024 2:05 pm The whole image is now displayed but the yellow is washed out and the black areas are showing transparent
save as pic.luaconkyrcCode: Select all
--[[ 2024 Bleys ]] require 'cairo' require "imlib2" home_path = os.getenv ('HOME') function fDrawImage(cr,path,xx,yy,ww,hh,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, xx, yy) if arc then cairo_rotate (cr, arc) end cairo_scale (cr, ww/w_img, hh/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 function conky_main() 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>4 then fDrawImage(cr,'/home/logansfury/Pictures/biohazzard.png',0,0,500,500) end cairo_surface_destroy(cs) cairo_destroy(cr) end
Code: Select all
--[[ Bleys 2024 ]] conky.config = { -- — Conky settings background = false, update_interval = 1, total_run_times = 0, no_buffers = true, -- — Window specifications with Background own_window = true, own_window_type = desktop, own_window_transparent = false, own_window_hints = 'undecorated,sticky,skip_taskbar,skip_pager,below', own_window_argb_visual = true, own_window_argb_value = 0, own_window_colour = '000000', double_buffer = true, minimum_width = 500, minimum_height = 500, alignment = 'middle_middle', gap_x = 20, gap_y = 20, -- Lua Load lua_load = './pic.lua', lua_draw_hook_post = 'main', }; conky.text = [[ ]];
Re: using Conky to display an image without a window
If you do not start conky in the directory that contains the conkyrc and pic.lua you have to enter the complete path to pic.lua in the conkyrc line 32Logansfury wrote: ⤴Fri Jan 26, 2024 6:20 pm
I have copied these scripts into the proper files, only editing the 500x500 dimensions to the 600x525 that is the actual image size. I am getting no display when running the conkyrc from CM2 window
Ryzen 5 5600G, 16GB RAM, 2TB M.2 Crucial P3, Asrock Deskmeet X300, Samsung Odyssey 49", Linux Mint 21
- Logansfury
- Level 6
- Posts: 1237
- Joined: Fri Oct 27, 2023 4:08 pm
- Location: Las Vegas NV, USA
Re: using Conky to display an image without a window
I edited the lua file path and tried launching, but got no display. I then used Start in Terminal and got this output:
Code: Select all
conky: desktop window (600010) is subwindow of root window (6cb)
conky: window type - normal
conky: drawing to created window (0x6a00002)
conky: drawing to double buffer
conky: llua_load: /home/logansfury/.conky/Biohazzard/pic.lua:34: attempt to index a nil value (global 'conky')
conky: llua_do_call: function conky_main execution failed: attempt to call a nil value
conky: llua_do_call: function conky_main execution failed: attempt to call a nil value
Re: using Conky to display an image without a window
pic.lua Line 34 is empty. Post your pic.lua
Ryzen 5 5600G, 16GB RAM, 2TB M.2 Crucial P3, Asrock Deskmeet X300, Samsung Odyssey 49", Linux Mint 21
- Logansfury
- Level 6
- Posts: 1237
- Joined: Fri Oct 27, 2023 4:08 pm
- Location: Las Vegas NV, USA
Re: using Conky to display an image without a window
current pic.lua
Code: Select all
--[[
Bleys 2024
]]
conky.config = {
-- — Conky settings
background = false,
update_interval = 1,
total_run_times = 0,
no_buffers = true,
-- — Window specifications with Background
own_window = true,
own_window_type = desktop,
own_window_transparent = false,
own_window_hints = 'undecorated,sticky,skip_taskbar,skip_pager,below',
own_window_argb_visual = true,
own_window_argb_value = 0,
own_window_colour = '000000',
double_buffer = true,
minimum_width = 600, minimum_height = 525,
alignment = 'middle_middle',
gap_x = 20,
gap_y = 20,
-- Lua Load
lua_load = './pic.lua',
lua_draw_hook_post = 'main',
};
conky.text = [[
]];
Re: using Conky to display an image without a window
o_O
This is conkyrc....
Ryzen 5 5600G, 16GB RAM, 2TB M.2 Crucial P3, Asrock Deskmeet X300, Samsung Odyssey 49", Linux Mint 21
- Logansfury
- Level 6
- Posts: 1237
- Joined: Fri Oct 27, 2023 4:08 pm
- Location: Las Vegas NV, USA
Re: using Conky to display an image without a window
holy crap.
OK I obviously had some mispastes. Lemme go back and correct that >.<
OK I obviously had some mispastes. Lemme go back and correct that >.<
- Logansfury
- Level 6
- Posts: 1237
- Joined: Fri Oct 27, 2023 4:08 pm
- Location: Las Vegas NV, USA
Re: using Conky to display an image without a window
OOOOOOOOOO!!!
Were on our way! I just got brilliant full color, transparent background display of a portion of the .png!!!
Please see here: https://imgur.com/a/CcuNSzW
How would I edit to get complete display? Is working with a smaller picture necessary?
Were on our way! I just got brilliant full color, transparent background display of a portion of the .png!!!
Please see here: https://imgur.com/a/CcuNSzW
How would I edit to get complete display? Is working with a smaller picture necessary?