{
  config,
  lib,
  pkgs,
  ...
}: let
  cfg = config.hive.plasma;
in {
  options.hive.plasma.enable = lib.mkEnableOption "Plasma configuration";

  config = lib.mkIf cfg.enable {
    # load hm-vars in x-session
    xsession.enable = true;

    # symlink wallpapers
    home.file.".local/share/wallpaper" = {
      source = ../../static/wallpaper;
      recursive = true;
    };

    # provide kvantum and nord theme
    home.packages = [
      pkgs.kdePackages.qtstyleplugin-kvantum
      pkgs.layan-kde
      pkgs.nordzy-cursor-theme
      pkgs.qt6ct
      pkgs.tela-circle-icon-theme
    ];

    programs.konsole = {
      enable = true;
      defaultProfile = "default";
      profiles = {
        default = {
          name = "default";
          colorScheme = "Layan";
          font = {
            name = "Fira Code";
            size = 10;
          };
        };
      };
    };

    # use kvantum theme
    qt.enable = true;
    qt.style.name = "kvantum";
    home.sessionVariables = {
      QT_STYLE_OVERRIDE = "kvantum";
    };

    # add nord like gtk theme
    gtk = {
      enable = true;
      cursorTheme = {
        package = pkgs.nordzy-cursor-theme;
        name = "Nordzy-cursors";
      };
      theme = {
        package = pkgs.nordic;
        name = "Nordic";
      };
      iconTheme = {
        package = pkgs.tela-circle-icon-theme;
        name = "Tela-circle-nord";
      };
    };

    programs.plasma = {
      enable = true;

      #
      # Some high-level settings:
      #
      workspace = {
        clickItemTo = "select";
        lookAndFeel = "com.github.vinceliuice.Layan";
        cursor = {
          theme = "Nordzy-cursors";
          size = 24;
        };
        iconTheme = "Tela-circle-nord";
        wallpaper = "/home/jonas/.local/share/wallpaper/nord.png";
      };

      hotkeys.commands."launch-konsole" = {
        name = "Launch Konsole";
        key = "Meta+Return";
        command = "konsole";
      };

      kwin = {
        edgeBarrier = 0; # Disables the edge-barriers introduced in plasma 6.1
        cornerBarrier = false;

        scripts.polonium.enable = false;
      };

      kscreenlocker = {
        lockOnResume = true;
        timeout = 10;
      };

      #
      # Some mid-level settings:
      #
      shortcuts = {
        ksmserver = {
          "Lock Session" = ["Screensaver" "Meta+Ctrl+Alt+L"];
        };

        kwin =
          {
            "Expose" = "Meta+,";
            "Switch Window Down" = "Meta+J";
            "Switch Window Left" = "Meta+H";
            "Switch Window Right" = "Meta+L";
            "Switch Window Up" = "Meta+K";
            "Window Quick Tile Bottom" = "Meta+Shift+J";
            "Window Quick Tile Left" = "Meta+Shift+H";
            "Window Quick Tile Right" = "Meta+Shift+L";
            "Window Quick Tile Top" = "Meta+Shift+K";
            "Kill Window" = "Meta+Alt+Q";
            "Window Close" = "Meta+Shift+Q";
          }
          // (
            with lib; let
              desktops = map toString (lists.range 1 8);
            in
              listToAttrs
              (map
                (i: {
                  name = "Switch to Desktop ${i}";
                  value = "Meta+${i}";
                })
                desktops)
              // listToAttrs (map
                (i: {
                  name = "Window to Desktop ${i}";
                  value = "Meta+Shift+${i}";
                })
                desktops)
          );
      };
    };
  };
}
