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
425 stars 112 forks source link

[Feature request] transparent wallpapers #1949

Closed kRHYME7 closed 1 month ago

kRHYME7 commented 1 month 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 month 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 month 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 month ago

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

tsujan commented 1 month 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 1 month 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 1 month ago

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

tsujan commented 1 month 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 1 month 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 1 month ago

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

stefonarch commented 1 month 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 1 month 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 1 month ago

And here's the full command for pcmanfm-qt

pcmanfm-qt --set-wallpaper ~/Pictures/Wallpapers/Transparent.png --wallpaper-mode stretch --desktop
tsujan commented 1 month 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 1 month 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 1 month 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 1 month 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 1 month 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 1 month ago

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

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

tsujan commented 1 month ago

The PR is here: https://github.com/lxqt/pcmanfm-qt/pull/1950

You could test it with any wallpaper mode and any trasnparent wallpaper, like a simple SVG image transparent.svg with the following contents:

<svg width="48" version="1.1" xmlns="http://www.w3.org/2000/svg" height="48" viewBox="0 0 48 48"/>
kRHYME7 commented 1 month ago

I only have a low power laptop, so it takes time to build. Will get back to you after this.

BTW, is it expected that the --desktop is only rendered on the first monitor it sees?

tsujan commented 1 month ago

I only have a low power laptop, so it takes time to build.

You first need to compile and install git libfm-qt -- unless you already use git LXQt packages.

BTW, is it expected that the --desktop is only rendered on the first monitor it sees?

No. Such problems are already fixed in git pcmanfm-qt.

EDIT: You could also wait for LXQt 2.1.0, which will be released in November.

kRHYME7 commented 1 month ago

Cool! I'll build the -git package first. Then from there I try to change the PKGBUILD to switch branch pointing to the PR.

Also, I guess we can make a request for lxqt packages here ? https://github.com/chaotic-aur/packages

edit: woah 🫶 image

tsujan commented 1 month ago

Thanks for testing! It seems that the rendering problem is also fixed for you with the git pcmanfm-qt.

In your screenshot I saw that you used killall to stop pcmanfm-qt's process. The correct and clean command is pcmanfm-qt --quit.

kRHYME7 commented 1 month ago

@tsujan PR works as expected and I also just use the Transparent png file.

image For now, I will just try to script my way, by modifying the margins to dodge waybar. Waybar and desktop have different Z levels, so margins should help.

I might open another Issue, but let me ask here first. BTW, is there any mechanism I can try to replicate in the CLI the Apply button? Quitting the process will be my option, but is there another way to seamlessly update the instance when the config is changed?

In your screenshot I saw that you used killall to stop pcmanfm-qt's process. The correct and clean command is pcmanfm-qt --quit.

Uy, thanks!

tsujan commented 1 month ago

... is there another way to seamlessly update the instance when the config is changed?

If you mean updating the GUI of pacmanfm-qt on changing its config file(s) manually, the answer is no. This feature may be good for apps like terminal emulators but not for all apps.

More importantly and for various reasons, pcmanfm-qt reads its settings only when it's started and saves changes only on quitting. This means that a manual editing of its config file will be useless if it's running: to change settings manually (not recommended), the user needs to stop pcmanfm-qt's process first.

stefonarch commented 1 month ago

Should be added to the Wiki IMO.

tsujan commented 1 month ago

Waybar and desktop have different Z levels, so margins should help.

Sorry, I didn't see this. Yes, margins are needed with any panel under Wayland — read the last paragraph of the Wiki section about Wayland.