lxqt / xdg-desktop-portal-lxqt

A backend implementation for xdg-desktop-portal
GNU Lesser General Public License v2.1
22 stars 9 forks source link

The forced `QT_QPA_PLATFORMTHEME` variable prevents Kvantum users from having their themes correctly set in the file picker #22

Closed e-tho closed 1 year ago

e-tho commented 1 year ago

Kvantum requires QT_QPA_PLATFORMTHEME and QT_STYLE_OVERRIDE to be set to qt5ct and kvantum respectively. Being a Hyprland user who chose PcmanFM-Qt as my file manager, I would like to have more visual consistency, especially regarding the file picker, so I would like to use xdg-desktop-portal-lxqt in conjunction with xdg-desktop-portal-hyprland (-wlr fork). LXQt being the most modular and lightest desktop environment in terms of dependencies, its components are for me the best choices for users of wayland compositors/Xorg window managers, its compatibility with them would be greatly appreciated.

tsujan commented 1 year ago

Kvantum requires...

Any widget style needs those EVs.

But why qt5ct? qt5ct should not be used in DEs that have their own Qt plugins, like LXQt and KDE. It's a third-party program (and a good one) to be used in DEs without a plugin, especially GTK DEs.

EDIT: Oh, you said Hyprland. Although you could use LXQt's plugin there too (QT_QPA_PLATFORMTHEMElxqt).

e-tho commented 1 year ago

It is Hyprland that requires this variable to be set to qt5ct in this case. From a desktop environment point of view you are totally right but it makes xdg-desktop-portal-lxqt incompatible when used with a Wayland compositor and a theme manager such as Kvantum. Of course this is a niche use case and I would understand if it is not considered

e-tho commented 1 year ago

EDIT: Oh, you said Hyprland. Although you could use LXQt's plugin there too (QT_QPA_PLATFORMTHEMElxqt).

Ok then, I'll try this

tsujan commented 1 year ago

Ok then, I'll try this

You need to choose your style (Kvantum in this case) in LXQt first.

EDIT: This should work too: export XDG_CURRENT_DESKTOP=LXQt && APP

stefonarch commented 1 year ago

FYI: https://github.com/stefonarch/LXQt-Wayland-files#hyprland-tiling

The filepicker works fine but the lxqt-desktop-portal doesn't work (e.g. in firefox) - or I didn't find a way.

tsujan commented 1 year ago

but the lxqt-desktop-portal doesn't work

Does it work in Wayfire?

stefonarch commented 1 year ago

Nowhere under wayland afaik.

e-tho commented 1 year ago

So I installed lxqt-config, defined my settings in appearance and then changed the QT_QPA_PLATFORMTHEME variable to LXQt, the Kvantum theme is now being used in the file picker but neither the defined font nor my icon theme are used in Qt applications. Am I missing a LXQt component?

tsujan commented 1 year ago

the Kvantum theme is now being used in the file picker

Then we can close this.

but neither the defined font nor my icon theme are used in Qt applications

This is rather about Hyprland. Try to set XDG_CURRENT_DESKTOP to LXQt. That is possible in Wayfire (indirectly). You can test it with command line first: export XDG_CURRENT_DESKTOP=LXQt && QtApp

@stefonarch even starts an LXQt Session under Wayland compositors (see https://github.com/stefonarch/LXQt-Wayland-files) but by applying patches.

EDIT: With XDG_CURRENT_DESKTOP, you won't need to set QT_QPA_PLATFORMTHEME anymore; it'll be set automatically.

tsujan commented 1 year ago

Am I missing a LXQt component?

I don't know. You especially need lxqt-qtplugin and libqtxdg.

e-tho commented 1 year ago

You especially need lxqt-qtplugin and libqtxdg.

It was indeed lxqt-qtplugin, thanks

pd2s commented 1 year ago

@e-tho , did you manage to run file picker with native wayland? For me it is running under xwayland and completely ignores env vars (QT_SCALE_FACTOR, QT_QPA_PLATFORM, etc)

e-tho commented 1 year ago

@pd2s, I hadn't checked when I was using this configuration, I've since discovered xdg-desktop-portal-shana which allows me to have the theme correctly set while using qt5ct or qt6ct. So I've uninstalled lxqt-config and lxqt-qtplugin as I prefer this modular approach. With my current configuration, the file picker runs with native Wayland

e-tho commented 11 months ago

@tsujan,

I necro this but can you please reconsider avoiding forcing the variable to make this portal compatible with qtct ? Kvantum is not a problem here, I was mistaken.

I use pcmanfm-qt, xdg-dekstop-portal-lxqt and lxqt-policykit independently of the LXQt desktop environment and only xdg-dekstop-portal-lxqt causes problems with qtct because of this forced variable, my icon theme is not recognized so the icons are not displayed.

I switched from Arch Linux to NixOS recently and ran into this problem again when replicating my configuration, plus my previous workaround xdg-desktop-portal-shana is not packaged on NixOS.

I'd like to be able to continue using these components independently of the rest of the desktop environment.

e-tho commented 11 months ago

FYI: https://github.com/stefonarch/LXQt-Wayland-files#hyprland-tiling

The filepicker works fine but the lxqt-desktop-portal doesn't work (e.g. in firefox) - or I didn't find a way.

@stefonarch,

Creating ~/.config/xdg-desktop-portal/portals.conf with this content could fix this. By default, Hyprland sets it to hyprland;gtk.

[preferred]
default=hyprland;lxqt
stefonarch commented 11 months ago

@e-tho : you're my hero, created that file with only

[preferred]
default=lxqt

and it work both in thunderbird and firefox. I heard about that that it was even needed on x11 but didn't investigate.

EDIT: after rechecking it looks like the file in my 2 setups (debian/arch) isn't needed - in both thunderbird and firefox widget.use-xdg-desktop-portal.file-picker was (re)set to 2 instead of 1.

stefonarch commented 11 months ago

This config file was introduced last May, before the portals were chosen in alphabetic order. If I got the spec right with multiple sessions installed the filename should be lxqt-portals.conf

Updated the wiki https://github.com/lxqt/lxqt/wiki/ConfigMiscellaneous#lxqt-filedialog-in-gtk-applications

goteksc commented 3 months ago

@e-tho

[...] I've since discovered xdg-desktop-portal-shana which allows me to have the theme correctly set while using qt5ct or qt6ct. So I've uninstalled lxqt-config and lxqt-qtplugin as I prefer this modular approach. With my current configuration, the file picker runs with native Wayland

As I understand xdg-desktop-portal-shana made it so the file picker of xdg-desktop-portal-lxqt summoned through shana was styled with your qt5ct/qt6ct/kvantum theme, right? If so, how did you manage to do that?

file: hyprland-portals.conf

[preferred]
default=hyprland;shana
org.freedesktop.impl.portal.FileChooser=shana

file: config.toml

open_file = "Lxqt"
save_file = "Lxqt"

[tips]
open_file_when_folder = "Lxqt"
$ echo $QT_QPA_PLATFORMTHEME
qt6ct

kvantum-dark set in qt6ct catppuccin theme is set in kvantum

e-tho commented 3 months ago

@GotekSC I have since switched to nautilus and xdg-desktop-portal-gtk. I tried xdg-desktop-portal-shana again without success when it was packaged on NixOS, and looked no further. I would have preferred pcmanfm-qt with the LXQt portal, but this issue makes it hostile to use outside the DE.