lxqt / pcmanfm-qt

File manager and desktop icon manager (Qt port of PCManFM and libfm)
https://lxqt-project.org
GNU General Public License v2.0
409 stars 113 forks source link

[Feature request] transparent wallpapers #1949

Open kRHYME7 opened 1 day ago

kRHYME7 commented 1 day ago

Is your feature request related to a problem? Please describe.

In Hyprland, I want to still use another wallpaper engine. Or I just want the desktop icon management of pcmanfm-qt.

Describe the solution you'd like

Is there a way to make the wallpaper fully transparent?

Describe eventual alternatives you've considered

Having alpha to 0 can make wallpaper transparent.

Context

I'm using hyprland and stumbled upon this project. To be fair, hyprland is not specifically built for this, but someone might find this useful (me).

stefonarch commented 1 day ago

I tried a moment to use a transparent background image, but it looks like the desktop window itself isn't transparent. Hyprland allows layer-rules but it doesn't look as you can set transparency https://wiki.hyprland.org/Configuring/Window-Rules/#layer-rules and it would make the icons transparent too.

@tsujan will know more about possibilities to allow another wallpaper engine. What are you missing here?

kRHYME7 commented 1 day ago

This is the only icon desktop manager project I know that uses Wayland's layer shell. And everything works perfectly as implemented.

stefonarch commented 1 day ago

Not only the desktop manager :) https://github.com/lxqt/lxqt-wayland-session/

tsujan commented 20 hours ago

Is there a way to make the wallpaper fully transparent?

Use a transparent image.

pcmanfm-qt just draws an image or a color as the background of its desktop widget. What is "behind" that widget isn't controlled by pcmanfm-qt.

kRHYME7 commented 19 hours ago

I see, so basically If I load a fully transparent png file it should give me a transparent background of the widget right? Thanks!

stefonarch commented 19 hours ago

As I said above, that doesn't work here.

tsujan commented 19 hours ago

so basically If I load a fully transparent png file it should give me a transparent background of the widget right?

Yes. Use the mode "Stretch to fill the entire screen".

pcmanfm-qt's desktop is a special widget. A widget is like a rectangular object containing some other objects (like desktop items, in this case). With a transparent background, a widget shows its contents and what is "behind" them.

As I said above, that doesn't work here.

Could you be more specific about what is supposed to work?

tsujan commented 18 hours ago

Since this is about Wayland, let be more specific

pcmanfm-qt puts its desktop widget on the background layer.

A Wayland wallpaper engine usually puts its image on the background layer too.

Now, theoretically, two things can happen:

kRHYME7 commented 18 hours ago

I'm curious why --desktop is in 'Background' Layer not 'Bottom' . But I guess because of its built in desktop wallpaper?

stefonarch commented 18 hours ago

Both are on the background layer, but transparency can't be achieved to see the wallpaper (here done with swaybg ). Probably due to the the namespace swaybg is always below the desktop, on every compositor,

Layer level 0 (background):
                Layer 5d20d4979cf0: xywh: 0 0 1920 1080, namespace: wallpaper
                Layer 5d20d522b950: xywh: 0 0 1920 1080, namespace: desktop
        Layer level 1 (bottom):
kRHYME7 commented 17 hours ago
            Layer 5d20d4979cf0: xywh: 0 0 1920 1080, namespace: wallpaper
          Layer 5d20d522b950: xywh: 0 0 1920 1080, namespace: desktop

@stefonarch This one I think is expected as explained here https://github.com/lxqt/pcmanfm-qt/issues/1949?notification_referrer_id=NT_kwDOAy8V47QxMjc0MjMxMDc0Mzo1MzQxNzQ0Mw#issuecomment-2397445309

@tsujan For now, I'm not successful. Looks Like it tries to resolve the transparent image by rendering the Qt color. Also as observed with the images below, waybar and the Qt shell shows an expected behavior. So I can't say that this is a Compositor thing.

1

image

2

image

3

image

4

image

This one I tried Nemo, but this one is a window as it is not using wayland's layer shell.

image

In this example I rendered a background layer. The intended approach is like this.

Note That I set the opacity of this layer to 0.

Blurred the layer to show it is transparent

image

Fullly transparent by removing blur

image

This is the transparent.png file for reference vvvv

Transparent

kRHYME7 commented 17 hours ago

And here's the full command for pcmanfm-qt

pcmanfm-qt --set-wallpaper ~/Pictures/Wallpapers/Transparent.png --wallpaper-mode stretch --desktop
tsujan commented 16 hours ago

Sorry, I thought that I had a good memory of the code, but after taking a look at it, I got disillusioned: There seem to be two reasons for the background not being transparent in spite of a transparent wallpaper.

Will work on it soon. Reopening for now...

kRHYME7 commented 16 hours ago

I tried a moment to use a transparent background image, but it looks like the desktop window itself isn't transparent. Hyprland allows layer-rules but it doesn't look as you can set transparency https://wiki.hyprland.org/Configuring/Window-Rules/#layer-rules and it would make the icons transparent too.

@tsujan will know more about possibilities to allow another wallpaper engine. What are you missing here?

Only now I realize what you meant by this. Yeah @stefonarch

tsujan commented 12 hours ago

OK, I mistakenly assumed that a desktop with a transparent wallpaper should always be transparent itself because I use the Kvantum widget style. With Kvantum, the desktop will actually be transparent if three conditions are fulfilled: (1) the wallpaper is transparent; (2) the wallpaper is stretched to fill the screen; and (3) the active Kvantum theme makes windows transparent.

To make the same thing happen with all Qt styles (e.g. Fusion), I modified the code and explicitly made the desktop window transparent on Wayland. A few other modifications were needed to make the code work with all wallpaper modes.

Since the modifications are small and limited to Wayland, and also because compositing always exist under Wayland, I'll make a PR tomorrow.


Apart from this, a general idea came to my mind. Under X11, we had to worry about the existence of compositing and restrict our codes accordingly, while there is no need to such restrictions under Wayland. Perhaps there are other parts of LXQt, where we could remove this restriction on Wayland by adding a few lines of code — Translucency of Fancy Menu comes to mind...

stefonarch commented 4 hours ago

Translucency of Fancy Menu comes to mind...

For some reason it's already transparent on Hyprland with Valendas or Dark theme:

immagine

Another funny thing is that by default all panels are transparent on every compositor, to have an opaque panel you need to set a background color.

kRHYME7 commented 4 hours ago

@stefonarch

I guess the compositor detects an alpha value and tries to ignore it effectively hav transparent + blur = translucent ? Are the images above something kind of rendered as layer shell?

stefonarch commented 3 hours ago

Are the images above something kind of rendered as layer shell?

Yes, panels and runner and notifications are on layers, exit dialog too.