Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

One way to cut and paste between X11 and Aqua UNIX
Quite often when reading macosxhints, I read a hint that involves a terminal command, usually a defaults write hidden preferences trick. The easiest way to enter these commands is to copy them from Safari, and paste them on to the command line in Terminal. The problem is that most of the time I'm using xterm running under X11, and it doesn't support cut and paste with Aqua.

One can get around this problem by entering the following at the shell prompt.
pbpaste | sh
That's it. pbpaste is a shell command that writes the contents of the clipboard to standard output; piping it into the shell causes the shell to execute the command that was on the clipboard. pbcopy works in the other direction -- text sent to the standard input of pbcopy ends up on the clipboard. For example:
echo "Hello Aqua" | pbcopy
puts Hello Aqua on the clipboard.

[robg adds: We've discussed pcbopy and pbpaste before, but never in the context of using them to get the clipboard in X11.]
    •    
  • Currently 1.89 / 5
  You rated: 5 / 5 (9 votes cast)
 
[14,472 views]  

One way to cut and paste between X11 and Aqua | 8 comments | Create New Account
Click here to return to the 'One way to cut and paste between X11 and Aqua' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
One way to cut and paste between X11 and Aqua
Authored by: ashill on Jan 29, '09 08:28:58AM

Why use an xterm these days? In 10.5, Apple's Terminal (and other Aqua Terminal programs, I believe) launch X11 when needed to run X programs. Why not just use an Aqua-based terminal program exclusively, since it interacts with the rest of the OS much better, including copy and paste?



[ Reply to This | # ]
One way to cut and paste between X11 and Aqua
Authored by: squawky on Jan 29, '09 09:02:53AM

AFAIK, even though you can run xterm apps from Terminal, any GUI interfaces the app launches are still in xterm - being able to copy text to the clipboard means you can paste into those GUIs (or pull text from the GUI clipboard into Terminal).

(I'm not able to try this at the moment, unfortunately, to confirm - but I'm bookmarking this hint to try later, as it sounds quite useful.)



[ Reply to This | # ]
One way to cut and paste between X11 and Aqua
Authored by: nschum on Jan 29, '09 11:21:59PM

That actually worked in 10.4, too. You only had to set the DISPLAY environment variable.



[ Reply to This | # ]
One way to cut and paste between X11 and Aqua
Authored by: CJYetman on Jan 29, '09 09:30:57AM
Have you tried the latest and greatest XQuartz?

http://xquartz.macosforge.org/trac/wiki

from what I understand, they have copy-paste working.

[ Reply to This | # ]
One way to cut and paste between X11 and Aqua
Authored by: jakshin on Jan 29, '09 09:50:50AM

X11.app does do some synchronization between the main system clipboard and the X11 clipboard (which is why the mentioned pbcopy & pbpaste commands work), so you can also just use middle-click to paste.

So just copy the command you'd like to use from this site, switch to your xterm window, and middle-click.. et voilĂ : the command will appear at the cursor, waiting for you to tap enter to execute it.

I'm not sure how many X11-based programs this works in, but in xterm at least, you can also use Cmd-C to copy text that's displayed in the xterm window into the main system clipboard; just select it with the mouse (now it's in the X clipboard), then tap Cmd-C (now it's in the system clipboard, too).

(10.5.6 using the stock X11)



[ Reply to This | # ]
One way to cut and paste between X11 and Aqua
Authored by: Nem on Jan 29, '09 10:54:45AM
Uhmm... I do this all the time. Use the middle mouse button (Option-Click) to paste into an Xterm - works perfectly - no need for running any apps or keystrokes (other than the original CMD-C in the Aqua app.)

Copying from an Xterm requires a CMD-C, but pasting does not.

---
Nem W. Schlecht
http://geekmuse.net/

[ Reply to This | # ]

One way to cut and paste between X11 and Aqua
Authored by: squawky on Jan 31, '09 01:28:19PM

This requires that xterm have the "enable three button mouse' option set, yes?

I can't recall if that's set by default or not - been too long since I installed xterm. If it's not, it's located in the xterm preferences anyway.



[ Reply to This | # ]
One way to cut and paste between X11 and Aqua
Authored by: neocodesoftware on Aug 31, '13 03:03:39PM

to make ⌘+V work normally use this one command:

echo "*VT100.translations: #override Meta <KeyPress> V: insert-selection(PRIMARY, CUT_BUFFER0) \n" > ~/.Xdefaults

---
Neo Code Software, Design - Develop - Deploy mission critical web apps for SMEs to Fortune 500s, http://www.neocodesoftware.com

FileMaker, AppleScript, PHP /



[ Reply to This | # ]