Grab thumbnail from viewport for materials

For objects we can update the thumbnail of the asset in the library from the viewport, it would be great to do the same with materials.