Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Applications > Hack for Linux style copy/paste?

Hack for Linux style copy/paste?
Thread Tools
Simon
Posting Junkie
Join Date: Nov 2000
Location: in front of my Mac
Status: Offline
Reply With Quote
Feb 7, 2007, 09:35 AM
 
Does anybody know of any hack to get Linux style copy/paste behavior* on the Mac? Not just within the X11 environment, but throughout all of OS X. I've been looking for some kind of hack that does that, but couldn't find anything. All I've come up with are the shell command pbcopy and pbpaste. Any ideas?

*) selection = copy, middle-click = paste
     
TETENAL
Addicted to MacNN
Join Date: Aug 2004
Location: FFM
Status: Offline
Reply With Quote
Feb 7, 2007, 10:20 AM
 
How would it know which selection to paste?
     
Simon  (op)
Posting Junkie
Join Date: Nov 2000
Location: in front of my Mac
Status: Offline
Reply With Quote
Feb 7, 2007, 01:17 PM
 
Originally Posted by TETENAL View Post
How would it know which selection to paste?
The last one maybe?
     
sushiism
Grizzled Veteran
Join Date: Jun 2002
Location: UK
Status: Offline
Reply With Quote
Feb 7, 2007, 06:02 PM
 
sorry?
whats different about them?

someone might have tips to recreate it if you describe it
     
El Gato
Dedicated MacNNer
Join Date: Apr 2005
Status: Offline
Reply With Quote
Feb 7, 2007, 06:16 PM
 
Originally Posted by Simon View Post
The last one maybe?
So you select some text to copy.

Then you select some more text that you want to paste over.

How does it know to copy the text that was selected first and not the second selection (which is what you were trying to paste over)?
     
Simon  (op)
Posting Junkie
Join Date: Nov 2000
Location: in front of my Mac
Status: Offline
Reply With Quote
Feb 8, 2007, 01:43 AM
 
Originally Posted by El Gato View Post
How does it know to copy the text that was selected first and not the second selection (which is what you were trying to paste over)?
It doesn't. You can not copy one thing and paste over another selection that way.

But that's entirely not the point. I'm not here to argue if it's better or worse than OS X's copy/paste. All I'm asking for is if anybody knows of an app/hack/whatever that enables that copy/paste behavior on a Mac.
     
Simon  (op)
Posting Junkie
Join Date: Nov 2000
Location: in front of my Mac
Status: Offline
Reply With Quote
Feb 8, 2007, 01:45 AM
 
Originally Posted by sushiism View Post
sorry?
whats different about them?
someone might have tips to recreate it if you describe it
If you read my very first you will see that I describe how Linux style copy/paste works. It's explained at the bottom of the post.
     
wataru
Addicted to MacNN
Join Date: Oct 2001
Location: Yokohama, Japan
Status: Offline
Reply With Quote
Feb 8, 2007, 09:17 AM
 
Originally Posted by El Gato View Post
So you select some text to copy.

Then you select some more text that you want to paste over.

How does it know to copy the text that was selected first and not the second selection (which is what you were trying to paste over)?
Uh, you know you can paste without having selected something to paste over, right?
     
P
Moderator
Join Date: Apr 2000
Location: Gothenburg, Sweden
Status: Offline
Reply With Quote
Feb 8, 2007, 11:32 AM
 
The Mac OS equivalent is to drag and drop text. Combine this with Exposé and Command-Tab to drag to windows that you can't see. It has the advantage of letting you cut as well - in fact, that is the default unless it's a write-protected page, and you have to hold option to copy - and even delete, by dragging to the trash. I know that it's hard to relearn (because you don't remember that you should have dragged until you're in the window you want to paste to) but it isn't any slower and it's more flexible. I'm not aware of any hacks that will implement the X11-style on OS X.

(ObNitpick: That behaviour is much older than Linux, and works on many other operating systems besides. It's more correct to call it X11 cut-n-paste, because that's where it comes from.)
     
besson3c
Clinically Insane
Join Date: Mar 2001
Location: yes
Status: Offline
Reply With Quote
Feb 8, 2007, 11:40 AM
 
It would be nice to have this feature, I'd setup my middle click on my Mighty Mouse to do this.
     
cybergoober
Mac Elite
Join Date: Jun 2003
Location: Newport News, VA USA
Status: Offline
Reply With Quote
Feb 8, 2007, 12:26 PM
 
Originally Posted by wataru View Post
Uh, you know you can paste without having selected something to paste over, right?
I'm sure he was just providing an example in which the proposed copy/paste mechanism wouldn't be ideal.
     
chabig
Addicted to MacNN
Join Date: Jun 1999
Location: Las Vegas, NV, USA
Status: Offline
Reply With Quote
Feb 8, 2007, 12:33 PM
 
Originally Posted by Simon View Post
If you read my very first you will see that I describe how Linux style copy/paste works. It's explained at the bottom of the post.
Sorry. Still not clear. What does "selection=copy" mean?
     
Simon  (op)
Posting Junkie
Join Date: Nov 2000
Location: in front of my Mac
Status: Offline
Reply With Quote
Feb 8, 2007, 12:46 PM
 
Originally Posted by P View Post
(ObNitpick: That behaviour is much older than Linux, and works on many other operating systems besides. It's more correct to call it X11 cut-n-paste, because that's where it comes from.)
True, good point.
     
Simon  (op)
Posting Junkie
Join Date: Nov 2000
Location: in front of my Mac
Status: Offline
Reply With Quote
Feb 8, 2007, 12:52 PM
 
Originally Posted by chabig View Post
Sorry. Still not clear. What does "selection=copy" mean?
I guess I was being to brief.

In X11 whenever you select some characters they are automatically copied to your clipboard. So to 'copy' you just select. A middle click then 'pastes' that selection. You don't need to use the keyboard or menus, it's all done with the mouse. There are many situations where I prefer OS X's cmd-c and cmd-v, but there are occasions where X11 style copy/paste is much faster. It would be nice if there were a hack that would allow you to use X11 style behavior for those occasions.
     
chabig
Addicted to MacNN
Join Date: Jun 1999
Location: Las Vegas, NV, USA
Status: Offline
Reply With Quote
Feb 8, 2007, 01:12 PM
 
Simon,

Thanks for that clarification. I have never experienced that behavior. Automatic copy...interesting. But doesn't that mean that once you've got a desired selection on the clipboard that you can't select anything else in the interim? Isn't that somewhat limiting?
     
P
Moderator
Join Date: Apr 2000
Location: Gothenburg, Sweden
Status: Offline
Reply With Quote
Feb 8, 2007, 01:39 PM
 
The idea behind the middleclick paste is to not have regular copy/paste at all. The way OS X and most X11-based interfaces do cut and paste is to run a pasteboard server application - on OS X, it's called "pbs", you can find it with Activity Monitor. When you hit Cut or Copy, something is sent to the pasteboard. When you hit Paste, whatever is on the pasteboard is fetched. The downside to this is that running this pasteboard server is somewhat expensive, memory and CPU-wise. The middleclick thing avoids this - nothing is ever copied until you hit middleclick, then you copy directly to the receiving app. Technically, it's quite ingenious.

(Classic Mac OS did Copy/Paste in a different way. Without Multifinder, copied information was kept in the application memory space until an application was quit and then kept around in the system heap until a new app was launched. The new app then inherited this old pasteboard. With Multifinder, this little magic had to happen every time you switched applications, except it was copied directly to the other app. A system with protected memory can't work this way.)
     
chabig
Addicted to MacNN
Join Date: Jun 1999
Location: Las Vegas, NV, USA
Status: Offline
Reply With Quote
Feb 8, 2007, 02:24 PM
 
Nobody has yet pointed out Apple's comments:

http://developer.apple.com/technotes...n2165.html#Q18

Chris
     
Simon  (op)
Posting Junkie
Join Date: Nov 2000
Location: in front of my Mac
Status: Offline
Reply With Quote
Feb 8, 2007, 03:44 PM
 
Originally Posted by chabig View Post
But doesn't that mean that once you've got a desired selection on the clipboard that you can't select anything else in the interim? Isn't that somewhat limiting?
Actually it's quite the opposite. As soon as you select something else what you lose what you had in the 'clipboard'. You always paste the last things that was selected. That may sound confusing, but when I'm editing code and need to shuffle stuff around nothing is faster than select and middle-click.

In the meantime I've stopped using the OS X shells (Apple's Terminal.app as well as others). I'm using the ultra-primitive xterm through X11 instead just so I get this copy/paste behavior.
     
TETENAL
Addicted to MacNN
Join Date: Aug 2004
Location: FFM
Status: Offline
Reply With Quote
Feb 8, 2007, 04:22 PM
 
Originally Posted by P View Post
When you hit Cut or Copy, something is sent to the pasteboard. When you hit Paste, whatever is on the pasteboard is fetched. The downside to this is that running this pasteboard server is somewhat expensive, memory and CPU-wise. The middleclick thing avoids this - nothing is ever copied until you hit middleclick, then you copy directly to the receiving app.
Mac applications can "promise" data to the pasteboard and the actual copying is then delayed till something is actually pasted.
Technically, [middle-click pasting is] quite ingenious.
I don't know. If lazy copying is really the reason for this then promises look cleverer to me and without the usability issues.
     
chabig
Addicted to MacNN
Join Date: Jun 1999
Location: Las Vegas, NV, USA
Status: Offline
Reply With Quote
Feb 8, 2007, 04:31 PM
 
Originally Posted by Simon View Post
As soon as you select something else you lose what you had in the 'clipboard'.
That was the point of my question. I think anything that can result in data loss should require user action. I would not try to deny you your choice of operating methods, it seems entirely appropriate that this is not the way most computers work.
     
besson3c
Clinically Insane
Join Date: Mar 2001
Location: yes
Status: Offline
Reply With Quote
Feb 8, 2007, 04:52 PM
 
Originally Posted by Simon View Post
Actually it's quite the opposite. As soon as you select something else what you lose what you had in the 'clipboard'. You always paste the last things that was selected. That may sound confusing, but when I'm editing code and need to shuffle stuff around nothing is faster than select and middle-click.

In the meantime I've stopped using the OS X shells (Apple's Terminal.app as well as others). I'm using the ultra-primitive xterm through X11 instead just so I get this copy/paste behavior.


Simon, the new version of iTerm will allow you to middle click to paste. I use it for all of my Terminal work (which is a lot), it's FAR better than Terminal, even without this feature.

Now that I know this feature exists though, I might try it (it would require disabling the existing middle click function in the Mouse panel though)
     
TETENAL
Addicted to MacNN
Join Date: Aug 2004
Location: FFM
Status: Offline
Reply With Quote
Feb 8, 2007, 05:04 PM
 
Did you guys ever even try Apple's Terminal application? Because I just did, and it does support this middle-click pasting.
( Last edited by TETENAL; Feb 9, 2007 at 12:00 PM. Reason: Fixed grammar (hopefully))
     
Simon  (op)
Posting Junkie
Join Date: Nov 2000
Location: in front of my Mac
Status: Offline
Reply With Quote
Feb 8, 2007, 06:01 PM
 
Originally Posted by TETENAL View Post
Did you guys every even tried Apple's Terminal application? Because I just did, and it does support this middle-click pasting.
Mine doesn't.
     
P
Moderator
Join Date: Apr 2000
Location: Gothenburg, Sweden
Status: Offline
Reply With Quote
Feb 8, 2007, 06:16 PM
 
Originally Posted by TETENAL View Post
Mac applications can "promise" data to the pasteboard and the actual copying is then delayed till something is actually pasted.
Just marking the page copy on write or something fancy with the Notification Center?

Originally Posted by TETENAL View Post
I don't know. If lazy copying is really the reason for this then promises look cleverer to me and without the usability issues.
Middle-click pasting is quicker than Cut-n-Paste. The only thing the Mac has that is as fast is drag-n-drop, and that wasn't developed until much later. And a Notification Center hack? Sure, that's pretty, if you have a Notification Center up and running. Slightly overkill for a pasteboard though, and it still uses more RAM than the other option.
     
TETENAL
Addicted to MacNN
Join Date: Aug 2004
Location: FFM
Status: Offline
Reply With Quote
Feb 8, 2007, 09:54 PM
 
There is no hack involved. See the documentation for Carbon and Cocoa respectively:

Pasteboard Manager Programming Guide: Handling Pasteboard Promises
Pasteboard Programming Topics for Cocoa: Implementing Copy and Paste

Originally Posted by Simon View Post
Mine doesn't.
It does for me. I have a regular 3 button mouse. Maybe you have a Mighty-Mouse and the fancy button assignments make it not work? Did you try to set the nipple to tertiary click?
     
Simon  (op)
Posting Junkie
Join Date: Nov 2000
Location: in front of my Mac
Status: Offline
Reply With Quote
Feb 9, 2007, 04:45 AM
 
Originally Posted by TETENAL View Post
It does for me. I have a regular 3 button mouse. Maybe you have a Mighty-Mouse and the fancy button assignments make it not work? Did you try to set the nipple to tertiary click?
Bingo. I owe you a beer. Thanks man!
     
   
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 01:18 PM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,