15

When making a custom launcher, it is nice to have a matching icon for it from the default usr ubuntu directories. The problem that is: Ubuntu seems to store icons in about 50 or more folders. Browsing all of them in nautilus takes ages.

So my question is: Is there some kind of icon browser that shows an overview of all icons in /usr/share/icons/*?

Jorge Castro
  • 71,754
tobi
  • 2,232

2 Answers2

13

Instead of opening the folders one by one, you can also use the Search feature of Nautilus. Navigate to /usr/share/icons, and press the Search icon on the right of the toolbar.

Search for . (all images have an extension with a dot before it) and press Enter. On a default installation, this yields about 17.5k images. That's not much of an "overview", but it includes all files in /usr/share/icons.

If you wish to avoid searching each time, you could make use of symbolic links to the images: all images are accessible from one big folder.

  1. Open a terminal
  2. To check the number of files that can be created after creating the links:

    expr $(df /home -i | tail -1 | cut -d'%' -f1 | rev | awk '{ print $2 }' | rev) - $(find /usr/share/icons -type f | wc -l)
    

    You should not continue if the number is lower than 1000 and a negative number will cause the operation to fail after some time.

  3. Make an folder named icons-all by running: mkdir icons-all
  4. Go into that folder: cd icons-all
  5. Run nano /tmp/make-icons-link
  6. Paste:

    #!/bin/bash
    if [[ $1 == *.* ]]; then
            ext=".${1##*.}"
    else
            ext=
    fi
    name="$(basename "$1" "$ext")"
    extra=
    while [ -e "$name$extra$ext" ]; do
        ((extra++))
    done
    ln -s "$1" "$name$extra$ext"
    
  7. Press Ctrl + X, followed by Y and Enter
  8. Now generate the links, this may take a while:

    find /usr/share/icons/ -type f -exec bash /tmp/make-icons-link {} \;
    

    After the command has completed, no output is shown.

  9. Close the terminal by running exit
  10. The images are now visible in ~/icons-all. Loading this directory may take a while
Lekensteyn
  • 174,277
  • I had the same problem I found the solution above very slow - so I used picassa to index - I found this to be effective. –  Mar 30 '12 at 00:42
  • @user52652 will picasa try to index all photos on my HD like shotwell seems to be doing b4 I can see anything? I just gaveup on shotwell btw.. – Aquarius Power Sep 30 '17 at 22:03
  • Using Ubuntu 16.04.5 LTS copy and paste command in Step 2. returns: 2309035. – WinEunuuchs2Unix Feb 17 '19 at 14:29
  • Thanks for this script which was very useful. By default it created too large of a collection. But if you just pick a select number of key folder/sizes, it works very well...

    find /usr/share/icons/breeze/apps/48/ -type f -exec bash /tmp/make-icons-link {} ; find /usr/share/icons/breeze/status/64/ -type f -exec bash /tmp/make-icons-link {} ;

    – Jungle Editor Jul 07 '20 at 09:06
0

Similar to the answer by @Lekensteyn, I found that the file manager PCManFM-Qt (executable pcmanfm-qt) can be used in a similar fashion. It is the default file manager installed under LXQt, but can also be installed in any Ubuntu installation with sudo apt install pcmanfm-qt.

  1. Go to an icon (sub-)folder of interest, such as /usr/share/icons/breeze.

  2. Set "View → View → Icon view" for a folder view with icon thumbnails.

  3. Open the "Tools → Find Files…" dialog and search using the following parameters:

    • File Name Patterns: *
    • Use regular expression: checked
    • Search in sub directories: checked
    • File Type → Image files: checked

When clicking next to the Search button above the result list, you will see that the file manager uses a search URL internally to represent this search, such as:

search:///usr/share/icons/breeze?recursive=1&name_regex=*&mime_types=image/*

You can copy&paste this for future use to get back to these search results faster, and you can also start the file manager to show these search results immediately:

pcmanfm-qt "search:///usr/share/icons/breeze?recursive=1&name_regex=*&mime_types=image/*"
tanius
  • 6,303
  • 1
  • 39
  • 49