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

with lib;

let
  cfg = config.settings.desktop-environments.hyprland;
in {
  options = {
    settings.desktop-environments.hyprland.enable = lib.mkOption {
      type = lib.types.bool;
      description = ''
        Enable hyprland window manager
      '';
    };
  };

  config = mkIf cfg.enable {
    programs.hyprland = {
      enable = true;
      package = pkgs.unstable.hyprland;
      xwayland.enable = true;
    };

    # Sound configuration
    hardware.pulseaudio.enable = false;
    security.rtkit.enable = true;
    services.pipewire = {
      enable = true;
      alsa.enable = true;
      alsa.support32Bit = true;
      pulse.enable = true;
    };

    # Keyring configuration
    security.polkit.enable = true;
    services.gnome.gnome-keyring.enable = true;
    security.pam.services.greetd.enableGnomeKeyring = true;
    programs.ssh.startAgent = true;

    # Configure networking
    networking.networkmanager.enable = true;
    networking.wireless.iwd.enable = true;
  };
}
