{ config, lib, ... }:

{
  config = lib.mkIf config.desktop.enable {

    home-manager.users.${config.user} = {
      programs.wofi = {

        enable = true;

        settings = {
          key_expand = "Tab";
          term = "kitty";
          matching = "multi-contains";
          insensitive = true;
          gtk_dark = true;
          hide_scroll = true;
        };

        style =
          let
            accentColor = "#${config.theme.accentColor}";
            textColor = "#${config.theme.colors.base05}";
            baseColor = "#${config.theme.colors.base00}";
            surfaceColor = "#${config.theme.colors.base02}";
            fontSize = "${toString config.theme.fontSize}px";
            outerGap = "${toString config.theme.outerGap}px";
            innerGap = "${toString config.theme.innerGap}px";
            outerRadius = "${toString config.theme.outerRadius}px";
            innerRadius = "${toString config.theme.innerRadius}px";
            borderWidth = "${toString config.theme.borderWidth}px";
          in ''
* {
   font-family: ${config.theme.monospaceFont};
   font-size: ${fontSize};
}

/* Window */
window {
   margin: 0px;
   border: ${borderWidth} solid ${accentColor};
   border-radius: ${outerRadius};
   background-color: ${baseColor};
}

/* Outer Box */
#outer-box {
   padding: ${outerGap};
}

/* Scroll */
#scroll {
   margin: 0px;
   padding: ${innerGap};
   border: none;
}

/* Input */
#input {
  margin: ${innerGap};
  padding: ${innerGap};
  border: none;
  color: ${textColor};
  background-color: ${surfaceColor};
  border-radius: ${outerRadius};
}

#input:focus,
#input:active {
  border: ${borderWidth} solid ${accentColor};
  box-shadow: none;
  outline: none;
}

/* Text */
#text {
   margin: ${innerGap};
   padding: ${innerGap};
   border: none;
   color: ${textColor};
}

/* Selected Entry */
#entry:selected {
  background-color: ${accentColor};
  border-radius: ${outerRadius};
}

#entry:selected #text {
   color: ${baseColor};
}
      '';

      };
    };

  };
}