{ inputs, config, pkgs, user, ... }:

let
  theme = import ../modules/theme;
in
{
  imports = [
    ./apps.nix
    ../modules/bash
    ../modules/emacs
    ../modules/fcitx5
    ../modules/firefox
    ../modules/git
    ../modules/i3
    ../modules/neovim
    ../modules/picom
    ../modules/polybar
    ../modules/ranger
    ../modules/rofi
    ../modules/startpage
    ../modules/terminal
    ../modules/todo-txt

    ../modules/fantasia-archive
  ]; 

  home.file."./.background-image".source = theme.wallpaper;

  programs.home-manager.enable = true;

  xdg = {
    userDirs = rec {
      enable = true;
      desktop = "${config.home.homeDirectory}"; # weird hack for disabling desktop in nautilus
      documents = null;
      music = null;
      pictures = "${publicShare}/Pictures";
      templates = null;
      publicShare = "${config.home.homeDirectory}/Nextcloud";
    };
    mimeApps = {
      enable = true;
      defaultApplications = {
        # Make sure directories are opened in nautilus
        # .desktop files can be found in /etc/profiles/per-user/elnu/share/applications
        # mimetypes can be found with the mimetype command:
        # nix-shell -p perl536Packages.FileMimeInfo
        "inode/directory" = "org.gnome.Nautilus.desktop";
        "application/zip" = "org.gnome.FileRoller.desktop";
        "application/octet-stream" = "org.gnome.GHex.desktop";
      };
    };
  };

  programs.direnv.enable = true;

  gtk = {
    enable = true;
    iconTheme = theme.gtkIconTheme pkgs;
    theme = theme.gtkTheme pkgs;
    gtk3 = {
      bookmarks = let
        home = "file://${config.home.homeDirectory}/";
      in [
        "${home}Nextcloud"
        "${home}Projects"
        "${home}nix-config Config"
        "sftp://elnu@elnuhub elnuhub"
      ];
      # Remove minimize, maximize, and close buttons
      extraConfig.gtk-decoration-layout = "appmenu:none";
    };
    gtk4.extraConfig.gtk-decoration-layout = "appmenu:none";
  };

  qt = {
    enable = true;
    platformTheme = "gtk";
  };
}
