#!/bin/sh tmpfile=$(mktemp) if "$@" >"$tmpfile"; then if [ "$XDG_SESSION_TYPE" = "wayland" ]; then cat "$tmpfile" | wl-copy elif [ "$XDG_SESSION_TYPE" = "x11" ]; then cat "$tmpfile" | xclip -selection clipboard else echo "UNKNOWN SESSION TYPE!! >> $XDG_SESSION_TYPE" >&2 rm -f "$tmpfile" exit 1 fi cat "$tmpfile" rm -f "$tmpfile" exit 0 else cat "$tmpfile" rm -f "$tmpfile" exit 1 fi