Closed quiltedstars closed 1 year ago
require "imlib2"
function image (im)
local x = (im.x or 0)
local y = (im.y or 0)
local w = (im.w or 0)
local h = (im.h or 0)
local file = tostring (im.file)
if file == nil then print ("set image file") end
local show = imlib_load_image (file)
if show == nil then return end
imlib_context_set_image (show)
if tonumber (w) == 0 then
width = imlib_image_get_width ()
else
width = tonumber (w)
end
if tonumber (h) == 0 then
height = imlib_image_get_height ()
else
height = tonumber (h)
end
imlib_context_set_image (show)
local scaled = imlib_create_cropped_scaled_image (0, 0,
imlib_image_get_width (), imlib_image_get_height (), width, height)
imlib_free_image ()
imlib_context_set_image (scaled)
imlib_render_image_on_drawable (x, y)
imlib_free_image ()
show = nil
end
--Call: image ({x = 100, y = 100, h = 50, w = 50, file = "/path/to/image"})
source: brndnmtthws WIKI
This issue is stale because it has been open 365 days with no activity. Remove stale label or comment, or this issue will be closed in 30 days.
This issue was closed because it has been stalled for 30 days with no activity.
Issue
Scripting lua with rounded corners requires adding a background colour for it to appear in Conky (and therefore requires the background in conkyrc to be transparent). However, when I add images into the conkyrc file, Lua draws the background overtop of the images, even though text and bars appear correctly. Changing the alpha in lua to 0 shows that the images are rendered in conkyrc, and removing the background colour in lua and adding it in conky eliminates the rounded corners.
Information
I believe this issue should be OS/version agnostic.
To replicate, append these to their respective spots:
Is there a way to change this, either within lua or within the conf file? I can only barely make my way around lua, so I don't know how to add an image into lua, and I've tried to search, but haven't found anything. I apologize if it's obvious to most!