[{"element_type":"text","content":"\n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n        \u003cp\u003eMy main computer is a Mac, but I run third party dev tools on a separate Debian box so they can't mess up my main computer. To control the Debian box from the Mac, I use SSH and VNC over Ethernet. The VNC session runs an Xfce desktop environment.\u003c/p\u003e\n\u003cp\u003eMostly the remote control setup works great, but it's a pain to copy from macOS and paste to apps running in Xfce (macOS Screen Sharing VNC client app doesn't do clipboard sync). For example, suppose I want to copy text from Chrome on the Mac and paste it into VS Code on Debian. Since I can't paste directly into the VNC client, I must go through an SSH shell where pasting works fine.\u003c/p\u003e\n\u003cp\u003eIn the past, I've used SSH to paste into \u003ccode\u003evim\u003c/code\u003e and make a temporary file. But, today I figured out a better way where I can send text directly to the Xfce clipboard from my SSH shell:\u003c/p\u003e\n      \n\n\n\n\n\n\n\n\n\n\n\n","metadata":{}},{"element_type":"code","content":"cat \u003c\u003c'EOF' | DISPLAY=:1 xclip -selection clipboard\nthese are some lines\nof text that I copied from Chrome\nor ${WHEREVER}. \u003c- this should pass through because of the single quotes\nEOF","metadata":{"language":"terminal","linenums":false}},{"element_type":"text","content":"\n  \n  \n  \n  \n  \n  \n  \n  \n        \u003cp\u003eTo make this easier to use, I defined an alias for \u003ccode\u003exclip\u003c/code\u003e in my \u003ccode\u003e.bashrc\u003c/code\u003e file:\u003c/p\u003e\n      \n\n\n\n\n\n\n\n","metadata":{}},{"element_type":"code","content":"alias xclip='DISPLAY=:1 xclip -selection clipboard'","metadata":{"language":"terminal","linenums":false}},{"element_type":"text","content":"\n  \n  \n  \n        \u003cp\u003eWith the alias, I can do:\u003c/p\u003e\n      \n\n\n","metadata":{}},{"element_type":"code","content":"cat \u003c\u003c'EOF' | xclip\nthese are some lines\nof text that I copied from Chrome\nor ${WHEREVER}. \u003c- this should pass through because of the single quotes\nEOF","metadata":{"language":"terminal","linenums":false}},{"element_type":"text","content":"\n  \n  \n  \n  \n  \n  \n  \n  \n  \n        \u003cp\u003eNotes:\u003c/p\u003e\n\u003col\u003e\n\u003cli\u003eIf you don't already have \u003ccode\u003exclip\u003c/code\u003e installed, you'll need to\u0026nbsp;\u003ccode\u003esudo apt install xclip\u003c/code\u003e\n\u003c/li\u003e\n\u003cli\u003eThe \u003ccode\u003ecat \u0026lt;\u0026lt;'EOF'\u003c/code\u003e stuff is using bash's heredoc string syntax. Note that in this case the single quotes around EOF are telling bash not to do its normal variable substitution. This is useful if you want to copy and paste code that includes bash variable syntax, perhaps as part of a Makefile. In this case, \u003ccode\u003e${WHATEVER}\u003c/code\u003e will get passed through to \u003ccode\u003exclip\u003c/code\u003e rather than being evaluated as a variable substitution by bash.\u003c/li\u003e\n\u003cli\u003eI have TigerVNC server configured to set \u003ccode\u003eDISPLAY\u003c/code\u003e to \u003ccode\u003e:1\u003c/code\u003e. Since the instance of bash that's running in my SSH shell is is not part of an X session, it doesn't know about TigerVNC's display. I have to tell \u003ccode\u003exclip\u003c/code\u003e which \u003ccode\u003eDISPLAY\u003c/code\u003e to use, otherwise it\u0026nbsp;would get mad and complain with an error message.\u003c/li\u003e\n\u003c/ol\u003e\n      \n\n\n\n\n\n\n\n\n","metadata":{}}]