{
  config,
  lib,
  pkgs,
  ...
}:
let
  cfg = config.alqueva.wms.river;
in
{
  options.alqueva.wms.river = {
    enable = lib.mkEnableOption "River";
  };

  config = lib.mkIf cfg.enable {
    alqueva.support.wayland = true;

    programs.river = {
      enable = true;
      xwayland.enable = false;
      extraPackages = [
        pkgs.swaybg
        pkgs.kanshi
        pkgs.rivercarro
      ];
    };

    xdg.portal.wlr = {
      enable = true;
      settings = {
        screencast = {
          output_name = "HDMI-A-1";
          chooser_type = "simple";
          chooser_cmd = "${pkgs.slurp}/bin/slurp -f %o -or";
        };
      };
    };

    environment.systemPackages = builtins.attrValues {
      inherit (pkgs)
        wf-recorder
        rofi-wayland
        kitty
        wl-clipboard
        ;
      flameshot = pkgs.flameshot.override {
        enableWlrSupport = true;
      };
    };
  };
}
