Cannot get transparency on clock background. [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 8
Level 8
Posts: 2375
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Cannot get transparency on clock background. [SOLVED]

Post by Logansfury »

Hello everyone :)

Here is what I am dealing with:

Image

Image on the left is a clock displayed with .lua. Image on the right is biohazzard sign displayed with .lua

As you can see, the clock has an obvious visible outline of the boarder and I cannot get rid of it without breaking the clock.

When I set transparency with the Edit Widget I get this:
Image

Here is the conky code for the biohazzard image:

Code: Select all

--[[
Bleys 2024 

]]
conky.config = {
-- — Conky settings

	background = false,
	total_run_times = 0,
	no_buffers = true,	

-- — Window specifications with Background

	own_window = true,
	own_window_type = dock,
    own_window_hints = 'skip_taskbar,skip_pager,undecorated,above',
    own_window_transparent = false,
	own_window_argb_visual = true,
	own_window_argb_value = 0,
	own_window_colour = '000000', 
	
	double_buffer = true,
	minimum_width = 300, minimum_height = 263,
	alignment = 'middle_middle',
	
	gap_x = 20,
	gap_y = 20,


-- Lua Load
	lua_load = '/home/logansfury/.conky/Biohazzard/pic.lua',
	lua_draw_hook_post = 'main',		
};
conky.text = [[

]];
Here is biohazzard .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/bio_sm.png',150,132,300,263)
	end

   cairo_surface_destroy(cs)
   cairo_destroy(cr)
end
By comparison, here is the clock conkyrc:

Code: Select all

conky.config = {

	background = false,

	alignment = 'middle_middle',
	gap_x = 290,
	gap_y = 20,
	minimum_width = 200,
	minimum_height = 200,
	maximum_width = 200,

--	update_run_times = '0',
	draw_borders = false,
	border_width = 0,
	draw_shades = false,
	draw_graph_borders = false,
    draw_outline = false,
    draw_shades = false,
	double_buffer = true,
	no_buffers = true,
	uppercase = false,
	use_spacer = 'none',


	own_window = true,
	own_window_type = 'desktop',
    own_window_class = 'Conky',
    own_window_hints = 'skip_taskbar,skip_pager,undecorated,above',
    own_window_transparent = true,
	own_window_argb_visual = false,
    own_window_argb_value = 0,
	own_window_colour = '000000', 

	override_utf8_locale = true,
	use_xft = true,
--xftfont Ani Regular:size=12
	xftalpha = 0,

	default_color = '#FFFFFF',
	color1 = '#FFFFFF',

	imlib_cache_flush_interval = 100,
	imlib_cache_size = 2048,
	text_buffer_size = 1024,

	lua_load = 'grey.lua',
	lua_draw_hook_post = 'imlib_clock eigen 200 100 100',

	update_interval = 1,

};

conky.text = [[
#
# Set day of the month in clock  (old day color was #BBBBBB)
${voffset 104}${goto 136}${color ea8e5a}${Font lcdmono2:bold:size=10}${exec date '+%a' | sed 's/^0//g'}
${voffset 96}${goto 128}${image ~/.conky/myclock/images/eigen/back.png -s 46x24 -p 120,98}
]];
and the clock .lua:

Code: Select all

--[[
Simple clock, written using imlib. Edited by Etles_Team (2016)
Make sure you've installed "imlib2" application in your system if this script doesn't work :)

To use this script in Conky, Add this command in conkyrc file before (TEXT), Example :

lua_load ~/.conky/Conky-Name/imlib_clock.lua
lua_draw_hook_pre imlib_clock theme

OR you can add this other command to load script in conkyrc after (TEXT), Example :

${lua imlib_clock theme-name 120 100 100}

]]
---------------------------------------------------------------------------------------------------------

require ('imlib2')

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

function fFreeImage (image)
	imlib_context_set_image(image)
	imlib_free_image ()
end

function fRotateImage (image, arc)
	imlib_context_set_image(image)
	return imlib_create_rotated_image(arc)
end

function fGetImageSize(image)
	imlib_context_set_image(image)
	return imlib_image_get_width(), imlib_image_get_height()
end

function create_clock(theme, arc_s, arc_m, arc_h)

local imgFace =  imlib_load_image(image_path..theme..'/grey_face.png')
local w_img, h_img = fGetImageSize(imgFace)

local imgH =  imlib_load_image(image_path..theme..'/oh.png')
local imgHR = fRotateImage (imgH, arc_h)
local w_imgH, h_imgH = fGetImageSize(imgHR)

local imgM =  imlib_load_image(image_path..theme..'/om.png')
local imgMR = fRotateImage (imgM, arc_m)
local w_imgM, h_imgM = fGetImageSize(imgMR)

local imgS =  imlib_load_image(image_path..theme..'/os.png')
local imgSR = fRotateImage (imgS, arc_s)
local w_imgS, h_imgS = fGetImageSize(imgSR)

--local imgGlass =  imlib_load_image(image_path..theme..'/glass.png')

local buffer = imlib_create_image(w_img, h_img)
	imlib_context_set_image(buffer)
	imlib_image_set_has_alpha(1)
	imlib_image_clear()

imlib_blend_image_onto_image(imgFace, 1, 0, 0, w_img, h_img, 0, 0, w_img, h_img )

imlib_blend_image_onto_image(imgHR, 1, 0, 0, w_imgH, h_imgH, w_img/2-w_imgH/2, h_img/2-h_imgH/2, w_imgH, h_imgH )

imlib_blend_image_onto_image(imgMR, 1, 0, 0, w_imgM, h_imgM, w_img/2-w_imgM/2, h_img/2-h_imgM/2, w_imgM, h_imgM )

imlib_blend_image_onto_image(imgSR, 1, 0, 0, w_imgS, h_imgS, w_img/2-w_imgS/2-1, h_img/2-h_imgS/2-1, w_imgS, h_imgS )

--imlib_blend_image_onto_image(imgGlass, 1, 0, 0, w_img, h_img, 0, 0, w_img, h_img )

	fFreeImage (imgFace)
	fFreeImage (imgH)
	fFreeImage (imgHR)
	fFreeImage (imgM)
	fFreeImage (imgMR)
	fFreeImage (imgS)
	fFreeImage (imgSR)
--	fFreeImage (imgGlass)

	return buffer

end

function conky_imlib_clock(theme,w,x,y)

	if conky_window==nil then return ' ' end

	local w = w or 265
	local x = x or conky_window.width / 2
	local y = y or conky_window.height / 2

	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

	local buffer = create_clock(theme, arc_s, arc_m, arc_h)
	imlib_context_set_image(buffer)

	imlib_render_image_on_drawable_at_size(
		x-w/2, y-w/2, w, w)

	fFreeImage (buffer)

	return ' '
end
--=================================== Regards, Etles_Team =====================================--
I have tried overwriting the window settings of the clock conkyrc with the biohazzard.conkyrc but while this makes the background go away, it also destroys and washes out the image.

Can anyone please help me get rid of this background outline?

Thank you for reading,

Logan
Last edited by Logansfury on Sat Jun 01, 2024 3:54 pm, edited 1 time in total.
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
Koentje
Level 8
Level 8
Posts: 2079
Joined: Tue Jan 04, 2022 6:23 pm
Location: Netherlands

Re: Cannot get transparency on clock background.

Post by Koentje »

Transparency in conky is a princess! But i believe this shadow is a bug in the newer conky on Mint 21 and above..

Have you tried own_window_type = 'dock', ?
Image
User avatar
Logansfury
Level 8
Level 8
Posts: 2375
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Cannot get transparency on clock background.

Post by Logansfury »

Background still outlined when set to "dock" :(
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
trytip
Level 14
Level 14
Posts: 5380
Joined: Tue Jul 05, 2016 1:20 pm

Re: Cannot get transparency on clock background.

Post by trytip »

#all options for own_window_type are normal, desktop, dock, panel or override
i use own_window_type desktop
and in conky manager i use pseudo-transparent which should remove the transparent or semitransparent box
Image
User avatar
Logansfury
Level 8
Level 8
Posts: 2375
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Cannot get transparency on clock background.

Post by Logansfury »

trytip wrote: Fri May 31, 2024 8:13 am #all options for own_window_type are normal, desktop, dock, panel or override
i use own_window_type desktop
and in conky manager i use pseudo-transparent which should remove the transparent or semitransparent box
I have tried Pseudo-Transparent with window type set to both dock and desktop, the outline is still visible. Only when I set full transparency does the entire background including outline disappear, but that also transparentizes the clock face and hands.
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
trytip
Level 14
Level 14
Posts: 5380
Joined: Tue Jul 05, 2016 1:20 pm

Re: Cannot get transparency on clock background.

Post by trytip »

i believe your two images are in conflict. you can only load one .lua image which should be the base of the clock. try the clock only with no other attachments. do other clocks act this way? also a few years ago from Etles_Team the odd imlib_clock.lua cause my .xsession-errors to report gigabytes of imlib errors.
Image
User avatar
Logansfury
Level 8
Level 8
Posts: 2375
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Cannot get transparency on clock background.

Post by Logansfury »

trytip wrote: Fri May 31, 2024 8:47 am i believe your two images are in conflict. you can only load one .lua image which should be the base of the clock. try the clock only with no other attachments. do other clocks act this way? also a few years ago from Etles_Team the odd imlib_clock.lua cause my .xsession-errors to report gigabytes of imlib errors.
This is interesting. The .lua I have displays 4 images: clock-face, hour, minute & second hands.

By comparison, the two conkys I have with .lua drawn clock hands rather than image hands, I have full proper transparency.

So the 3 images of the fancy hands is what is killing me?
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
Logansfury
Level 8
Level 8
Posts: 2375
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Cannot get transparency on clock background. [SOLVED]

Post by Logansfury »

Wolvrik sent me a clock I had asked him to share, and while he was at it, he sent another he thought I would like. He was right, the 2nd clock is beautiful, but most importantly, I made a dupe of its folder, renamed it, swapped out it's graphics for the grey & orange set, and it worked!!

No background, full transparency, full 100% solid display of the clock media in vivid color.

I am very very happy :D
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
Post Reply

Return to “Compiz, Conky, Docks & Widgets”