I use the python-nautilus module, and I try to add a custom emblem (an icon overlay), like that:
But I didn't found anything about that.
I'm able to add an existing emblem like "multimedia" 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 that ?
Thank you in advance !
Just found the 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 like that:
[Icon Data]
DisplayName=icon_name
And call:
file.add_emblem("icon_name")
Hoping that it helps someone.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With