{ lib, nixosConfig, ... }:
let
  cfg = nixosConfig.my.desktop;
in
{
  wayland.windowManager.hyprland = lib.mkIf (cfg.enable && cfg.hyprland.enable) {
    settings = {
      general = {
          gaps_in = 5;
          gaps_out = 5;
          border_size = 0;

          #"col.active_border" = "rgba(707070ff)";
          #"col.inactive_border" = "rgba(d0d0d0ff)";
          layout = "dwindle";
      };

      decoration = {
          rounding = 12;
          active_opacity = 1.0;
          shadow = {
              enabled = true;
              range = 30;
              render_power = 5;
              offset = "0 5";
              color = "rgba(00000070)";
          };
      };

      # Opacity for inactive windows
      # windowrulev2 = opacity 0.9 0.9, floating:0, focus:0

      windowrule = [
        # GNOME apps
        "match:class ^(org\.gnome\.), rounding 12"
        "match:class ^(org\.gnome\.), border_size 0"

        # Terminal apps - no borders
        "match:class ^(org\.wezfurlong\.wezterm)$, border_size 0"
        "match:class ^(Alacritty)$, border_size 0"
        "match:class ^(zen)$, border_size 0"
        "match:class ^(com\.mitchellh\.ghostty)$, border_size 0"
        "match:class ^(kitty)$, border_size 0"

        # Floating windows
        "match:class ^(gnome-calculator)$, float true"
        "match:class ^(blueman-manager)$, float true"
        "match:class ^(org\.gnome\.Nautilus)$, float true"
      ];
      # Quickshell animation
      layerrule = [ "match:namespace ^(quickshell)$, no_anim on" ];
    };
  };
}
