0

Linux desktop environments such as GNOME, KDE, XFCE etc search icon themes in some standard paths such as /usr/share/icons, ~/.icons, ~/.local/share/icons etc.

I wonder if I can add any directory to those paths for the DE to search for icons themes? For example, can I store an icon theme in ~/Icons and get the DE find the icon theme?

I know overlaying will work. I already did that. I really want a directory to be added to those path instead.

4
  • That depends on the GUI applications (window managers, file managers...) you use. There is no such thing as "Linux desktops", nor does Linux search for icons.
    – Quasímodo
    May 5, 2020 at 15:43
  • @Quasímodo Yes I know that. By Linux desktop I meant KDE, GNOME, XFCE" etc desktop environments I don't think that depends on GUI applications. It's controlled by much low level components I believe, like fontconfig for fonts
    – Anwar
    May 5, 2020 at 17:46
  • 1
    If desktop environments is what you meant, it is good idea to edit the question with the precise term to guarantee conveying the right idea. I really did not understand you at first, no nit-picking there.
    – Quasímodo
    May 7, 2020 at 0:19
  • @Quasímodo Edited the question. Check if its cleared
    – Anwar
    May 7, 2020 at 14:39

1 Answer 1

0

I'm on Ubuntu 20.04. I ran

apropos icon

in the terminal; here are the more promising results:

File::IconTheme (3pm) - find icon directories
xdg-desktop-icon (1) - command line tool for (un)installing icons to the desktop
xdg-icon-resource (1) - command line tool for (un)installing icon resources

So I tried

man File::IconTheme

and based on the info there, I wrote this short perl script and saved it as icons.perl:

#!/usr/bin/perl

print "icon paths:\n";
use File::IconTheme qw(xdg_icon_theme_search_dirs);
print join "\n", xdg_icon_theme_search_dirs, "\n";

print "user icon directory:\n";
use File::BaseDir qw(data_dirs);
print scalar data_dirs('icons');

print "\n"

Then back in the terminal, I ran

perl icons.perl

which on my system yields:

icon paths:
/home/user/.local/share/icons
/var/lib/flatpak/exports/share/icons
/var/lib/flatpak/exports/share/icons
/usr/share/icons
/var/lib/snapd/desktop/icons
/usr/share/pixmaps

user icon directory:
/home/user/.local/share/icons

Not sure if this answers your question, but maybe it points you in a better direction. I would run apropos icon and see if you find anything else useful.

3
  • Thank you. It finds the directories icon theme is searched for by default. I want to add any arbitrary directory to these paths.
    – Anwar
    May 6, 2020 at 9:48
  • You could create a symbolic link to your arbitrary directory from the "user icon directory" returned by the above perl script.
    – msp
    May 6, 2020 at 23:11
  • Sorry, stackexchange timed me out on editing my own comment... You should be able to create a symbolic link to your arbitrary directory from within the "user icon directory" returned by the above perl script. So, using the above as an example, navigate to /home/user/.local/share/icons directory in your terminal and do ln -sT _my-icons-dir_ my-icons.
    – msp
    May 6, 2020 at 23:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .