#!/bin/bash

notify_flag="0"
XDG_DATA_HOME=${XDG_DATA_HOME:-$HOME/.local/share}

while [[ $# -gt 0 ]]; do
  if [[ $1 == "-n" ]] || [[ $1 == "--notify-complete" ]]; then
    notify_flag="1"
  fi
  shift
done

if [[ -n "$WAYLAND_DISPLAY" ]]; then
  wl-copy --clear
fi

rm $XDG_DATA_HOME/clipse/clipboard_history.json >/dev/null 2>&1

if [[ $notify_flag == "1" ]] && [[ -n "$WAYLAND_DISPLAY" ]]; then
  notify-send --urgency=low --expire-time=3000 --app-name="Clipboard History" "✅ Cleared clipboard history"
fi
