harry-cpp / code-nautilus

VSCode extension for Nautilus
The Unlicense
419 stars 77 forks source link

Adding icons to the MenuItem #18

Closed SymonRod closed 3 years ago

SymonRod commented 3 years ago

Hi, sorry for bothering and for my English but I was trying to add a little icon to the side of the button "Open with VScode" but it wont work can someone help me?

I tried to add the icon variable to the "Nautilus.MenuItem" like this:


item = Nautilus.MenuItem(
            icon= ICON,
            name='VSCodeOpen',
            label='Open In ' + VSCODENAME,
            tip='Opens the selected files with VSCode'
        )

And the ICON constant is defined at the top of the file after the imports like this:


# Icon path for the menu item
ICON = "/usr/share/code/resources/app/resources/linux/code.png"

What im doing wrong? Thanks for the help!

harry-cpp commented 3 years ago

In the docs it states it requires the icon name, not the icon path, you can see what the icon name visual studio code installs from its .desktop file (if it installs any icon at all).

Also do note that you also need to enable icons using gnome tweaks tools I believe, not sure, GNOME is a DE that does not like extra icons on buttons and context menus.