sprig / org-capture-extension

A Chrome and firefox extension facilitating org-capture in emacs
MIT License
534 stars 56 forks source link

Capture tab screenshot #53

Open eigengrau opened 5 years ago

eigengrau commented 5 years ago

It would be useful if a small screenshot of the captured tab could be provided to org-mode. I’ve noticed that Firefox appears to store a screenshot when adding a bookmark as of late (though screenshots are currently only shown in the »new bookmark« popup). I’m not quite sure where they are stored (they don’t seem to be referenced in the places.sqlite database). Perhaps the screenshots could be repurposed if they are accessible somewhere.

Since screenshots will be too large to transmit as a URL parameter, perhaps they could be stored to a temporary location (if the web extensions API permits that) and that location could be encoded inside the capture URL.

sprig commented 5 years ago

Sounds like a great idea! Looks like this should definitely be possible; https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/tabs/captureVisibleTab but I'm not entirely sure how simple it would be to implement, in practice, since AFAIK extensions need special permissions to write to disk, even to temporary locations.

One possibility for a workaround would be to send the screenshots to some server, and then download those in emacs. I'm not sure users would appreciate the extra connectivity to an external server, however.

A second possibility is to nevertheless encode the screenshot (if it is small enough) in base64 or similar, and decode in emacs.

None of the options sound particularly great to me, but perhaps if you elaborate on your use case and/or provide a proof of concept, it would be easier to implement.