{ pkgs, ... }:

{
  home.packages = with pkgs; [
    bzmenu
    hyprshot
    hyprlock
    playerctl
  ];

  wayland.windowManager.hyprland = {
    enable = true;

    settings = {
      ### MONITOR
      monitor = [
        ",preferred,auto,1"
      ];

      ### VARIABLES
      "$mod" = "SUPER";
      "$terminal" = "kitty";
      "$menu" = "rofi -show drun";
      "$bluetoothMenu" = "bzmenu --launcher rofi";

      ### BASIC LAYOUT
      general = {
        layout = "dwindle";
        resize_on_border = true;
      };

      decoration = {
        inactive_opacity = 0.9;
        active_opacity = 1.0;
        rounding = 5;
        rounding_power = 2.5;
        blur = {
          enabled = true;
          brightness = 1.0;
          contrast = 1.0;
          noise = 0.01;

          vibrancy = 0.2;
          vibrancy_darkness = 0.5;

          passes = 4;
          size = 7;

          popups = true;
          popups_ignorealpha = 0.2;
        };

        shadow = {
          enabled = true;
          color = "rgba(00000055)";
          ignore_window = true;
          offset = "0 15";
          range = 100;
          render_power = 2;
          scale = 0.97;
        };
      };

      exec-once = [
        "waybar"
      ];

      ### INPUT
      input = {
        kb_layout = "us";
      };

      ### KEYBINDINGS
      bind = [
        # Apps
        "$mod, RETURN, exec, $terminal"
        "$mod, D, exec, $menu"
        "$mod, B, exec, $bluetoothMenu"
        "$mod, Q, killactive"
        "$mod, F, fullscreen"
        "$mod, M, exit"
        "$mod, L, exec, hyprlock"

        # Focus
        "$mod, LEFT,  movefocus, l"
        "$mod, RIGHT, movefocus, r"
        "$mod, UP,    movefocus, u"
        "$mod, DOWN,  movefocus, d"

        # Workspaces
        "$mod, 1, workspace, 1"
        "$mod, 2, workspace, 2"
        "$mod, 3, workspace, 3"
        "$mod, 4, workspace, 4"
        "$mod, 5, workspace, 5"
        "$mod, 6, workspace, 6"
        "$mod, 7, workspace, 7"
        "$mod, 8, workspace, 8"
        "$mod, 9, workspace, 9"

        "$mod SHIFT, 1, movetoworkspace, 1"
        "$mod SHIFT, 2, movetoworkspace, 2"
        "$mod SHIFT, 3, movetoworkspace, 3"
        "$mod SHIFT, 4, movetoworkspace, 4"
        "$mod SHIFT, 5, movetoworkspace, 5"
        "$mod SHIFT, 6, movetoworkspace, 6"
        "$mod SHIFT, 7, movetoworkspace, 7"
        "$mod SHIFT, 8, movetoworkspace, 8"
        "$mod SHIFT, 9, movetoworkspace, 9"

        # Window movement
        "$mod SHIFT, LEFT,  movewindow, l"
        "$mod SHIFT, RIGHT, movewindow, r"
        "$mod SHIFT, UP,    movewindow, u"
        "$mod SHIFT, DOWN,  movewindow, d"

        # Hyprshot
        "$mod, Z, exec, hyprshot -m region"

	# Media keys
	", XF86AudioPlay,        exec, playerctl play-pause"
	", XF86AudioMute,        exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"
	", XF86AudioRaiseVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+"
	", XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-"
      ];

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