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

let
  cfg = config.samfelag.modules.desktop.rofi;
  nix-colors-lib = inputs.nix-colors.lib-contrib { inherit pkgs; };
in
{
  options.samfelag.modules.desktop.rofi = {
    enable = lib.mkEnableOption "rofi";
  };
  config = lib.mkIf cfg.enable {
    environment.systemPackages = with pkgs; [
      rofi
    ];

    hm.xdg.configFile."rofi/menus".source = ../../config/rofi/menus;
    hm.xdg.configFile."rofi/nix.png".source = nix-colors-lib.nixWallpaperFromScheme {
      scheme = config.colorScheme;
      width = 600;
      height = 600;
      logoScale = 2.0;
    };

    # Themeing ---------------------------------
    hm.xdg.configFile."rofi/theme.rasi".text = ''
      * {
          font:                        "Iosevka Nerd Font 10";
          background:                  #${config.colorScheme.colors.base00};
          background-alt:              #${config.colorScheme.colors.base02};
          foreground:                  #${config.colorScheme.colors.base05};
          selected:                    #${config.colorScheme.colors.base03};
          active:                      #${config.colorScheme.colors.base07};
          urgent:                      #${config.colorScheme.colors.base06};
      }
    '';

  };
}
