{
  pkgs,
  lib,
  config,
  ...
}: {
  options.mods.xdg.enable = lib.mkEnableOption "enables xdg settings";

  config = lib.mkIf config.mods.xdg.enable {
    xdg = let
      browser = ["qutebrowser.desktop"];
      associations = {
        "text/html" = browser;
        "x-scheme-handler/http" = browser;
        "x-scheme-handler/https" = browser;
        "x-scheme-handler/ftp" = browser;
        "x-scheme-handler/about" = browser;
        "x-scheme-handler/unknown" = browser;
        "application/x-extension-htm" = browser;
        "application/x-extension-html" = browser;
        "application/x-extension-shtml" = browser;
        "application/xhtml+xml" = browser;
        "application/x-extension-xhtml" = browser;
        "application/x-extension-xht" = browser;

        "audio/*" = ["mpv.desktop"];
        "video/*" = ["mpv.dekstop"];
        "image/*" = ["imv.desktop"];
        "application/json" = browser;
        # "application/pdf" = ["org.pwmt.zathura.desktop.desktop"];
        "x-scheme-handler/tg" = ["kotatogram-desktop.desktop"];
        "x-scheme-handler/discord" = ["vesktop.desktop"];
      };
    in {
      enable = true;
      userDirs = {
        enable = true;
        documents = "$HOME/documents";
        download = "$HOME/downloads";
        videos = "$HOME/misc/videos";
        music = "$HOME/misc/music";
        pictures = "$HOME/misc/pictures";
        desktop = "$HOME/misc/desktop";
        publicShare = "$HOME/misc/public";
        templates = "$HOME/misc/templates";
      };
      mimeApps.enable = true;
      mimeApps.associations.added = associations;
      mimeApps.defaultApplications = associations;
    };
  };
}
