#!/bin/bash selection=$(cat) [[ -z "$selection" ]] && exit 0 pkill -u $USER -x xclip if [[ "$selection" == file://* && "$selection" == *.png ]]; then echo -n "$selection" | xclip -selection clipboard -t text/uri-list fi