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

let
  cfg = config.wayland.windowManager.hyprland;
  app = cfg.applications.password-manager.default;

  inherit (lib) mkDefault mkIf;
in
{
  imports = [ ../../../rofi-rbw ];

  config = mkIf (cfg.enable && app == "rofi-rbw") {
    programs.rbw = {
      enable = true;
      settings = {
        # email = "you@example.tld"; # You have to set this in your config
        pinentry = mkDefault pkgs.pinentry-gnome3;
        lock_timeout = mkDefault 3600;
      };
    };

    programs.rofi-rbw = {
      enable = true;
      package = mkDefault pkgs.rofi-rbw-wayland;
      settings = {
        selector = mkDefault "bemenu";
        selector-args = mkDefault "-i -l 20";
        action = mkDefault "copy";
        typing-key-delay = mkDefault 0;
      };
    };

    programs.librewolf = mkIf config.programs.librewolf.enable {
      profiles.default.extensions.packages =
        with inputs.nur.legacyPackages."${pkgs.stdenv.hostPlatform.system}".repos.rycee.firefox-addons; [
          bitwarden
        ];
    };
  };
}
