Reputation: 4045
I would like to monitor whether the user has copied something to the clipboard while using another application and then save what he or she has copied in my nodejs (electron) application. How could I do this?
As an example: The user uses his/her browser and selects a URI and then copies the URL to the clipboard. I then want to copy the selected URL from the browser window and use it in my nodejs application.
I am using nodejs with electron on OSX.
Upvotes: 1
Views: 2539
Reputation: 5436
Electron exposes a (partly experimental) clipboard API that should serve your needs.
Strangely, there seems to be no callback method available to react on new content, you may have to keep polling clipboard.read
and diff its content.
Upvotes: 1