Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding a badge to an icon in Python on Windows/OSX/Linux

I'm trying to figure out how to add and modify badge icons to individual files on the filesystem much like how Dropbox adds the sync icon to files. I want to do this across platforms and am looking to see what language would be best. Right now I think python is the candidate, but I'm open for other languages that this problem might already be solved in.

like image 796
Axiverse Avatar asked Aug 15 '12 22:08

Axiverse


1 Answers

I doubt there's a platform-agnostic library in any language to achieve your goal. I

For GNOME (and probably XFCE) the badge icons are called emblems and are manipulated via gvfs metadata. Here's how you can change the emblem via command line (taken from here):

$ gvfs-set-attribute $FOLDER -t stringv metadata::emblems new urgent

I'm pretty sure if you dig into the source of gvfs-set-attribute you'd figure out the API.

For KDE 4.x you can use kwriteconfig (taken from here):

$ kwriteconfig --file "$FOLDER/.directory" --group 'Desktop Entry' --key Icon /path/to/icon.png

On Windows you are supposed to implement an IShellIconOverlayIdentifier COM interface.

For MAC... I don't know. According to this there's no official API to do that at least for Mac OS X 10.6.

like image 50
Ihor Kaharlichenko Avatar answered Oct 21 '22 04:10

Ihor Kaharlichenko