{
  inputs,
  pkgs,
  lib,
  config,
  ...
}:
{
  imports = [
    ./hyprlock.nix
    ./hypridle.nix
  ];
  options.hyprland.enable = lib.mkEnableOption "Hyprland";
  config = {
    home.packages = with pkgs; [
      cliphist
      dunst
      # hyprlock
      hyprpaper
      rofi-wayland
      slurp
      swww
      waybar
      wl-clipboard
      catppuccin-cursors.macchiatoLavender
      bibata-cursors
      # For potentially fixing some issues
      libsForQt5.qt5.qtwayland
      libsForQt5.qt5ct
    ];

    wayland.windowManager.hyprland = {
      enable = true;
      package = pkgs.hyprland;
      settings = {
        "$mainMod" = "SUPER";
        "$shiftMainMod" = "SUPER_SHIFT";
        "$term" = "kitty";

        # monitors
        "$mon_top" = "desc:BNQ G2420HDBL T2B04424SL000";
        "$mon_left" = "desc:Samsung Electric Company LS27A600U HNMT502389";
        "$mon_center" = "desc:Acer Technologies XB271HU #ASPVEKfgZ8Dd";
        "$mon_right" = "desc:Samsung Electric Company LS27A600U HNMT502390";

        monitor = [
          # "$mon_top,1920x1080@60,2560x0,1" # top T2B04424SL000
          "DP-6,1920x1080@60,2560x0,1" # top T2B04424SL000 60
          # "$mon_left,2560x1440@75,0x1080,1" # left
          "DP-8,2560x1440@75,0x1080,1" # left 75hz
          # "$mon_center,2560x1440@120,2560x1080,1" # main #ASPVEKfgZ8Dd
          "DP-5,2560x1440@144,2560x1080,1" # main #ASPVEKfgZ8Dd 120hz
          # "$mon_right,2560x1440@75,5120x1080,1" # right
          "DP-7,2560x1440@75,5120x1080,1" # right 75hz
        ];
        input = {
          kb_layout = "no";
          follow_mouse = 1;
        };

        cursor = {
          no_hardware_cursors = true;
        };

        env = [
          "LIBVA_DRIVER_NAME,nvidia"
          "XDG_SESSION_TYPE,wayland"
          "GBM_BACKEND,nvidia-drm"
          # "__GLX_VENDOR_LIBRARY_NAME,nvidia"
          "WLR_NO_HARDWARE_CURSORS,1"
        ];

        decoration = {
          rounding = 10;
          drop_shadow = true;
          shadow_range = 4;
          shadow_render_power = 3;
          blur = {
            enabled = true;
            size = 3;
            passes = 1;
            xray = true;
          };
        };

        general = {
          gaps_in = 4;
          gaps_out = 10;
          border_size = 2;
          layout = "dwindle";
        };

        animations = {
          enabled = true;
          bezier = [
            "myBezier, 0.05, 0.9, 0.1, 1.05"
            "easeInB, 0.6, -0.28, 0.735, 0.045"
          ];
          animation = [
            "windows, 1, 7, myBezier"
            "windowsOut, 1, 7, default, popin 80%"
            "border, 1, 10, default"
            "borderangle, 1, 8, default"
            "fade, 1, 7, default"
            "workspaces, 1, 6, easeInB, slidefadevert"
            "specialWorkspace, 1, 4, default, fade"
          ];
        };
        dwindle = {
          pseudotile = true;
          preserve_split = true;
          special_scale_factor = 0.85;
        };
        master = {
          new_status = "master";
        };
        misc = {
          force_default_wallpaper = 0;
          disable_hyprland_logo = true;
        };

        windowrulev2 = [
          "opacity 0.95 override 0.7 override,class:^(Alacritty)$"
          "opacity 0.95 override 0.7 override,class:^(kitty)$"
        ];

        workspace = [
          "name:T1, monitor:$mon_top, persistent:true, default:true"
          "name:T2, monitor:$mon_top, persistent:true, default:false"
          "name:L1, monitor:$mon_left, persistent:true, default:true"
          "name:L2, monitor:$mon_left, persistent:true, default:false"
          "name:R1, monitor:$mon_right, persistent:true, default:true"
          "name:R2, monitor:$mon_right, persistent:true, default:false"
          "name:c1, monitor:$mon_center, persistent:true, default:true"
          "name:c2, monitor:$mon_center, persistent:true, default:false"
          "name:c3, monitor:$mon_center, persistent:true, default:false"
          "name:c4, monitor:$mon_center, persistent:true, default:false"
          "special:special, on-created-empty:kitty, rounding:true, decorate:false, border:false"
        ];

        bindm = [
          "$mainMod,mouse:272,movewindow"
          "$shiftMainMod,mouse:272,resizewindow"
        ];

        bindr = [
          # mumble ptt release
          # ",code:202,exec,mumble rpc stoptalking"
          # ",code:202,exec,pamixer --source 63 -m"
          # ",code:202,exec,sleep 0.5 && pamixer --default-source -m"
        ];

        bind = [
          # term
          "$mainMod,Return,exec,$term"

          # hyprlock
          "$shiftMainMod,l,exec,lockhelper"

          # rofi
          "$mainMod,D,exec,rofi-launcher"
          "$mainMod,P,exec,rofi-rbw"

          # hyprland
          "$mainMod,Q,killactive,"
          "CTRLALT,Delete,exit,"
          "$mainMod,Space,togglefloating,"
          "$mainMod,F,fullscreen,"

          # focus
          "$mainMod,l,movefocus,l"
          "$mainMod,h,movefocus,r"
          "$mainMod,k,movefocus,u"
          "$mainMod,j,movefocus,d"

          # move
          "$mainMod,h,movewindow,l"
          "$mainMod,l,movewindow,r"
          "$mainMod,k,movewindow,u"
          "$mainMod,j,movewindow,d"

          # Force opacity
          "$shiftMainMod,o,exec, hl-no-opacity"

          # grimblast
          "$mainMod,Print,exec,grimblast save active ~/tmp/$(date -Iseconds).png"
          "$shiftMainMod,Print,exec,grimblast copy area"
          ",Print,exec,grimblast copy active"

          # mumble ptt click
          # ",code:202,exec,mumble rpc starttalking"
          #",code:202,pass,^(info\.mumble\.Mumble)$"
          # ",code:202,exec,pamixer --default-source -u"
          ",code:202,pass,^discord$"

          # Paste to wtype
          "$mainMod,v,exec,sleep 0.5s && wl-paste | wtype -"

          # worspace switching
          "$mainMod,1,workspace,name:c1"
          "$mainMod,2,workspace,name:c2"
          "$mainMod,3,workspace,name:c3"
          "$mainMod,4,workspace,name:c4"
          "$mainMod,5,workspace,5"
          "$mainMod,6,workspace,6"

          # Move window to workspace
          "$shiftMainMod,1,movetoworkspace,name:c1"
          "$shiftMainMod,2,movetoworkspace,name:c2"
          "$shiftMainMod,3,movetoworkspace,name:c3"
          "$shiftMainMod,4,movetoworkspace,name:c4"
          "$shiftMainMod,5,movetoworkspace,5"
          "$shiftMainMod,6,movetoworkspace,6"

          # Special workspace
          "$mainMod,c,togglespecialworkspace"
          "$shiftMainMod,c,movetoworkspace, special"
        ];

        exec-once = [
          "waybar"
          "hyprpaper & sleep 10 && randomwp"
          "easyeffects --gapplication-service"
          "hypridle"
          "streamcontroller -b"
          # "dunst"
        ];
      };
    };
  };
}