1

On Ubuntu 22.4 lts I can manually assign an icon to an executable file in nautilus, by right clicking on that file in the file explorer, select "Properties", click on the default icon, and select a new icon file.

After I've done that gio info <filename>
gives me metadata::custom-icon: file:///my-icon.png
So far so good.

But when I try to set the icon via gio like this

gio set -t 'string' "${FILE_PATH}" metadata::custom-icon "file://${ICON_PATH}"

I get an error

gio: Setting attribute metadata::custom-icon not supported

metadata:custom-icon should be writeable by gio, as

gio info -w <filename>

shows me

Writable attribute namespaces: metadata (string, Copy with file, Keep with file when moved)

I want to use this as part of a postinst script for my deb package. Other metadata values also won't work, like metadata::trust etc.

I know, this Question has been asked before, but I haven't found a solution for this problem yet.

mdolphin
  • 11
  • 1
  • Seems what ever it is your are trying to is simply not supported. Have you looked at this question? https://askubuntu.com/questions/1044358/is-it-possible-to-insert-icons-on-folders-with-the-gio-set-command – David Apr 08 '23 at 11:36

1 Answers1

1

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:

Change $PATH to use system provided gio, or use absolute path of /usr/bin/gio. Hope that works for you.

sotirov
  • 3,169