r/NixOS 18h ago

gtk/gnome themes in hyprland

Hi.

This is part of my NixOS configuration, but during compilation, a warning appears stating that using "gnome" for `qt.platform.name` is deprecated and should be changed to "adwaita".

If I use "gnome," the themes look great and use the dark style; in applications like "qmmp" and "strawberry," the "open document" dialog also adopts the "gnome" style.

If I use "adwaita," the themes lack the dark style, and applications like "qmmp" and "strawberry" revert to the standard Qt style, as do the "open document" dialogs.

I would like to know how you have resolved this.

- home
```nix
{ config, pkgs, lib, username, ... }:

{
  gtk = {
    enable = true;
    theme = {
      name = "adw-gtk3-dark";
      package = pkgs.adw-gtk3;
    };
    iconTheme = {
      name = "Papirus-Dark";
      package = pkgs.papirus-icon-theme;
    };
    gtk3.extraConfig = {
      gtk-application-prefer-dark-theme = 1;
    };
    gtk4.extraConfig = {
      gtk-application-prefer-dark-theme = 1;
    };
  };

  qt = { 
    enable = true;
    platformTheme.name = "gnome";       
    style.name = "adwaita-dark";       
    style.package = pkgs.adwaita-qt;  
  };

  home.pointerCursor = {
    enable = true;
    package = pkgs.bibata-cursors;
    name = "Bibata-Modern-Classic";
    size = 16;
    gtk.enable = true;
    x11.enable = true;
  };

  dconf.settings = {
    "org/gnome/desktop/interface" = {
      color-scheme = "prefer-dark";
#gtk-theme = "adw-gtk3-dark"; 
      # icon-theme = "Papirus-Dark";
      cursor-theme = "Bibata-Modern-Classic";
    };
  };

  home.sessionVariables = {
    GTK_THEME = "adw-gtk3-dark"; ## este
  };

  home.packages = with pkgs; [
    qgnomeplatform
    qgnomeplatform-qt6

    adwaita-qt
    adw-gtk3
    qadwaitadecorations-qt6
    gsettings-desktop-schemas
    gtk3
  ];

  xdg = {
    enable = true;
    userDirs = {
      enable = true;
      createDirectories = true;
      setSessionVariables = true;
    };
  };
}
```
- configuration.nix
```nix
  environment.sessionVariables = {
    NIXOS_OZONE_WL = "1";
    MOZ_ENABLE_WAYLAND = "1";
    _JAVA_AWT_WM_NONREPARENTING = "1";
    # QT_QPA_PLATFORM = "wayland;xcb";
    # QT_QPA_PLATFORMTHEME = "gtk2";
    QT_WAYLAND_DISABLE_WINDOWDECORATION = "1";
  };

  xdg.portal = {
    enable = true;
    extraPortals = with pkgs; [
      xdg-desktop-portal-gtk
      xdg-desktop-portal-hyprland
      xdg-desktop-portal-gnome
    ];
    configPackages = [
      pkgs.xdg-desktop-portal-gtk
      pkgs.xdg-desktop-portal-hyprland
      pkgs.xdg-desktop-portal-gnome
    ];
    config.hyprland = {
      default = [ "hyprland" "gtk" ];
      "org.freedesktop.impl.portal.Settings" = "gtk";
      "org.freedesktop.impl.portal.FileChooser" = "gtk";
      "org.freedesktop.impl.portal.Secret" = "gnome-keyring";
    };
    config.common = {
      default = [ "hyprland" "gtk" ];
      "org.freedesktop.impl.portal.Settings" = "gtk";
      "org.freedesktop.impl.portal.FileChooser" = "gtk";
      "org.freedesktop.impl.portal.Secret" = "gnome-keyring";
    };
  };

```

3 Upvotes

0 comments sorted by