Slashdot Mirror


Dealing with the Unix Copy and Paste Paradigm?

MolecularBear asks: "I grew up on Windows machines, using the ol' ctrl-c to copy and ctrl-v to paste. For the past few years I've been a hardcore Linux user, running it almost exclusively at home and at work. As I am sure you are all aware, highlighting text in Linux automatically performs a copy while the middle mouse button performs a paste. The Ctrl-c, Ctrl-v standard works in many applications, but not all. Lately I have begun to find the automatic highlight-copy to be annoying. As in, I'll highlight text to copy it, then realize I want to highlight a block of text for the purpose of deleting it. Of course, the second highlighting overwrites the first highlighting. I am curious about how other people accomplish their copy/paste needs. Any special setups, applications, or words of wisdom?"

35 of 1,125 comments (clear)

  1. Pasting urls by grahamsz · · Score: 5, Informative

    I usually find you can just pick up the url by selecting it, then middle button drop it into the browser. That seems to work on konq, netscape, mozilla and firefox on both linux and solaris.

    But i do feel your pain :)

    Firefox and Konqueror should have a button for "Open the clipboard in a new tab".

    1. Re:Pasting urls by divirg · · Score: 3, Informative

      There's a plugin for Firefox that puts a button next to the URL field to clear it when you're about to paste. Don't remember what it's called - check the Firefox plugins page on mozilla.org.

      Doesn't help the general problem though...

    2. Re:Pasting urls by Martin+Blank · · Score: 5, Informative

      Firefox and Konqueror should have a button for "Open the clipboard in a new tab".

      Agreed. While not a perfect solution, Clipboard Observer may be a possible way of dealing with this. It can get really intrusive, though, because it can end up opening tabs when you're copying a link to paste somewhere else, like in e-mail or IM. Worth a try, though.

      On an unrelated note, the same author also has Tabbrowser Extensions, basically some really, really, REALLY useful alterations to how Mozilla and Firefox handle tabs. With it, you can do things that should (IMHO) be in the codebase, like re-ordering tabs, moving tabs in groups, moving tabs between windows, opening duplicate tabs (complete with the tab's page history), and (my favorite) undoing the closing of a tab. I've been saved on a number of occasions by this last feature. Very handy. The author should be getting more recognition.

      --
      You can never go home again... but I guess you can shop there.
    3. Re:Pasting urls by connsmythe96 · · Score: 4, Informative

      Firefox and Konqueror should have a button for "Open the clipboard in a new tab".

      Try middle-clicking in the main view area of mozilla/firefox with a URL in the clipboard... ;)

      --
      if(!cool) exit(-1);
    4. Re:Pasting urls by taniwha · · Score: 4, Informative

      Konq at least attempts to solve this by having a delete button next to the URL - clicking that black thing with an X on it while 'holding' text from a hilite clears the URL so you can drop a new one in there

    5. Re:Pasting urls by divirg · · Score: 5, Informative

      No, I'm thinking of Diggler.

      "Diggler is a small but powerful add-on for Mozilla, Netscape and Firefox. It adds a button next to the location bar which can clear the location bar..."

      Similar, but without the keystrokes.

    6. Re:Pasting urls by GMC-jimmy · · Score: 3, Informative

      X Windows, like bash, has it's own way of copy/paste (ie: highlight/middle-click) and KDE/GNOME have their own way of copy/paste (ie: ctrl+c/ctrl+v). What that means is while you're running X with a popular desktop suite like KDE or GNOME, you have more than one clipboard. As you propbably wouldn't use multiple text editors to simultaneously edit the same file, you shouldn't try to use multiple clipboard copy&paste functions for the same task.

      --
      __________________________________
      Free your mind - Flush your toilet
    7. Re:Pasting urls by ronlusk · · Score: 4, Informative
      I've created a script for working with KDE's klipper clipboard tool.
      # point at the browser
      $FIREFOX=/opt/mozilla/firefox/firefox
      ($FIREFOX -remote "ping()" && \
      $FIREFOX -remote "openUrl($1,new-tab)") || \
      $FIREFOX $1 &
      I'm not sure I have everything the best it can be. But when I select a URL somewhere, klipper pops up a menu offering to open it in Konqueror, Mozilla, or Firefox (among other things). I have configured klipper so pressing "F" is a shortcut for opening in Firefox, where it opens it in a new tab.
    8. Re:Pasting urls by AntiOrganic · · Score: 3, Informative
      On an unrelated note, the same author also has Tabbrowser Extensions [sakura.ne.jp], basically some really, really, REALLY useful alterations to how Mozilla and Firefox handle tabs. With it, you can do things that should (IMHO) be in the codebase, like re-ordering tabs, moving tabs in groups, moving tabs between windows, opening duplicate tabs (complete with the tab's page history), and (my favorite) undoing the closing of a tab. I've been saved on a number of occasions by this last feature. Very handy. The author should be getting more recognition.


      Unfortunately, it's so bug-ridden and terrible that Firefox developers won't accept bug reports from people who have it installed.
    9. Re:Pasting urls by lerouxt · · Score: 5, Informative

      In KDE you can configure Klipper to either "Synchronize contents of the clipboard and the selection" or "Separate clipboard and selection".

      Your choice.

    10. Re:Pasting urls by Anonymous Coward · · Score: 5, Informative

      Option "AllowMouseOpenFail" "true" in your XF86Config. This is on by default on all linux distributions I've used recently, actually, so I'd be interested to know what distro you were using so it can be corrected.

    11. Re:Pasting urls by phoenix.bam! · · Score: 4, Informative

      You don't need mouse gestures, all you need to do is highlight a URL, and paste it into the MAIN WINDOW of the FireFox browser, NOT THE URL BAR, and it will load that website.

    12. Re:Pasting urls by Fancia · · Score: 3, Informative

      But it also offers a "Light" mode with only the more commonly-used features turned on, which makes it much faster and less buggy.

      --

      Bít, zabít, jen proto, ze su liska!
  2. Minor solution - Ctrl-K by jmdjmd · · Score: 5, Informative

    Just a small shortcut - Ctrl-K will (should!) erase the rest of the line, no need for highlighting it. Works wonders for clearing the URL bar :-).

    1. Re:Minor solution - Ctrl-K by Xzzy · · Score: 3, Informative

      control-u blasts all of it. I know I've seen this convention somewhere I just can't place it. ;)

      Many of the bash control sequences do the same thing in web browsers. In most text editing situations, really.

  3. Re:Common problem.. by GigsVT · · Score: 5, Informative

    Whats more interesting is that sometimes what control+v pastes is different from what the middle-click pastes.

    Yeah, there's basically two clipboards. The one when you just highlight something, and the one where you click "copy" in the menu.

    The confusion comes when bugs in some programs confuse the two (or only implement one of them .. cough xchat cough). It's extremely hard to convince egotistical programmers that their clipboard behaviour is actually wrong and confusing to users.

    --
    I've had enough abrasive sigs. Kittens are cute and fuzzy.
  4. Oh boy by John+Starks · · Score: 3, Informative

    Soon Slashdot will be filled with the waring camps of "X is perfection" and "X is old, so it is bad."

    In this case, I find that it's merely a matter of getting used to the way the X clipboard functions. For example, delete the old text AFTER you paste the new text. It's a different way of managing your clipboard, but it's not necessary any better; for most jobs, I find it to be MORE convenient, and I start to forget to Ctrl-C when I'm in Windows.

    For more information on how X handles the clipboard/selection, see Jamie Zawinski's informative web page.

  5. -1 Redundant by stratjakt · · Score: 5, Informative

    It's always been broken.

    And any mention of a possible solution brings down the wrath of nerds who want to keep unix as unintuitive and awkward as possible.

    Besides the nuisance of what mouse click or keystroke you use to move text, it's not a clipboard like Windows uses, merely a text buffer.

    Ie; it's only good for text. You cant copy/paste (and by extension drag and drop) files, bitmaps, etc uniformly between apps.

    It's just another item in a laundry list of issues that are major to end users, but a low priority for hackers. Another speedbump on the road to Linux (unix) as a truly competitive desktop platform.

    --
    I don't need no instructions to know how to rock!!!!
  6. KDE klipper... by rsidd · · Score: 4, Informative
    has a menu of recently selected highlighted items. There should be a dock in the "system tray" panel item, looks like a clipboard with the "k" letter. Clicking on it has a history of recently copied (ie highlighted-with-mouse) items, you can select what you like to bring it to the top, then middle-button will paste that next time.

    Or else, first paste what you want to insert, then delete what you want to remove...

  7. Re:Common problem.. by nachoman · · Score: 3, Informative

    The difference between the select/middle-click paste and the Control-C/Control-V paste is because they each use different Clipboards. For instance if you are using KDE, The Control-C will copy to the KDE clipboard and the select with mouse will copy to the X-Windows clipboard.

    I think the reason for the two different Clipboards is because the KDE (Or gnome? Not sure if it works the same way) clipboard handles copying content other than plain text and the X-Windows one not.

  8. Re:Your proiblem... by Psiren · · Score: 3, Informative

    You can just click the middle button anywhere on the page. It'll do a paste of the buffer and load the url in it. You don't have to paste it into the url bar. Once you've done it a few times it makes life a lot easier. It's a far larger target to paste into. Just be careful not to click when you're hovering over a link.

  9. Re:What middle button? by roca · · Score: 4, Informative

    Only if your application sucks. freedesktop.org spells out how this should work; ctrl-c/ctrl-v manage the CLIPBOARD selection, and mouse selection manages the PRIMARY selection. Selecting text with the mouse should NOT interfere with ctrl-c ctrl-v operations in ANY way.

    http://freedesktop.org/Standards/clipboards-spec /c lipboards.txt

  10. X copy/paste by Too+Much+Noise · · Score: 5, Informative
    Actually, there are 3 selections in X. How's that for confusing?

    The current consensus on freedesktop.org is something along the lines of:

    1. The primary selection is to be used for middle-click pasting.
    2. The secondary selection is unused now
    3. the clipboard selection is to be used for Windows-style copy/paste.


    The problem is that some apps use only the primary selection for all copy/paste operations, so it can get confusing.

    For more info, look here
  11. I don't know what software you all are using... by sab39 · · Score: 4, Informative

    In every program I use in Linux (specifically, Mozilla, rdesktop, and various GNOME stuff) Ctrl-C/Ctrl-V work perfectly, and so does the select/middleclick system, and neither interferes with each other.

    I haven't used KDE in a long time but I understand that they introduced the same behavior with Qt3/KDE3.

    Unless you're using really ancient software, pretty much everything will work in *either* mode, or you can do what I do and use a combination of both (choosing whether to bother pressing Ctrl-C to copy depending on whether you're going to need to highlight something at the destination).

    I'm really curious to understand how so many people manage to still have a problem with this. Are you perhaps expecting that since "everybody knows that select copies on Linux", Ctrl-V will paste the thing that you last selected, instead of the last thing you Ctrl-C'd, and not testing it to verify this? Or just assuming that selecting something will overwrite your Ctrl-C buffer? I'd like to believe that people would actually test these things before posting Ask Slashdots about it, but you have to wonder...

  12. Re:Common problem.. by forevermore · · Score: 4, Informative

    Don't forget that shift-insert is almost always used to paste the X clipboard (as opposed to the ctrl-c/ctrl-v one managed by the desktop environment). But then some programs (gecko browsers being the most annoying for me) go and alias this to the functionality of ctrl-v, so I have no keyboard equivalent for middle-click paste.

    --
    Do you really need reason for beer? Wingman Brewers
  13. Re:Common problem.. by RossyB · · Score: 4, Informative

    Urr, all wrong.

    Control-C/V will copy/paste the CLIPBOARD selection. Highlight/middle click will copy/paste the PRIMARY selection. No real applications use the SECONDAY selection, but it still exists.

    There is no difference between any of these clipboards, GNOME and KDE don't have their own clipboards (though KDE does have a daemon to collect copied data so that it persists after the application closes), and all X clipboards can handle any content type: it's the applications which don't support it.

    http://freedesktop.org/Standards/ClipboardsWiki is an excellent summary of the X clipboard.

  14. the "universal standard" by XO · · Score: 5, Informative

    Is supposed to be the original Windows copy/cut/paste buttons:

    Copy: Ctrl-Insert
    Paste: Shift-Insert
    (I can't remember what Cut is, I never use it.. probably ctrl-delete)

    Then, sometime in the Win95 or Win98 era, Microsoft changed it to the less-intuitive and less-standard Ctrl-C, Ctrl-V.

    And Microsoft was a member of the body of people/organizations that made Ctrl-Insert and Shift-Insert the standard.. then went and trashed it...

    This is the CUA92 user interface universal standard, by the way.. and i'm a bit busy right now to do a google search for it, but I'm sure anyone interested could find it..

    --
    "Champagne for my real friends - and real pain for my sham friends!" http://ericblade.postalboard.com/
    1. Re:the "universal standard" by LenE · · Score: 4, Informative

      Unfortunately, Ctrl-Insert and Sift-Insert were never the standard method in Windows, because Microsoft never really standardized anything. These were WordPerfect methods.

      The first standardization, well before 1992, was the Macintosh Human Interface Guidelines published in Inside Macintosh around 1983-84. This is the origin of the Ctrl-C and Ctrl-V.

      Apple did lots of usability studies for the Mac, and the fruits of this labor were the one-button mouse and the Command-z,x,c & v, as well as other standardized "Command Key Shortcuts."

      This cluster of keys were selected because of their proximity to the Command key, and the ease of pressing them with the left thumb and index finger. Z, X, C, and V corresponded to Undo, Cut, Copy, and Paste, the most common operations that were required in a GUI-based work system. Others combinations were standardized for closing windows (Cmd-w), Saving (Cmd-s), Printing (Cmd-p), and Quitting programs (Cmd-q). All Mac programs had to include these functions and use these standardized shortcuts if applicable.

      Sun used these same Command Key Shortcuts in OpenLook, and eventually Microsoft embraced and corrupted these combinations by replacing the Command key with the Control Key, which required using the left pinky finger instead of the thumb to press. The Alt key which is positioned in the same place as the Command key was already claimed in Windows for their pseudo-standard of activating menus based on the underlined letter. The Command Key Shortcuts outside of this cluster were partially implemented for printing and saving, but quitting programs or closing windows is still the archaic and unintuitive Alt-F4 on Windows.

      -- Len

  15. Re:Common problem.. by irix · · Score: 5, Informative

    Yeah, there's basically two clipboards.

    Yup. The best explanation I know of how this works from someone who would know :)

    --

    Do you even know anything about perl? -- AC Replying to Tom Christiansen post.
  16. Yes, there *IS* a common clipboard standard! by smcv · · Score: 4, Informative

    Yes, there is a common clipboard mechanism. Once you understand that there are two separate clipboards (and that this is a feature), everything makes sense.

    Here's how it behaves in modern X environments like KDE 3, GNOME, XFCE, etc.:

    - There is a clipboard (called CLIPBOARD in the specs), which you interact with by explicit copy and paste commands, for which the key bindings are conventionally Ctrl+C, Ctrl+V, Ctrl+X to copy, paste and cut respectively. Use it whenever you would use the Windows or Mac OS clipboard, teach it to new users, and so on.

    - As an extra "easter egg", applications can manipulate the selection (the currently highlighted text) using the same API. The convention is to select text by dragging (or Shift+cursor keys, etc.) and to copy the selection from another program by pressing the middle mouse button. I will reassert: this is an "easter egg" for advanced users. The specs call this the "primary selection", PRIMARY (there is also a SECONDARY, but I am not aware of any program that uses it).

    As documented here:
    http://www.jwz.org/doc/x-cut-and-paste.html
    http://pdx.freedesktop.org/Standards/clipboards- sp ec/clipboards.txt

    OK, now the holes in that logical explanation:

    - KDE 2 used to use Ctrl+C, Ctrl+V to manipulate PRIMARY. This was wrong and had all the flaws the poster cites. Solution: Upgrade to KDE 3, problem solved.

    - Some other broken apps do the same. Solution: either fix them as you suggest, or stop using them. GNU Emacs 20 was apparently broken in the same way as KDE 2, while XEmacs and GNU Emacs 21 apparently work in the same way as KDE 3 (I can't confirm this, I use vim myself).

    - Some (usually older) apps (like xterm) don't have copy or paste commands at all, but do have the selection/middle-click behaviour. Solution: either use something else (e.g. Konsole if you're a KDE fan) or learn the middle-click behaviour too. Since the command line is generally considered to be "hard", it shouldn't be that much of an intellectual leap.

    - Ctrl+C already means something very common and specific (send a SIGINT) in console windows, so the standard Windows-style keybindings cannot be used in console windows. This is a historical clash between the Unix/DOS "Ctrl+C interrupts" and the Windows/OS2 "Ctrl+C copies" (on the Mac the convention is actually Command-C, so Ctrl is still available, and OS X's Terminal uses it as you'd expect) - Windows' MS-DOS-derived command prompt has the same conflict and a similar solution.

  17. Excellent article on the subject by toomim · · Score: 5, Informative
    You should read this article: http://www.jwz.org/doc/x-cut-and-paste.html.

    In a nutshell, there are TWO completely different clipboards implemented in X:

    1. The "select->middle click" clipboard
    2. And the "copy->paste" clipboard

    These two clipboards do not affect or interact with each other.

    Other OS's (like Windows) only have the second kind. Modern Unix applications (like anything based on GTK, QT, or Mozilla) support both clipboards simultaneously and independently.

    Old X Windows applications like XTerm only support the first kind. This is why you can't copy from or paste into an XTerm using C-c and C-v.

    So if you are using modern applications, you should always be able to use C-c and C-v. If you have to copy or paste something into an XTerm, you will have to select it and middle-click. The solution is to use a moderm terminal, like gnome-terminal, instead of XTerm.

    If you read the article, you'll learn that there are actually three different clipboards in X (one of which is never used), and that Emacs and XEmacs then implement yet another fourth clipboard!

    Also see the freedesktop.org reference.

  18. Re:Common problem.. by DeadInSpace · · Score: 3, Informative
    I think the reason for the two different Clipboards is because the KDE (Or gnome? Not sure if it works the same way) clipboard handles copying content other than plain text and the X-Windows one not.
    Wrong. X' selections mechanism (which is a general data sharing mechanism that's also used for copy/paste) supports any kind of data, not just text. It's the widgetsets and/or applications that don't understand anything other than text. Luckily, this is improving as GTK and QT are working on this.

    From the ICCCM, section 2.6.2 (referring to data transferred through selections):
    The atom that a requestor supplies as the target of a ConvertSelection request determines the form of the data supplied. The set of such atoms is extensible, but a generally accepted base set of target atoms is needed. As a starting point for this, the following table contains those that have been suggested so far.
    From a document explaining X selections:
    One of the really cool, yet rarely used, features of the selection mechanism is that it can negotiate what data formats to use. It's not just about text. When one application asks another for the selection, part of their communication involves the requester asking the owner for the list of types in which they are capable of delivering the selection data; then the requester picks the format they like best, and asks for it that way.
    By the way, "X-Windows" doesn't exist, it's the "X Window System", or "X" for short.
  19. Re:Pasting urls - use Ctrl-L in Mozilla by Peter+McC · · Score: 5, Informative

    In Mozilla and Firebird at least there is the very useful, but little-known shortcut Ctrl-L. This highlights the url bar but does *not* copy it to the clipboard. So when I'm in that situation I do Ctrl-L, delete, middle click.

    Of course, the middle-click on the page body works too, as long as you don't have to edit the URL. Ctrl-L is still super-handy if you want to type in an URL by hand or something.

    --
    You know what I hate? Wait, what do you like? I hate that!
  20. klipper and ctrl-alt-v to save you from cb hell by neves · · Score: 3, Informative
    If you use kde, it comes with a nice task bar applet called klipper. It remembers the last copied texts. All you have to do is a ctrl-alt-v and it will list your last selections, choose the one you want to past, and midle-click where you want to past it.

    If you use mozilla/firefox, another nice tip is to use the plug-in diggler, it adds a cancel button beside the browser url location field. You can then just press it to clean the field, instead of selecting and pressing del, this way the selection won't go to the clipboard.

  21. in emacs... by davids-world.com · · Score: 3, Informative

    I have solved the problem in Emacs with a customization package: it defines Apple-C and Apple-V, because I found it too annoying on my Mac. It also doesn't put marked text automatically into the clipboard (or whatever the emacs folks call it: kill-ring). you can get a package here.