#!/bin/zsh setopt no_unset extended_glob # warn_create_global set -x wid=$(xdotool getactivewindow) || exit $? title=$(xdotool getwindowname $wid) || exit $? if [[ $title != *«s=xpra\ * ]]; then echo >&2 "failed to determine xpra window" exit 3 fi typeset -gA win_meta for kv in ${=${title##*«s=xpra\ }}; do [[ $kv != *=* ]] && exit 3 win_meta[${kv%%=*}]=${kv#*=} done [[ -n $win_meta[w] && -n $win_meta[d] ]] || exit 3 s6-sudo /run/inbox/xpra.ccx/run/exec/exec export DISPLAY $win_meta[d] xdotool getwindowname $win_meta[w] #s6-sudo /run/inbox/xpra.ccx/run/exec/exec export DISPLAY $win_meta[d] wmctrl -l clip | IFS= read -r -d '' clip [[ -n $clip ]] || exit $? s6-sudo /run/inbox/xpra.ccx/run/exec/exec export DISPLAY $win_meta[d] xclip -i -sel CLIPBOARD <(printf %s $clip) || exit $? xdotool windowfocus $wid key --window $wid Caps_Lock+v