This works (puts the date and time in the clipboard) in just iTerm:
printf "\e]1337;Copy=:$(date | base64)\a"; echo $(pbpaste)
This works in tmux running locally (using the DCS passthrough):
printf "\ePtmux;\e\e]1337;Copy=:$(date | base64)\a\e\\"; echo $(pbpaste)
This works in tmux running remotely:
printf "\ePtmux;\e\e]1337;Copy=:$(date | base64)\a\e\\"; echo $(ssh -p 2222 -qt localhost pbpaste)
My only problem is running tmux remotely under a local tmux:
printf "\ePtmux;\e\ePtmux;\e\e]1337;Copy=:$(date | base64)\a\e\\\e\\"; echo $(ssh -p 2222 -qt localhost pbpaste)
I think the problem is the inner \e\\ is being interpreted as the outer \e\\.
Is there some way to escape the inner \e\\ so it makes it the outer tmux properly?