#!/bin/sh

case $1 in
{% if clipboard == 'clipman' %}
    --wofi) clipman pick --tool wofi -T'-p "Clipboard " -i -O default' ;;
    --rofi) clipman pick --tool rofi ;;
    --fzf) clipman pick --tool fzf -T'--prompt "Clipboard " --no-multi -e' ;;

    --wofi-clear) clipman clear --tool wofi -T'-p "Clear clipboard " -i -O default' ;;
    --rofi-clear) clipman clear --tool rofi ;;
    --fzf-clear) clipman clear --tool fzf -T'--prompt "Clear clipboard " -e' ;;

    --start) wl-paste -t text --watch clipman store --no-persist ;;
    --clear) clipman clear --all && notify-send -i "$HOME/.config/{{ notification }}/clipboard.png" "Clipboard cleared" ;;
{% elif clipboard == 'cliphist' %}
    --wofi) cliphist list | wofi -d -p "Clipboard " -i -O default | cliphist decode | wl-copy ;;
    --rofi) cliphist list | rofi -dmenu -p "Clipboard" | cliphist decode | wl-copy ;;
    --fzf) cliphist list | fzf --prompt "Clipboard " --no-multi -e | cliphist decode | wl-copy ;;

    --wofi-clear) cliphist list | wofi -d -p "Clear clipboard " -i -O default | cliphist delete ;;
    --rofi-clear) cliphist list | rofi -dmenu -p "Clear clipboard" | cliphist delete ;;
    --fzf-clear) cliphist list | fzf --prompt "Clear clipboard " -e | cliphist delete ;;

    --start) wl-paste --watch cliphist store ;;
    --clear) rm -f "$XDG_CACHE_HOME/cliphist/db" && notify-send -i "$HOME/.config/{{ notification }}/clipboard.png" "Clipboard cleared" ;;
{% endif %}
    *) ;;
esac
