LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Blogs > Tim's Bio-Linux tips
User Name
Password

Notices

A blog by Tim Booth of the NEBC. I'll be using this blog to pass on some of my tips for users of the Bio-Linux system (see the first post), and maybe some other useful nuggets that come my way.
Rate this Entry

Aaaaaaaaand - Cut!

Posted 02-18-2009 at 10:03 AM by avarus

A blog entry about the clipboard.

So, the clipboard. Exciting, eh? You probably use it all the time. Cut this, copy that, paste the other. Ideally, you should be able to copy text, images, or anything you like from any application and to drop them into the same
application or any other application. It avoids the need to mess around with saving a temporary file, and sometimes it's the only way to do the job.

The problem is, the clipboard in Linux doesn't always do what you expect. Shouting at the computer doesn't fix the problem (I've tried!) so it might be useful to delve a little deeper and find out what's happening behind the scenes.

The first thing to know is: There are TWO clipboards. One belongs to X-windows, the other belongs to Gnome. (Actually that's not entirely true, but it's close enough) Try this:
  • Open two terminals and run 'nano' in each (nano is the basic text editor).
  • In the first terminal, type two different lines of text.
  • Select the first line with the mouse, then select Edit->Copy from the menu.
  • Select the second line with the mouse, and just leave it highlighted
  • Now in the second window select Edit->Paste, and the first line should be pasted
  • Now click the middle mouse button in that window, and the second line should appear.
(if you only have two mouse buttons, press both at once for a middle-click)
(For added fun, Nano also has an internal clipboard, accessed with Ctrl+K and Ctrl+U, that only works within the single editor session.)

So the X-windows clipboard, traditionally accessed by selecting text to copy it and middle-clicking to paste it, works with any application and only supports plain text. The Gnome clipboard does not work with some older apps but is able to cope with things such as rich text and images. For example, try opening a website in Firefox and selecting some formatted text and images, then select Edit->Copy. If you paste that into OpenOffice you'll see the format and images are preserved. If you paste it into Nano it gets converted to plain text. If you paste into GIMP Image Editor you get an error. Most of the time this works the way you expect, but keeping in mind the way the computer is having to convert your clipboard data can make things less baffling when unexpected things happen.

Three other useful things to do with the clipboard are to retrieve a history of contents, copy between the two clipboards, and force rich content on the clipboard to plain text. A clipboard manager will do this, and there are several - take a look here:

http://www.linux.com/feature/123462

The standard one for Gnome is Glipper. Install the 'glipper' package via Synaptic, then right-click your top panel and 'Add to Panel'. Select 'Clipboard manager' and a little icon should appear. Copy a few things to the clipboard and then left-click the icon to see the list. Selecting any of these will drop it into BOTH clipboard buffers, but converted to plain text in both cases.

I use Glipper and find it indispensible, but it does have some glitches. For instance, copying images between applications can stop working with Glipper in effect. This bug has been around for a while and you can follow the progress here: https://bugs.launchpad.net/ubuntu/+s...er/+bug/104432. Hopefully a fix is on the cards, but right now the only remedy is to
temporarily disable Glipper - not ideal.

That's quite enough clipboard internals, I think. Next time, the Evolution mail program and how to make it do what you want.

TTFN,
TIM
Posted in Uncategorized
Views 2013 Comments 0
« Prev     Main     Next »
Total Comments 0

Comments

 

  



All times are GMT -5. The time now is 02:43 AM.

Main Menu

My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration