PDA

View Full Version : [gnome] Set Custom Directory Icon From Command Line



fisherm
January 17th, 2010, 08:07 AM
Hello. I am looking for a way to (via bash script) set a custom directory icon for a number of directories. All of these directories contain a "cover.jpg" image. I can accomplish this manually by right clicking the directory > select "Properties > click the directory icon button > select the "cover.jpg" image. I am just looking for the way to do this in the terminal to save time, as the music collection is quite large. Thanks in advance.

mutex023
February 2nd, 2010, 02:44 PM
found this solution from - http://old.nabble.com/How-do-I-change-a-folder-icon-from-a-script--td25832597.html

In gvfs 2.28 you can use gvfs-info and gvfs-set-attribute to get and set
any metadata.
To get the custom icon value;
# gvfs-info -a metadata::custom-icon myfolder

To set a custom icon
# gvfs-set-attribute myfolder metadata::custom-icon
file:///usr/share/pixmaps/gnome-spider.png

Hope this helps, I too was looking for this.

Dart00
June 9th, 2010, 10:16 PM
Sorry for bring up a old thread....

But now that you set the custom icon from the terminal...how do you "un"set it back to the standard/default icon?

Dart00
July 12th, 2010, 04:42 AM
BUMP

Still cant figure this out... :(

maclofreak
July 14th, 2010, 06:29 AM
But now that you set the custom icon from the terminal...how do you "un"set it back to the standard/default icon?
One way is to just go Right Click>Properties>Click on icon>Revert.
But i don't know how to do it in the terminal.

redRumSirIsMurder
July 31st, 2010, 05:03 PM
This should have the same effect as selecting 'revert' from the icon properties window:


gvfs-set-attribute -t stringv myfolder metadata::custom-icon ""

This declares the attribute type to be 'stringv' before setting it blank ( "" ). Might seg fault if you don't include the empty quotes.

Use at own risk &c.

kyleabaker
November 19th, 2010, 10:53 AM
This doesn't seem to work for me. I'm testing it on my Dropbox folder, but the icon never changes. Is there something more that I need to do?

EDIT:
Nevermind, I got it working.

marksch
April 13th, 2011, 01:22 AM
kyleabaker,

What did you do to get it working?

Mark

a.sarkar
June 20th, 2011, 05:12 PM
Hi all,

I know, this is an old thread, but this is really for the benefit of others who might stumble upon this.

The command to reset the icon for a folder is

gvfs-set-attribute myfolder -t unset metadata::custom-icon