{ pkgs, ... }:

{
  programs.waybar = {
    enable = true;

    style = builtins.readFile ./waybar/waybar-style.css;

    settings.mainBar = {
      layer = "top";
      position = "top";
      height = 30;

      modules-left = [
        "hyprland/workspaces"
        "mpris"
      ];
      
      modules-center = [
        "wlr/taskbar"
      ];

      modules-right = [
        "pulseaudio"
        "cpu"
        "tray"
        "battery"
        "clock"
      ];

      pulseaudio = {
        format = "{icon} {volume}%";
        format-muted = "󰝟 muted";
        tooltip = false;

        scroll-step = 5;

        format-icons = {
          default = [ "󰕿" "󰖀" "󰕾" ];
        };

        on-click = "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle";
      };

      mpris = {
        player = "spotify";
        format = "{player_icon} {artist} - {title}";
        format-paused = "{player_icon} ⏸ {title}";
        tooltip = true;
        ignored-players = [ "firefox" "vlc" ];
      };

      tray = {
        spacing = 10;
      };

      cpu = {
        format = "  {usage}%";
        tooltip = false;
      };

      clock = {
        tooltip = false;
      };

      "wlr/taskbar" = {
        format = "{icon} {name}";
        on-click = "activate";
      };

      battery = {
        "format" = "{icon}  {capacity}%";
        "format-icons" = ["" "" "" "" ""];
      };
    };
  };
}
