'`gio` command won't display `metadata::custom-icon` attribute

I have set a custom icon for a directory (via the file manager). this should set the metadata::custom-icon attribute. however, gio info <path> does not show this attribute at all.

the following python script shows it though:

from gi.repository import Gio

attribute = 'metadata::custom-icon'
folder = Gio.File.new_for_path('/path/to/directory')
info = folder.query_info(attribute, 0, None)
print(info.list_attributes())
print(info.get_attribute_string(attribute))

# output:
# ['metadata::custom-icon']
# file:///path/to/icon.png

I am curious to find out why that might be.



Solution 1:[1]

I don't know if you already fix the problem but for the people of the future:

Are you writing correctly the command? It is very tricky to make it works, I had a lot of problems because the path of picture has a space and because of the slashes '/'.

The command should be like this example: gio set $HOME/Documents/C metadata::custom-icon file://$HOME/Pictures/App_Logos/C.png

DO NOT USE SPACES!

I have created a bash script to change icons in bulk, check it here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 hasecilu