XUL window transparency, linux | Xlib

Talk about code development, features, specific bugs, enhancements, patches, and similar things.
Forum rules
Please keep everything here strictly on-topic.
This board is meant for Pale Moon source code development related subjects only like code snippets, patches, specific bugs, git, the repositories, etc.

This is not for tech support! Please do not post tech support questions in the "Development" board!
Please make sure not to use this board for support questions. Please post issues with specific websites, extensions, etc. in the relevant boards for those topics.

Please keep things on-topic as this forum will be used for reference for Pale Moon development. Expect topics that aren't relevant as such to be moved or deleted.
machinedgod

XUL window transparency, linux | Xlib

Unread post by machinedgod » 2019-06-05, 20:37

Hi all,
I'm trying to hack in background transparency, only for browser screen estate, and only using the compositor.
I asked about this on IRC, and was directed to try here since its linux-specific.

What I'm aiming to do is quite similar to what RXVT can do; when its background color is set to semi-transparent, but its foreground to opaque, then when window is focused, compositor shows all foreground colors in full opacity and background to semi-transparent, so that desktop can be seen through - which creates a very cool effect with all console apps that use terminal colors.
I aim to accomplish this with a combo of tweaking the background color of browser estate, somehow (using XUL, I presume), and Javascript plugin that overrides background CSS property on body for pages that I want.

This is what I managed, so far:
* [SUCCESS] building a tiny Xlib prototype to prove it can be done relatively easy - https://stackoverflow.com/questions/399 ... ow-in-xlib
* [SUCCESS] looking at about:config to see if there's some sort of background color setting - there is
* [SUCCESS] modifying background color setting to bright pink, and then overriding CSS on DuckDuckGo to a transparent color - as expected, bright pink shows through
* [FAIL] modifying background color to #80808080 - it seems to only accept RGB
* [FAIL] naively think I can find a spot where window is being created and hardcode my own background, recompile and rejoice. Give up when grep for '#include <X11/Xlib.h>' returns 45 matches
* [SUCCESS] go ask on IRC, get redirected here
* [?] look at XUL information and bug reports, and land on this 10y old bug report that states this is fixed: https://bugzilla.mozilla.org/show_bug.cgi?id=408284


So, I admit, I probably could have done more and narrow problem more accurately before coming here to beg for other people's time, but I'm hoping there's someone here who tinkered with this before and will be able to guide me in the right direction, and that might save ME a whole lot of unnecessary digging, since the codebase is HUGE and I don't even know where to start.

If anyhow possible - please refrain from starting a discussion about WHY would I want to do this. Just assume I'm terribly misguided and possibly stupid, and then either help me and let me shoot myself in the foot, or not :-)
If I get this to work, and if it ends up looking as cool as it seems to be in my head, I'll post pics here.

Ideally, where you see bright pink now, I should be able to see my (animated) desktop.
Attachments
2019-06-05-163240_1920x1080_scrot.png

vannilla
Moon Magic practitioner
Moon Magic practitioner
Posts: 2193
Joined: 2018-05-05, 13:29

Re: XUL window transparency, linux | Xlib

Unread post by vannilla » 2019-06-06, 10:01

On Linux, XUL elements are rendered through GTK (by default version 2.)
So if you want transparency you have to hack your way around GTK settings.

machinedgod

Re: XUL window transparency, linux | Xlib

Unread post by machinedgod » 2019-06-06, 14:27

Hi Vanilla, thanks! I'm looking at it right now. Is there a way to get it done just by having a specific theme? The issue I'm pondering about is that a theme would affect all apps, and I'd like just one component of one app to be transparent. Do you by any chance, know if `background_color` property is propagated down to XUL, and then this then passes it on to GTK? Alternatively, do you know some other way I could go about it?

vannilla
Moon Magic practitioner
Moon Magic practitioner
Posts: 2193
Joined: 2018-05-05, 13:29

Re: XUL window transparency, linux | Xlib

Unread post by vannilla » 2019-06-06, 17:18

Sorry, I don't like transparent windows so I never look up any related option.
Also, I barely have any GTK applications too, so I know even less. I can barely stop GTK2 from using the adwaita theme.

machinedgod

Re: XUL window transparency, linux | Xlib

Unread post by machinedgod » 2019-06-06, 20:08

No worries, was worth a shot... I'll keep tinkering when I have more time and see what comes out...

Locked