{
  config,
  lib,
  pkgs,
  ...
}:
with lib; {
  gtk = {
    enable = true;

    iconTheme = {
      name = "Papirus-Dark";
      package = pkgs.papirus-icon-theme;
    };
    theme = {
      package = pkgs.materia-theme;
      name = "Materia-dark";
    };

    gtk2.extraConfig = ''
      gtk-toolbar-style=GTK_TOOLBAR_BOTH_HORIZ
      gtk-menu-images=1
      gtk-button-images=1
    '';

    gtk3.extraConfig = {
      gtk-application-prefer-dark-theme = 1;
    };
    gtk4.extraConfig = {
      gtk-application-prefer-dark-theme = 1;
    };
  };

  home.sessionVariables = {
    # Use gtk in jvm apps
    _JAVA_OPTIONS = concatStringsSep " " [
      "-Dawt.useSystemAAFontSettings=on"
      "-Dswing.aatext=true"
      "-Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel"
      "-Dswing.crossplatformlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel"
    ];
  };
}
