#!/usr/bin/bash

# This project is licensed under the MIT License (see LICENSE).

skip=false

while read -r selection; do
    if $skip; then
        skip=false
        continue
    fi
    case "$selection" in
        PRIMARY)
            skip=true
            xsel | xsel -ib
            ;;
        CLIPBOARD)
            skip=true
            xsel -b | xsel -i
            ;;
    esac
done < <(clipped)
