{ pkgs, ... }:
let
  clipboard = pkgs.writeShellScriptBin "clipboard" ''
    #!/usr/bin/env bash

    if [ -t 0 ]; then
      ${pkgs.wl-clipboard}/bin/wl-paste
    else
      cat - | ${pkgs.wl-clipboard}/bin/wl-copy -n
    fi
  '';

  clipboard-clear = pkgs.writeShellScriptBin "clipboard-clear" ''
    ${pkgs.wl-clipboard}/bin/wl-copy --all
  '';
in
{
  home.packages = [
    clipboard
    clipboard-clear
  ];
}
