{
  config,
  lib,
  pkgs,
  ...
}: let
  cfg = config.hive.swaync;
in {
  options.hive.swaync = {
    enable = lib.mkEnableOption "Enable swaync";
  };
  config = lib.mkIf cfg.enable {
    xdg.enable = true;
    xdg.configFile = {
      "swaync/themes" = {
        source = ./themes;
      };
      "swaync/icons" = {
        source = ./icons;
        recursive = true;
      };
    };
    services.swaync.enable = true;
    services.swaync.style = ''
      @import 'themes/nova-dark/notifications.css';
      @import 'themes/nova-dark/central_control.css';
    '';
    services.swaync.settings = {
      positionX = "right";
      positionY = "top";
      cssPriority = "user";

      control-center-width = 380;
      control-center-height = 860;
      control-center-margin-top = 2;
      control-center-margin-bottom = 2;
      control-center-margin-right = 1;
      control-center-margin-left = 0;

      notification-window-width = 400;
      notification-icon-size = 48;
      notification-body-image-height = 160;
      notification-body-image-width = 200;

      timeout = 4;
      timeout-low = 2;
      timeout-critical = 6;

      fit-to-screen = false;
      keyboard-shortcuts = true;
      image-visibility = "when-available";
      transition-time = 200;
      hide-on-clear = false;
      hide-on-action = false;
      script-fail-notify = true;
      scripts = {
        example-script = {
          exec = "echo 'Do something...'";
          urgency = "Normal";
        };
      };
      notification-visibility = {
        example-name = {
          state = "muted";
          urgency = "Low";
          app-name = "Spotify";
        };
      };
      widgets = [
        "label"
        "buttons-grid"
        "mpris"
        "title"
        "dnd"
        "notifications"
      ];
      widget-config = {
        title = {
          text = "Notifications";
          clear-all-button = true;
          button-text = " 󰎟 ";
        };
        dnd = {
          text = "Do not disturb";
        };
        label = {
          max-lines = 1;
          text = " ";
        };
        mpris = {
          image-size = 96;
          image-radius = 12;
        };
        volume = {
          label = "󰕾";
          show-per-app = true;
        };
        buttons-grid = {
          actions = [
            {
              label = " ";
              command = "${pkgs.alsa-utils}/bin/amixer set Master toggle";
            }
            {
              label = "";
              command = "${pkgs.alsa-utils}/bin/amixer set Capture toggle";
            }
            {
              label = " ";
              command = "${pkgs.networkmanagerapplet}/bin/nm-connection-editor";
            }
            {
              label = "󰂯";
              command = "${pkgs.blueman}/bin/blueman-manager";
            }
          ];
        };
      };
    };
  };
}
