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

Control the 'text drag delay' time in Cocoa applications System
I recently wrote a bit for Macworld, discussing the recent tip here on dragging text snippets to the Dock. In that writeup, I provided a brief overview of OS X's two modes of text dragging for those not yet familiar with the differeneces:
  • In Carbon (Firefox, Excel, Word, Photoshop, etc.) and Java applications: Select the text to drag, click-and-hold the mouse button on the selection, and start dragging.
  • In Cocoa applications (anything from Apple, OmniWeb, SubEthaEdit): Select the text to drag, click-and-hold the mouse button on the selection, wait one second, and start dragging.
The delay-before-dragging bit makes many people believe that text drag is broken in Cocoa applications. Well, in the comments to my Macworld article, reader macmanga posted this very handy Terminal command:
defaults write -g NSDragAndDropTextDelay -int 100
This changes the delay-before-dragging for all Cocoa applications (the -g means "global domain," or all applications) from its default of 1000 (milliseconds, or one second) to 100, or one tenth of a second. Any currently-running applications must be quit and restarted to see the effect of the changes, but this definitely works.

Somewhat coincidentally, I was pointed to this thread on the Mac OS X Hints forum site, which contains a link this entry at Mac Geekery. That story, in turn, links to Apple's own Xcode Expert Preferences Notes as the source of the information. Noted in that document is this tidbit:
Setting this default to a non-positive value will disable drag-and-drop editing.
So I tried it, and it's true -- set the value to -100, and you won't be able to drag and drop text in any Cocoa application. Note also that you do not have to do this on a global basis. Instead, you could do something like this:
defaults write com.apple.TextEdit NSDragAndDropTextDelay -int -100
That would disable text dragging in TextEdit. Or if you want to leave it enabled in a certain application, but just want to make it much harder to do, try setting a large positive value:
defaults write com.apple.iPhoto NSDragAndDropTextDelay -int 3000
With that setting in place, you'd have to hold the mouse button for three seconds on any text in iPhoto before it was capable of being dragged.
    •    
  • Currently 3.67 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (3 votes cast)
 
[19,668 views]  

Control the 'text drag delay' time in Cocoa applications | 13 comments | Create New Account
Click here to return to the 'Control the 'text drag delay' time in Cocoa applications' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Control the 'text drag delay' time in Cocoa applications
Authored by: wgscott on Nov 22, '05 06:38:02AM

I absolutely despise text dragging. If this lets me turn it off, I will be forever grateful. In iTerm it is absolutely driving me nuts.



[ Reply to This | # ]
Control the 'text drag delay' time in Cocoa applications
Authored by: Githon on Nov 24, '05 03:23:50AM

I don't know if that specific line lets you turn it off, but you could always increase the delay to say, 47 years, which would do just as well.



[ Reply to This | # ]
Control the 'text drag delay' time in Cocoa applications
Authored by: meikokun on Nov 22, '05 08:17:17AM

niiiiiiiiice!
Cheers muchly



[ Reply to This | # ]
Control the 'text drag delay' time in Cocoa applications
Authored by: r0n on Nov 22, '05 08:57:02AM

Thanks a lot for this one. That 'text drag delay' was driving me nuts for ages...



[ Reply to This | # ]
Control the 'text drag delay' time in Cocoa applications
Authored by: Mike A on Nov 22, '05 10:19:18AM

I feel a little unusual in that I find the delay as it is to be too short.

As I am on a laptop, I find that having selected some text, it can take me a little while to start re-selecting a different bit of text. This means I often end up dragging the text when I didn't want to.



[ Reply to This | # ]
Control the 'text drag delay' time in Cocoa applications
Authored by: gospodin_david on Nov 22, '05 11:30:37AM

Just thought that I'd clarify the problem. It's not that you'd normally have to click-and-hold and then wait 1 second (or so); rather it's that you have to select and wait 1 second until you can drag. It doesn't matter whether you're holding the mouse button while you're waiting, only that you do so after selecting.



[ Reply to This | # ]
Control the 'text drag delay' time in Cocoa applications
Authored by: gospodin_david on Nov 22, '05 11:33:53AM

I take that back.



[ Reply to This | # ]
Control the 'text drag delay' time in Cocoa applications
Authored by: magnamous on Nov 22, '05 10:47:30PM

Thank you!!! This has always driven me nuts in Safari, and I could never figure out why text-dragging in Safari always stunk. Now it's crisp and speedy! :)



[ Reply to This | # ]
Control the 'text drag delay' time in Cocoa applications
Authored by: romzburg on Nov 23, '05 06:06:21AM

THANK YOU THANK YOU!!!!!!!

Ages ago I actually reported this as a bug to Apple!

Right after I switched to OS X, I couldn't grab some text from Safari to drop as a clipping on my desktop, and it took a VERY long time until I discovered by accident that if I delayed the drag it would work.

It has been a pain in the butt for SO long!

I AM FREE!

---
I'm always right and I never lie.



[ Reply to This | # ]
Control the 'text drag delay' time in Cocoa applications
Authored by: MJCube on Nov 23, '05 06:29:15AM

Best UI hint ever!! I'm gonna quit and relaunch everything right now to take advantage of it. I am Thankful for the little things!



[ Reply to This | # ]
Control the 'text drag delay' time in Cocoa applications
Authored by: thinkyhead on Nov 23, '05 05:03:50PM

Thank you! I remember when I first noticed this behavior in ProjectBuilder in 10.0 or 10.1 and I thought Apple would fix this behavior in a future system version. I was very disappointed when they standardized on it for all Cocoa applications. It seemed like an unnecessary hold-over from NeXT.

*Now* what I'd like to see is that when you click on selected text, the cursor changes from a BAR to an ARROW or an OPEN HAND as the text drag becomes available, and then changes to an ARROW WITH CLIP or a CLOSED HAND when the user starts dragging.

With all the other feedback mechanisms in Mac OS X - like Poofs and the Genie Effect, this would be a very nice interface behavior. And I wouldn't mind a subtle *click* sound as text becomes draggable either.

This sounds like a job for Unsanity!


---
|
| slur was here
|



[ Reply to This | # ]
Control the 'text drag delay' time in Cocoa applications
Authored by: asmeurer on Nov 24, '05 09:30:16PM

Well, actually, several things from Apple, such as Finder and iTunes and just about anything from the OS 9 days is Carbon. Not that dragging text from Finder icons when you are editing their names works anyway. This is a real pain for me sometimes.



[ Reply to This | # ]
AppleScript solution
Authored by: robg on Dec 01, '05 06:00:30AM
This was sent as an anonymous submission, so I'm publishing it as a comment here...

=====

For those who don't like or don't want to use terminal, here is an applescript that will let you adjust Cocoa drag delay times:

set dragWaitTime to (text returned of (display dialog "What delay time, in miliseconds, do you want for text dragging?" default answer "1000"))
set dragWaitCommand to "defaults write -g NSDragAndDropTextDelay -int " & dragWaitTime
do shell script dragWaitCommand

=====

I haven't tested the script...

-rob.

[ Reply to This | # ]