Struggling to configure GTk/QT theme on laptop

I got the theme working, but not the icons. I can’t change them in qt5ct, it appears locked there.

My current config for Qt is:

let
  catppuccinAccent = "Blue";
  catppuccinFlavor = "Macchiato";

  catppuccinKvantum =  pkgs.catppuccin-kvantum.override {
      accent = catppuccinAccent;
      variant = catppuccinFlavor;
  };

  qtctConf = {
    Appearance = {
      custom_palette = false;
      icon_theme = "Papirus-Dark";
      standard_dialogs = "default";
      style = "kvantum";
    };
  };
in
{

  qt = lib.mkIf hasSeat {
    enable = true;
    platformTheme.name = "qtct";
    style.name = "kvantum";
  };
  xdg.configFile."qt5ct/qt5ct.conf".text = lib.generators.toINI { } qtctConf;
  xdg.configFile."qt6ct/qt6ct.conf".text = lib.generators.toINI { } qtctConf;
  xdg.configFile = {
    "Kvantum/kvantum.kvconfig".text = ''
      [General]
      theme=Catppuccin-${catppuccinFlavor}-${catppuccinAccent}
    '';

    "Kvantum/Catppuccin-${catppuccinFlavor}-${catppuccinAccent}".source = "${catppuccinKvantum}/share/Kvantum/Catppuccin-${catppuccinFlavor}-${catppuccinAccent}";
  };
};

Do you spot anything obviously wrong?

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:
qt6ct-icons

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.

Weird. Do none of those options work at all?

None of them work in qtxct. I can get pcmanfm-qt to use the icons though.

Does setting XDG_CURRENT_DESKTOP and QT_QPA_PLATFORMTHEME like in Configuration of Qt 5/6 applications under environments other than KDE Plasma make a difference?

If that doesn’t work, you could also try explicitly installing libsForQt5.qt5.qtsvg and kdePackages.qtsvg like Icon theme is not applied suggests.

There’s something odd with pavucontrol-qt, it simply does not show the icons (do you have icons in it?). But I can see icons in pcmanfm-qt. I switched to pavucontrol (gtk based) and moving on, not interested in troubleshooting this even further.

This is what I currently have for Qt:

{ lib, pkgs, ... }:
let
  catppuccinAccent = "Blue";
  catppuccinFlavor = "Macchiato";

  catppuccinKvantum = pkgs.catppuccin-kvantum.override {
    accent = catppuccinAccent;
    variant = catppuccinFlavor;
  };
in
{
  home.packages = with pkgs; lib.mkIf hasSeat [
    papirus-folders # Icons
    #catppuccin-papirus-folders # Conflicts with above

    # Theme for Qt apps
    catppuccinKvantum

    # I don't know If I need these
    libsForQt5.qt5ct
    #kdePackages.qt6ct
  ];

  # Qt setup
  qt = {
    enable = true;

    platformTheme.name = "kvantum";
    style = {
      name = "kvantum";

      catppuccin = {
        enable = true;
        apply = true;
        accent =lib.toLower catppuccinAccent;
        flavor =lib.toLower catppuccinFlavor;
      };
    };
  };
}

And my full config is here: dotfiles-supimpas/home-manager/gtk-qt.nix at 5dab63213ed941fd4aa2207d3d4fe6f222fdb6e3 · heitorPB/dotfiles-supimpas · GitHub

There may be some things I don’t need in this config, but it is working.

@eljamm huge thanks for your help!

1 Like

I thought icons didn’t work on any qt application on your system, not just pavucontrol-qt, but apparently it’s just the fault of the application in this case since it doesn’t work for me either.

The fix for this should be pretty simple though, it just needs the qtsvg dependency and the icons work again.

Edit: Opened pavucontrol-qt: add missing `qtsvg` dependency by eljamm · Pull Request #334155 · NixOS/nixpkgs · GitHub

2 Likes

Ouch, i’ve been banging my head for a while about it.

Thanks for figuring it out! You rock!

2 Likes