Add support for copying to clipboard (based on patch by Dana Jansens).