{
  lib,
  config,
  ...
}: let
  inherit (lib) mkIf;
  cfg = config.horseman.wm.hyprland;
in {
  config = mkIf cfg.enable {
    horseman.wm.hyprland.config = {
      waybar = {
        layout = {
          vertical = {
            left = ["group/power"];
            center = ["hyprland/workspaces"];
            right = ["network" "pulseaudio" "memory" "cpu" "battery" "clock"];
          };
          horizontal = {
            left = ["group/power"];
            center = ["hyprland/workspaces"];
            right = ["network" "pulseaudio" "memory" "cpu" "battery" "clock"];
          };
        };

        formats = {
          horizontal = {
            "clock" = {
              format = "󰥔 {:%H:%M:%S}";
              format-alt = " {:%a %d %b %Y}";
            };
            "battery" = {
              format = "{icon} {capacity}%";
              format-charging = "󰂄 {capacity}%";
            };
            "cpu" = {
              format = " {usage}%";
            };
            "memory" = {
              format = " {percentage}%";
            };
            "pulseaudio" = {
              format = " {volume}";
            };
            "network" = {
              format = "{ipaddr}";
              format-ethernet = " {ipaddr}";
              format-disconnected = "󰣽 Disconnected";
              format-wifi = "󰤨 {essid}";
            };
            "group/power" = {
              orientation = "horizontal";
            };
          };
          vertical = {
            "clock" = {
              format = "{:%H\n%M\n%S}";
              format-alt = "{:%d\n%m\n%y}";
            };
            "battery" = {
              format = "{icon}{capacity}";
              format-charging = "󰂄{capacity}";
            };
            "cpu" = {
              format = " {usage}";
            };
            "memory" = {
              format = " {percentage}";
            };
            "pulseaudio" = {
              format = " {volume}";
            };
            "network" = {
              format = "󰤨";
              format-ethernet = "";
              format-disconnected = "󰣽";
              format-disabled = "󰣽";
              format-wifi = "󰤨";
            };
            "group/power" = {
              orientation = "vertical";
            };
          };
        };
        modules = {
          "clock" = {
            interval = 1;
            tooltip = false;
          };

          "cpu" = {
            interval = 3;
            on-click = "kitty btop &";
          };

          "memory" = {
            interval = 3;
            on-click = "kitty btop &";
          };

          "pulseaudio" = {
            on-click = "kitty pulsemixer &";
          };

          "network" = {
            interval = 3;

            tooltip-format = " {bandwidthDownBits} , {bandwidthDownBits} ";
            tooltip-format-wifi = "{essid}:  {bandwidthDownBits} , {bandwidthDownBits} ";
            on-click = "nm-applet";
          };

          "battery" = {
            interval = 3;
            format-icons = ["󰁻" "󰁽" "󰁿" "󰂁" "󰁹"];
            states = {
              critical = 15;
            };
          };

          "hyprland/workspaces" = {
            format = "{icon}";
            format-icons = {
              "active" = "";
              "default" = "";
              "empty" = "";
            };
            persistent-workspaces = {
              "*" = [1 2 3 4 5 6 7 8 9 10];
            };
          };

          "group/power" = {
            drawer = {};
            modules = [
              "custom/lock"
              "custom/power"
              "custom/reboot"
              "idle_inhibitor"
            ];
          };

          "custom/lock" = {
            format = " ";
            tooltip = false;
            on-click = "hyprlock";
          };
          "custom/reboot" = {
            format = " ";
            tooltip = false;
            on-click = "reboot";
          };
          "custom/power" = {
            format = " ";
            tooltip = false;
            on-click = "shutdown now";
          };
          "idle_inhibitor" = {
            tooltip = false;
            format = "{icon}";
            format-icons = {
              deactivated = "󰒲 ";
              activated = "󰒳 ";
            };
          };
        };
      };
    };
  };
}
