{
  config, ...
}: {
  systemd.user.services.waybar = {
    Unit.StartLimitBurst = 30;
  };

  programs.waybar = {
    enable = true;
    systemd.enable = true;
    settings = {
      primary = {
        # exclusive = false;
        # passthrough = false;
        height = 40;
        position = "top";
        margin-top = 6;
        margin-left = 6;
        margin-right = 6;
        modules-left = [
          "hyprland/workspaces"
          "hyprland/submap"
        ];

        modules-center = [
          "cpu"
          "memory"
          "clock"
        ];

        modules-right = [
          "tray"
          "network"
          "pulseaudio"
          "battery"
        ];
      };
    };

    style = let 
      inherit (config.lib.stylix.colors) withHashtag;
    in ''
    * {
      font-family: ${config.fontProfiles.regular.family}, ${config.fontProfiles.monospace.family};
      font-size: 12pt;
      padding: 0;
      margin: 0 0.4em;
    }

    window#waybar {
      padding: 0;
      border-radius: 0.5em;
    }

    .modules-left {
      margin-left: -0.65em;
    }
    .modules-right {
      margin-right: -0.65em;
    }

    #workspaces button {
      padding-left: 0.4em;
      padding-right: 0.4em;
      margin-top: 0.15em;
      margin-bottom: 0.15em;
    }

    #workspaces button.active,
    #workspaces button.focused {
      background-color: ${withHashtag.base08};
    }
    '';
  };
}