Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QT: support Flatpak #916

Open
brckd opened this issue Feb 25, 2025 · 4 comments
Open

QT: support Flatpak #916

brckd opened this issue Feb 25, 2025 · 4 comments
Labels
feature A new feature or a feature request

Comments

@brckd
Copy link
Contributor

brckd commented Feb 25, 2025

As pointed out in #693 (comment), QT apps aren't styled when installed as Flatpaks. This article describes how support may be added. I already attempted it but couldn't get it to work.

@trueNAHO trueNAHO added the feature A new feature or a feature request label Feb 26, 2025
@beh-10257
Copy link

hello so I did a little bit more digging to find some solutions
first of all i recommend renaming the symlink home manager to something else other than global and copying the file and renaming the new file to global
I used this command a lot strace -f -t -e trace=file flatpak run org.kde.kclock 2> a_file
anyway I recommand using it against native qt apps (installed using nixpkgs) and flatpaks anyway I managed to at least remove the invalid error from apps
Image
even thout its not themed I think thats progress so I might as well share what I found

basically my first step was this

Image
basically I putted everything I ran ls -la on inside of the flatpak override file in .local/share/flatpak/overrides/global btw
that basically is
/nix/store/gm9k1g3b6nw0qavlj9nv9ncwcv55m4ql-kvantum.kvconfig;/nix/store/ihy1yjrfw6sqc3861dsgaj5zbrjvdd9i-base16-kvantum/share/Kvantum/Base16Kvantum;/nix/store/fjnwzr8hmqcczcg3pprzka4n5zsc4kk2-home-manager-files/.config/Kvantum;xdg-config/Kvantum

than using this command
echo $QT_PLUGIN_PATH
I found paths I though that was interesting so I used find to find any mention of kvantum
this is the command i used
find -L $(echo $QT_PLUGIN_PATH | awk 'gsub(":"," ")') -regex ".*kvantum.*"

and would you look at that
/etc/profiles/per-user/behe/lib/qt-6/plugins/styles/libkvantum.so
this is mentioned for exemple
I tried opening that path up for flatpak at first but well

Image
flatpaks are well yeah thats not very secure
so my next approach was just
realpath /etc/profiles/per-user/behe/lib/qt-6/plugins
realpath /etc/profiles/per-user/behe/lib/qt-5.15.16/plugins
I opened up the realpath (which is nix store obv)
btw I need to open this as well
Image

and now finally I can open the kde app and it will magicly work
but no
I need to change QT_PLUGIN_PATH for flatpaks since by default its only
QT_PLUGIN_PATH=/app/lib/plugins:/usr/share/runtime/lib/plugins
easy fix just add whats missing
QT_PLUGIN_PATH=/nix/store/vs4ykbnlhy6vwncq99r31pi29q8y7s9y-home-manager-path/lib/qt-6/plugins:/nix/store/vs4ykbnlhy6vwncq99r31pi29q8y7s9y-home-manager-path/lib/qt-5.15.16/plugins:/app/lib/plugins:/usr/share/runtime/lib/plugins
and this is where I'm at
error is gone but theme not applied even though well I can assure you there are some effects
exemples:
before:

Image
after:

Image

Image

so its a problem in somehow applying the theme somehow
using strace I can see that kclock is actually reading kvantum but I don't know how to make qt application more verbose or at least make them use dark theme lol
so yeah any ideas

@beh-10257
Copy link

QT_LOGGING_RULES="*=true"
I learned about the existence of this environment variable but still nothing useful
so far
I can see using this
QT_LOGGING_RULES="qt.quick.controls.style.debug=true;qt.core.plugin.factoryloader.debug=true" flatpak run org.kde.kclock -style kvantum-dark 2> wow1
that kvantum is getting loaded but the style never changes
heres a file of everything (33k lines of logs)

wow1.txt

yeah help will be appreciated

@brckd
Copy link
Contributor Author

brckd commented Feb 26, 2025

Nice, I was able to reproduce this behaviour!

; .local/share/flatpak/overrides/global
[Context]
filesystems=/nix/store:ro;/home/bricked/.themes/adw-gtk3:ro;/home/bricked:ro;/home/bricked/.config/Kvantum:ro;

[Environment]
GTK_THEME=adw-gtk3
QT_PLUGIN_PATH=/home/bricked/.local/share/flatpak/exports/lib/qt-5.15.16/plugins:/home/bricked/.local/share/flatpak/exports/lib/qt-6/plugins:/var/lib/flatpak/exports/lib/qt-5.15.16/plugins:/var/lib/flatpak/exports/lib/qt-6/plugins:/home/bricked/.nix-profile/lib/qt-5.15.16/plugins:/home/bricked/.nix-profile/lib/qt-6/plugins:/nix/profile/lib/qt-5.15.16/plugins:/nix/profile/lib/qt-6/plugins:/home/bricked/.local/state/nix/profile/lib/qt-5.15.16/plugins:/home/bricked/.local/state/nix/profile/lib/qt-6/plugins:/etc/profiles/per-user/bricked/lib/qt-5.15.16/plugins:/etc/profiles/per-user/bricked/lib/qt-6/plugins:/nix/var/nix/profiles/default/lib/qt-5.15.16/plugins:/nix/var/nix/profiles/default/lib/qt-6/plugins:/run/current-system/sw/lib/qt-5.15.16/plugins:/run/current-system/sw/lib/qt-6/plugins:/home/bricked/.nix-profile/lib/qt-5.15.16/plugins:/home/bricked/.nix-profile/lib/qt-6/plugins

Image

Judging from the logs it seems to use kvantum, but it doesn't load the correct theme.

@beh-10257
Copy link

Ohh there is a flatpak for dolphin nice
Probably we need the help of some qt nerds
The logs don't make any sense like kvantum is loading but then the style is still kde somehow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature A new feature or a feature request
Projects
None yet
Development

No branches or pull requests

3 participants