Python-nautilus: add custom emblems (overlap icon)

I am using python-nautilus module and I am trying to add a custom emblem (icon overlay) like: enter image description here

But I haven't found anything about it.

I can add an existing "media" logo with this code:

import os.path
from gi.repository import Nautilus, GObject

class OnituIconOverlayExtension(GObject.GObject, Nautilus.InfoProvider):
    def __init__(self):
        pass

    def update_file_info(self, file):
        if os.path.splitext(file.get_name())[1] == "fileWithEmblem":
            file.add_emblem("multimedia")

      

But I would like to add my own icon.

file.add_emblem("my_super_icon.ico")

      

Do you have an idea? How can i do this?

Thank you in advance!

+3


source to share


1 answer


Just found a solution:

put your icons in ~ / .icons / hicolor / 48x48 / emblems

named "emblem-icon_name.icon" and "emblem-icon_name.png"

The icon file is just a text file:



[Icon Data]
DisplayName=icon_name

      

And the call:

 file.add_emblem("icon_name")

      

Hoping this helps someone.

+2


source







All Articles