{ pkgs, config, lib, ... }:
{
  programs.hyprlock = {
    enable = true;
    # settings = {
    #   text_color = "rgba(FFFFFFFF)";
    #   entry_background_color = "rgba(33333311)";
    #   entry_border_color = "rgba(3B3B3B55)";
    #   entry_color = "rgba(FFFFFFFF)";
    #   font_family = "Rubik Light";
    #   font_family_clock = "Rubik Light";
    #   font_material_symbols = "Material Symbols Rounded";

    #   background = {
    #       # color = r"gba(0D0D17FF)";
    #       color = "rgba(000000FF)";
    #       # path = "{{ SWWW_WALL }}";
    #       path = "${config.home.homeDirectory}/.local/share/wallpapers/northern-lights-arctic-circle-norway-07.jpg";
    #       blur_size = 5;
    #       blur_passes = 4;
    #   };

    #   input-field = {
    #       monitor = "";
    #       size = "250, 50";
    #       outline_thickness = 2;
    #       dots_size = 0.1;
    #       dots_spacing = 0.3;
    #       outer_color = "${entry_border_color}";
    #       inner_color = "${entry_background_color}";
    #       font_color = "${entry_color}";
    #       # fade_on_empty = true,\;

    #       position = "0, 20";
    #       halign = "center";
    #       valign = "center";
    #   };

    #   label = { # Clock
    #       monitor = "";
    #       text = "${TIME12}";
    #       shadow_passes = 1;
    #       shadow_boost = 0.5;
    #       color = "${text_color}";
    #       font_size = 65;
    #       font_family = "${font_family_clock}";

    #       position = "0, 300";
    #       halign = "center";
    #       valign = "center";
    #   };

    #   label = { # Greeting
    #       monitor = "";
    #       text = "hi $USER !!!";
    #       shadow_passes = 1;
    #       shadow_boost = 0.5;
    #       color = "$[text_color]";
    #       font_size = 20;
    #       font_family = "${font_family}";

    #       position = "0, 240";
    #       halign = "center";
    #       valign = "center";
    #   };

    #   label = { # lock icon
    #       monitor = "";
    #       text = "lock";
    #       shadow_passes = 1;
    #       shadow_boost = 0.5;
    #       color = "${text_color}";
    #       font_size = 21;
    #       font_family = "${font_material_symbols}";

    #       position = "0, 65";
    #       halign = "center";
    #       valign = "bottom";
    #   };

    #   label = { # "locked" text
    #       monitor = "";
    #       text = "locked";
    #       shadow_passes = 1;
    #       shadow_boost = 0.5;
    #       color = "${text_color}";
    #       font_size = 14;
    #       font_family = "${font_family}";

    #       position = "0, 45";
    #       halign = "center";
    #       valign = "bottom";
    #   };

    #   label = { # Status
    #       monitor = "";
    #       text = "";
    #       shadow_passes = 1;
    #       shadow_boost = 0.5;
    #       color = "${text_color}";
    #       font_size = 14;
    #       font_family = "${font_family}";

    #       position = "30, -30";
    #       halign = "left";
    #       valign = "top";
    #   };
    # };
  };

  services.hypridle = {
    enable = true;
    settings = {
      # $lock_cmd = pidof hyprlock || hyprlock
      # $suspend_cmd = pidof steam || systemctl suspend || loginctl suspend # fuck nvidia

      general = {
        lock_cmd = "pidof hyprlock || hyprlock";
        before_sleep_cmd = "loginctl lock-session";
      };

      listener = [
        {
          timeout = 5400;
          on-timeout = "loginctl lock-session";
        }

        {
          timeout = 7200;
          on-timeout = "hyprctl dispatch dpms off";
          on-resume = "hyprctl dispatch dpms on";
        }

        {
          timeout = 10800;
          on-timeout = "pidof steam || systemctl suspend || loginctl suspend";
        }
      ];
    };
  };
  services.hyprpaper = {
    enable = true;
    settings = {
      splash = true;
      preload = [
        "${config.home.homeDirectory}/Pictures/bg-left.png"
        "${config.home.homeDirectory}/Pictures/bg-center.png"
        "${config.home.homeDirectory}/Pictures/bg-right.png"
        "${config.home.homeDirectory}/.local/share/wallpapers/Nordic-mountain-wallpaper.jpg"
        "${config.home.homeDirectory}/.local/share/wallpapers/Nordic-mountain.jpg"
        "${config.home.homeDirectory}/.local/share/wallpapers/northern-lights-arctic-circle-norway-07.jpg"
        "${config.home.homeDirectory}/.local/share/wallpapers/canoe-3840x2160-scandinavia-europe-5k-18949.jpg"
      ];

      wallpaper = [
        "DP-3,~/.local/share/wallpapers/Nordic-mountain-wallpaper.jpg"
        "DP-5,~/.local/share/wallpapers/northern-lights-arctic-circle-norway-07.jpg"
        "DP-6,~/.local/share/wallpapers/canoe-3840x2160-scandinavia-europe-5k-18949.jpg"
      ];
    };
  };
  programs.wlogout = {
    enable = true;
    layout = [
          {
              label = "lock";
              action = "pkill hyprlock && loginctl lock-session";
              text = "Lock - l";
              keybind = "l";
              circular = false;
          }
          {
              label = "hibernate";
              action = "systemctl hibernate";
              text = "Hibernate - h";
              keybind = "h";
              circular = false;
          }
          {
              label = "logout";
              action = "${config.home.homeDirectory}/bin/hypr-logout.sh";
              text = "Logout - e";
              keybind = "e";
              circular = false;
          }
          {
            label = "shutdown";
            action = "systemctl poweroff";
            text = "Shutdown - l";
            keybind = "s";
            circular = false;
          }
          {
              label = "suspend";
              action = "systemctl suspend";
              text = "Suspend - u";
              keybind = "u";
              circular = false;
          }
          {
              label = "reboot";
              action = "systemctl reboot";
              text = "Reboot - r";
              keybind = "r";
              circular = false;
          }
        ];
        style = ''
        * {
          background-image: none;
        }

        window {
          background: #4C566A;
        }

        button {
          color: #D8DEE9;
          font-size: 16px;
          background-color: #81A1C1;
          border-style: none;
          background-repeat: no-repeat;
          background-position: center;
          background-size: 35%;
          border-radius:30px;
          margin: 182px 5px;
          text-shadow: 0px 0px;
          box-shadow: 0px 0px;
        }

        button:focus, button:active, button:hover {
          color: #ECEFF4;
          background-color: #5E81AC;
          outline-style: none;
        }

        #lock {
            background-image: image(url("${config.home.homeDirectory}/.local/share/wlogout/assets/lock.svg"));
        }

        #logout {
            background-image: image(url("${config.home.homeDirectory}/.local/share/wlogout/assets/logout.svg"));
        }

        #suspend {
            background-image: image(url("${config.home.homeDirectory}/.local/share/wlogout/assets/suspend.svg"));
        }

        #hibernate {
            background-image: image(url("${config.home.homeDirectory}/.local/share/wlogout/assets/hibernate.svg"));
        }

        #shutdown {
            background-image: image(url("${config.home.homeDirectory}/.local/share/wlogout/assets/shutdown.svg"));
        }

        #reboot {
            background-image: image(url("${config.home.homeDirectory}/.local/share/wlogout/assets/reboot.svg"));
        }
        '';
  };
  services.swayosd = {
    enable = true;
    display = "DP-4";
  };
  services.mako.enable = true;

  imports = [
    (import ../../pkgs/wm/hyprland/hyprland.nix { inherit pkgs config; })
    (import ../../pkgs/wm/waybar/waybar.nix { inherit config; pkgs = pkgs; })
    (import ../../pkgs/wm/mako/mako.nix { config = config; pkgs = pkgs; lib=lib; })
  ];
}