We probably need to enforce theme by setting variables in sway configuration or somewhere else.
Snippet from hyprland.conf:
# Some default env vars.
env = XCURSOR_SIZE,16
#env = QT_QPA_PLATFORMTHEME,qt5ct # change to qt6ct if you have that
#env = GTK2_RC_FILES,/home/USER/.config/gtk-2.0/gtkrc
env = QT_QPA_PLATFORMTHEME,gtk2
env = QT_STYLE_OVERRIDE,gtk2
Icons are working in pcmanfm-qt with some variables.
After posting my reply the icons disappeared from my pcmanfm-qt
Thankfully the issue was easily fixed from the settings, just go to Edit > Preferences > User Interface and choose Papirus-Dark as your icon theme.
Don’t know why this happened now, but I remember this happening to me before in other distros.
systemd.user.sessionVariables was the only way for qt5ct to read QT_QPA_PLATFORMTHEME for me. I tried:
environment.sessionVariables
environment.variables
home.sessionVariables
But those didn’t work.
Also, this was only necessary when using nixpkgs.config.qt as I didn’t have to manually set any variable when just using qt. This is on Gnome, though, so it might be necessary for other DE or WM.
I think is some small little knob in the corner to turn…
I can get the icons to show in pcmanfm-qt if I set Edit → Preferences → Display → Icon Theme to Papirus-Dark. But that does not propagate to pavucontrol-qt for example.
I figured out the icon problem. I think this is also the reason why pcmanfm-qt had no icons.
The issues is that QT apps don’t have their icon theme set by default, so you can configure each one individually like we did with pcmanfm-qt. However, a better solution is to do it for all of them using qt5ct, as the Arch wiki suggests.
Just open qt5ct > Icon Theme > Papirus-Dark then click Apply.
This isn’t exactly the Nix way of doing things, but it’s something that works for now. We could probably also do this by modifying $HOME/.config/qt5ct/qt5ct.conf using home-manager, but I don’t know how exactly.
I was wrong here. Using nixpkgs.config.qt was pretty much a workaround as ot turns out the applications that didn’t show the icons were using QT6, and setting QT_QPA_PLATFORMTHEME = "qt5ct" made them use that instead of qt6ct (I’ll fix this in my original answer).
This is the same issue that we faced with pcmanfm-qt, but with QT6 apps. Fixing that is pretty much just setting the interface theme as kvantum and icon theme as Papirus-Dark in qt6ct.
Note: if any pcmanfm-qt user is wondering why the Application Menu is empty when right clicking a file Open With > Other Applications, that’s because you need to add the following packages:
environment.systemPackages = with pkgs; [
lxqt.lxqt-menu-data
shared-mime-info # optional, but nice to have
];
My hasSeat is a boolean that only writes this file if I have a systemd-seat (graphical interface), I use the same configuration files for my headless server. I need this because I use impermanence (Erase your darlings: immutable infrastructure for mutable systems - Graham Christensen). Also, I don’t want to have to manually setup my icons in the other laptop.
My complete configuration file is now this: wm-theme with these extra packages system-wide:
libsForQt5.qtstyleplugin-kvantum.
libsForQt5.qt5ct # Magic for some Qt apps keep functionality.
@eljamm do you still have your catpuccins working everywhere? I updated my system and lost the icons, cursors and themes. Have no Idea how to setup anymore.
Some things have changed since then, but I’m using catppuccin/nix and it’s working for me (you can check this out in my config). Can you share your current configuration?
Didn’t know a module for QT was added for catppuccin-nix
It’s worth noting that my method isn’t fully reproducible as I’m using qtct to set kvantum as the theme. Although that can be done automatically as you’ve done before with the icon theme:
Seems to be missing many icons, like folders for example? In the case of pavucontrol, the symbols for audio, mic, enabled, etc are not in this SVG. Should they be there?
Ah, right. That’s for the theme and not the icons. That’s perfectly normal.
Can you manually change the icon theme in qt5ct and qt6ct? You can change it to something else and see if it works, then back to Papirus-Dark and see if that works as well.
Found something: I get a warning when I open qt6ct:
Please remove the QT_STYLE_OVERRIDE environment variable (current value: kvantum).
The QT_QPA_PLATFORMTHEME environment variable is not set correctly (current value: kvantum, required values: qt6ct or qt5ct).
I don’t set any of those environment variables manually. Do you have them in your env?
I have a feeling that the qtct configuration is not being applied, but don’t know how to check that. kvantummanager shows the theme nicely, but qt5ct appears to be locked in the icons.
Hey, @heitorpb, apologies for replying late, but I didn’t get a notification.
What I would suggest doing is checking if $HOME/.config/qt5ct/qt5ct.conf exists and has the correct contents. Else, I’d remove the lines where you declaratively configure qt5ct and qt6ct and I’d try manually getting it to work first.
Perhaps qt5ct wants its config file to be writeable or something?
I deleted $HOME/.config/qt{5,6}ct/, removed the static configs from my Nix files and tried to manually set the theme and icons and got nowhere. This is what I see in qt6ct:
It seems papirus-dark is not available for qtct? Curiously, when I open pcmanfm-qt and go to the settings, I can set the icons to papirus-dark and they appear.