{
  lib,
  config,
  pkgs,
  ...
}: let
  cfg = config.sway.theming;

  # currently, there is some friction between sway and gtk:
  # https://github.com/swaywm/sway/wiki/GTK-3-settings-on-Wayland
  configure-gtk = pkgs.writeShellScriptBin "configure-gtk" ''
    gnome_schema=org.gnome.desktop.interface
    gsettings set $gnome_schema gtk-theme 'Dracula'
  '';
in {
  options = {
    sway.theming.enable = lib.mkEnableOption "theming for sway";
  };

  config = lib.mkIf cfg.enable {
    wayland.windowManager.sway.config = {
      fonts = {
        names = ["FiraCode Nerd Font"];
        size = 11.0;
      };

      colors = {
        background = "#00000000";
        focused = {
          border = "#00FFEE";
          background = "#4477AA";
          text = "#F0F0F0";
          childBorder = "#00FFEE";
          indicator = "#00AA88";
        };
        focusedInactive = {
          border = "#626262";
          background = "#444444";
          text = "#F0F0F0";
          childBorder = "#626262";
          indicator = "#00AA88";
        };
        placeholder = {
          border = "#313131";
          background = "#222222";
          text = "#F0F0F0";
          childBorder = "#313131";
          indicator = "#005544";
        };
        unfocused = {
          border = "#313131";
          background = "#222222";
          text = "#F0F0F0";
          childBorder = "#313131";
          indicator = "#00AA88";
        };
        urgent = {
          border = "#FF3131";
          background = "#882222";
          text = "#F0F0F0";
          childBorder = "#FF3131";
          indicator = "#00AA88";
        };
      };

      focus.mouseWarping = true;

      gaps = {
        inner = 5;
        smartGaps = true;
        smartBorders = "no_gaps";
      };
      window.titlebar = false;

      startup = [
        {command = "${configure-gtk}/bin/configure-gtk";}
      ];
    };

    gtk = {
      enable = true;
      cursorTheme = {
        package = pkgs.capitaine-cursors;
        name = "capitaine-cursors-white";
        size = 24;
      };
      iconTheme = {
        package = pkgs.whitesur-icon-theme;
        name = "WhiteSur-dark";
      };
      theme = {
        package = pkgs.whitesur-gtk-theme;
        name = "WhiteSur-Dark";
      };
      gtk3.extraConfig = {
        gtk-dialogs-use-header = false;
        gtk-cursor-theme-size = 0;
        gtk-toolbar-style = "GTK_TOOLBAR_BOTH_HORIZ";
        gtk-toolbar-icon-style = "GTK_ICON_SIZE_LARGE_TOOLBAR";
        gtk-button-images = 0;
        gtk-menu-images = 0;
        gtk-enable-event-sounds = 0;
        gtk-enable-input-feedback-sounds = 1;
        gtk-xft-antialias = 1;
        gtk-xft-hinting = 1;
        gtk-xft-hintstyle = "hintslight";
        gtk-xft-rgba = "none";
      };
    };
    home.pointerCursor = {
      package = pkgs.capitaine-cursors;
      name = "capitaine-cursors-white";
      size = 24;
      x11.enable = true;
      x11.defaultCursor = "capitaine-cursors-white";
    };
    xsession.enable = true;

    services.mako = {
      backgroundColor = "#313131";
      borderColor = "#00FFEE";
      progressColor = "#338833";
      textColor = "#e0e0e0";
      extraConfig = ''
        [urgency=low]
        border-color=#008877
      '';
    };
  };
}
