Friday, May 31, 2013

File icon extensions (emblems) like of Dropbox

I have been wondering how Dropbox could put a icon on the file indicating it's synchronizing or synchronized. I digged its code and the files of gnome itself and found the way for that.

You can find some examples for these icons in /usr/share/icons/gnome/scalable/emblems/ which belongs to Gnome.

If you want to have a custom icon, then you can put your files in /usr/share/pixmaps

An example filename: emblem-my-synced-symbolic.svg

I had the impression that the file name should start with emblem but I'm not really sure.

After having your file in /usr/share/pixmaps, you can activate this icon for a file:

gvfs-set-attribute -t stringv /home/emre/sample.txt metadata::emblems 'my-synced-symbolic'

Now your file has the svg icon on it.

No comments: