2

I created a "Places" Cinnamon applet (a drop down list filled with folders).
And I would like to get the gnome icon name of a specific folder path. For instance, I would like to get the gnome icon name from the music folder "/home/USER/Music" which would be "folder-music".

I found something interesting in Gio :

const Gio = imports.gi.Gio;

var directory_file = Gio.file_new_for_path("/home/USER/Music");
var icon_names = directory_file.query_info('standard::symbolic-icon', 0, null).get_symbolic_icon().get_names();

But "get_symbolic_icon().get_names()" returns a String Array with more than 1 icon name.
For instance "/home/USER/Music" returns

  • folder-music-symbolic
  • folder-music
  • folder

As there is not really documentation, I would like to know if someone knows how to get the gnome icon name from a folder path ?

Nicolas
  • 6,289
  • 4
  • 36
  • 51

0 Answers0