WICG / web-app-launch

Web App Launch Handler
Other
75 stars 28 forks source link

file thumbnails to be shown in native OS file explorer #37

Closed sigurdle closed 1 year ago

sigurdle commented 3 years ago

Let a webapp create a thumbnail or return metadata for files This would be useful especially for image viewers/editors

Invoke the service worker when the native OS file explorer wants to show thumbnails/metadata of files Something like:

addEventListener("file_metadata", async (evt){
{
parsedfile = parsefile(evt.file)
return parsedfile.metadata;
}}
fallaciousreasoning commented 3 years ago

I suspect this would probably take the form of specifying a url for the image in the handlers entry. The service worker fetch handler would be invoked when the browser loads the image - no need for a new event.

sigurdle commented 3 years ago

I suspect this would probably take the form of specifying a url for the image in the handlers entry. The service worker fetch handler would be invoked when the browser loads the image - no need for a new event.

But the icons property is per file type. When the fetch event arrives to the service worker, it could only return an image for all files of that file type. The point is that the service worker needs to get a handle on a specific file, open that specific file and return thumbnail/metadata.

How this would need to be implemented is that the browser registers itself as a "metadata/thumbnail extractor" to the OS, and when the OS requests metadata for a file, it checks if any PWAs have registered for that file type, and then calls its service worker with a handle to the file that the OS is making a request for.

(I know, a very advanced request, maybe not with many use cases, but it would be cool for image viewers/editors etc. Think thumbnails for Figma files in the OS native file explorer)

fallaciousreasoning commented 3 years ago

Ah sorry, I misunderstood your request 😄 That'd definitely be a neat feature.

alancutter commented 1 year ago

This request is more closely related to file_handlers rather than launch_handler. I recommend filing this in the manifest-incubations repository.