cocoa - Can I receive a callback whenever an NSPasteboard is written to? -


i've read apple's pasteboard programming guide, doesn't answer particular question have.

i'm trying write cocoa application (for os x, not ios) keep track of written general pasteboard (so, whenever application copies , pastes, not, say, drags-and-drops, makes use of nspasteboard). (almost) accomplish polling general pasteboard on background thread constantly, , checking changecount. of course, doing make me feel dirty on inside.

my question is, there way ask pasteboard server notify me through sort of callback time change made general pasteboard? couldn't find in nspasteboard class reference, i'm hoping lurks somewhere else.

another way imagine accomplishing if there way swap out general pasteboard implementation subclass of nspasteboard define myself issue callback. maybe possible?

i prefer if possible public, app store-legal apis, if using private api necessary, i'll take too.

thanks!

unfortunately available method polling (booo!). there no notifications , there's nothing observe changed pasteboard contents. check out apple's clipboardviewer sample code see how deal inspecting clipboard. add (hopefully not overzealous) timer keep checking differences , you've got basic (if clunky) solution should app-store-friendly.

file enhancement request @ bugreporter.apple.com request notifications or other callback. unfortunately wouldn't until next major os release @ earliest it's polling until ask them give better.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -