kindoflike
kindoflike

Reputation: 487

`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.

Upvotes: 0

Views: 1465

Answers (2)

Gao Pinker
Gao Pinker

Reputation: 11

I've encountered you problem, got the same error. At last I found there were different "gio" in my Ubuntu. The one that report "metadata::custom-icon not supported" was "/home/user/anaconda3/bin/gio", which was provided by annaconda3.

And there was another "/usr/bin/gio" provided by apt-get, which worked for me.

To discover which one of "gio" you are using, just type "which gio" in bash to find out. To fix the problem:

  1. change $PATH to use system provided gio, or
  2. use absolute path of '/usr/bin/gio'

Hope that works for you

Upvotes: 1

hasecilu
hasecilu

Reputation: 41

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

Upvotes: 0

Related Questions