FGRibreau / clipboard-watcher

Listen to clipboard change (OSX only)
http://twitter.com/FGRibreau
MIT License
4 stars 1 forks source link

Support for clipboard content other than text? #1

Open zeke opened 9 years ago

zeke commented 9 years ago

I discovered dot-clipboard yesterday and am really excited about it.

It seems like the data object is always a plaintext string, even if the content copied was HTML. In this codebase I see other types like html and png, but I know nothing about AppKit / Objective C so I'm a bit lost. Are those types supported by clipboard-watcher?

  if(type === 'html'){
    return [$.NSHTMLPboardType, 's'];
  }

  if(type === 'png'){
    return [$.NSHTMLPboardType, 'i'];
  }

  if(type === 'text'){
    return [$.NSStringPboardType, 's'];
  }
zeke commented 9 years ago

Looks like dataForType may be the trick, but I don't know what to do with it:

<6e6f6465 20657861 6d706c65 732f7369 6d706c65 2e6a730a>
FGRibreau commented 9 years ago

Hello @zeke,

I discovered dot-clipboard yesterday and am really excited about it.

It's awesome that you like it! :)

Hum I won't be able to help you on this one, the code is inspired by pb, you may find an answer there, if this is a bug don't hesitate to send a PR I will happily merge it!