{
  lib,
  config,
  pkgs,
  ...
}: let
  cfg=config.hyprland;
in {
  options = {
    hyprland = {
      primaryModifier = lib.mkOption {
        type = lib.types.str;
        default = "SUPER";
      };
      secondaryModifier = lib.mkOption {
        type = lib.types.str;
        default = "Control_L";
      };
      terminal = lib.mkOption {
        type = lib.types.str;
        default = "kitty";
      };
      fileManager = lib.mkOption {
        type = lib.types.str;
        default = "dolphin";
      };
    };
  };
  config = {
    wayland.windowManager.hyprland = {
      enable = true;
      settings = {
        monitor = [
            "eDP-1, 2256x1504@60, 0x0, 1"
            "desc:HAT Kamvas 12 l56051794302, 1920x1080@60, 0x1504, 1"
        ];
        
        "$mod1" = cfg.primaryModifier;
        "$mod2" = cfg.secondaryModifier;

        exec-once = [
         "waybar"
         "hyprpaper"
         "nm-applet"
         "hypridle"
         "wl-paste --watch cliphist store"
         "XDG_MENU_PREFIX=arch- kbuildsycoca6"
        ];

        env = [
          "XCURSOR_SIZE,24"
          "HYPRCURSOR_SIZE,24"
          "XDG_SESSION_TYPE,wayland"
          "QT_QPA_PLATFORMTHEME,qt6ct"
          "QT_QPA_PLATFORM,wayland"
          "GTK_THEME, Adwaita:dark"
          "XDG_MENU_PREFIX,plasma-"
        ];

        misc = {
          force_default_wallpaper = 1;
        };

        general = {
          gaps_in = 5;
          gaps_out = 10;
          border_size = 2;
          "col.active_border" = "rgba(463155ff)";
          "col.inactive_border" = "rgba(251b31aa)";
          resize_on_border = false;
          allow_tearing = false;
          layout = "dwindle";
        };

        decoration = {
          rounding = 12;
          rounding_power = 2;
          active_opacity = 1.0;
          inactive_opacity = 0.95;

          shadow = {
            enabled = true;
            range = 4;
            render_power = 3;
            color = "rgba(1a1a1aee)";
          };

          blur = {
            enabled = true;
            size = 5;
            passes = 2;
            noise = 0.06;
            new_optimizations = true;
            vibrancy = 0.1696;
          };
        };

        input = {
          kb_layout = "gb";
          follow_mouse = 1;
          sensitivity = 0;
          touchpad = {
            natural_scroll = true;
          };

          gesture = [
            "3, horizontal, workspace"
          ];

          bind = [
            "$mod1, Q, exec, ${cfg.terminal}"
            "$mod2&Shift_L, Q, killactive"
            "$mod2&alt, Q, forcekillactive"
            "$mod1, L, exec, hyprlock"
            "$mod1&alt, L, exit"
            "$mod1, F, exec, ${cfg.fileManager}"
            "$mod1&Shift_L, V, togglefloating"
            "$mod1, R, exec, rofi -show run"
            "alt, space, exec, rofi -show drun"
            "$mod1, P, pseudo, "
            "$mod1, J, togglesplit, "
            "$mod2&Shift_L, F, fullscreen"
            "$mod1, left, movefocus, l"
            "$mod1, right, movefocus, r"
            "$mod1, up, movefocus, u"
            "$mod1, down, movefocus, d"
            "$mod1&$mod2, right, workspace, +1"
            "$mod1&$mod2, left, workspace, -1"
            "$mod1&$mod2&Shift_L, right, movetoworkspace, +1"
            "$mod1&$mod2&Shift_L, left, movetoworkspace, -1"
            "$mod1, mouse_down, workspace, e+1"
            "$mod1, mouse_up, workspace, e-1"
            ", PRINT, exec, hyprshot -m region --clipboard-only"
            "Shift_L, PRINT, exec, hyprshot -m region"
            "$mod1, T, exec, hyprctl setprop active opaque toggle"
            "$mod1, V, exec, cliphist list | rofi -dmenu | cliphist decode | wl-copy"
          ];

          bindm = [
            "$mod1, mouse:272, movewindow"
            "$mod1, mouse:273, resizewindow"
          ];

          bindel = [
            ",XF86AudioRaiseVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+"
            ",XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-"
            ",XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"
            ",XF86MonBrightnessUp, exec, brightnessctl s 10%+"
            ",XF86MonBrightnessDown, exec, brightnessctl s 10%-"
          ];

          bindl = [
            ", XF86AudioNext, exec, playerctl next"
            ", XF86AudioPause, exec, playerctl play-pause"
            ", XF86AudioPlay, exec, playerctl play-pause"
            ", XF86AudioPrev, exec, playerctl previous"
            ", switch:Lid Switch, exec, hyprlock"
          ];
        };
      };
    };
  };
}
