icons in gnome desktop

Hi,
I just installed Leap in my HP-laptop with the gnome-desktop. I have tried several things to associate an application with its icon, and followed instructions like in thispostbut, with no success. Could you guide me to put icons to files? I mean, I have been doing it “by hand”, one by one, but when I have several hundreds of a kind, it’s no fun at all!
Thanks :wink:

I’m not sure to understand what you are trying to do, but to copy, say, the 32x32 images you can open a terminal and type:


su
(root password)
cd /usr/local/Wolfram/Mathematica/9.0/SystemFiles/FrontEnd/SystemResources/X/32x32
cp /usr/local/Wolfram/Mathematica/9.0/SystemFiles/FrontEnd/SystemResources/X/32x32/*.* /usr/share/icons/hicolor/32x32/apps/

This is if you actually see .png images in /usr/local/Wolfram/Mathematica/9.0/SystemFiles/FrontEnd/SystemResources/X/32x32/ , otherwise adjust the command accordingly and repeat the procedure for 64x64 and 128x128 icons.

Then, after you have merged all needed icons to /usr/share/icons/hicolor/ according to your reference, maybe deleting the icon-theme.cache file there might help. In a terminal type:


cd /usr/share/icons/hicolor
rm icon-theme.cache

Hope this helps

Thanks for the reply :wink:


cd /usr/share/icons/hicolor
rm icon-theme.cache

Hope this helps

Unfortunately, it didn’t work. It’s not just a Mathematica issue. The icons for many programs all show the same image and it’s hard to distinguish between them. (Texmake, gvim, …)
Any suggestion will be much appreciated
Thanks lol!

Still puzzled, but I tried to install gvim as an example.
It includes one single icon, installed as
**/usr/share/icons/hicolor/48x48/apps/gvim.png **

nevertheless, it didn’t display as such just after installation, defaulting to the generic “executable” violet square in the Gnome Application menu.
Then I typed in a terminal (as superuser…)


**bruno@LT_B:/usr/share/icons/hicolor> su
Password: 
LT_B:/usr/share/icons/hicolor # rm icon-theme.cache
LT_B:/usr/share/icons/hicolor # **

and the green square with the big “V” automagically appeared colouring the gvim entry in the Gnome Application menu.
Since gvim doesn’t install any “MIME type” icon, no graphic change occurred to the associated files (mostly text files which retain their default appearance in Nautilus, say).

This is the expected behaviour AFAIK; if you expect something different, please explain adding some more detail…

Maybe the following has better chances…
After copying all the relevant icons to the corresponding icon theme (“hicolor” being the default), as superuser try to issue:


**gtk-update-icon-cache --force /usr/share/icons/hicolor**

possibly changing “hicolor” to the name of every theme you added icons to.

I tried the code with no success… I have very little experience in linux and donot know where to aim. Could you give me another tip?
I really thank your support ;).

OK, so let’s start from the basics. As I understand it, you might have one of three issues:
issue A) In the Gnome “Activities overview” an application is shown by the generic “executable” icon, not by its own icon;
issue B) In a file manager window (Nautilus on Gnome), files are not shown by a preview;
issue C) In a file manager window, files that should be associated with a specific application are not shown by that application’s specific icons, but only by generic icons.

Issue A) Let’s take gvim as an example.
When you install gvim, in the Gnome “Activities overview” it shows with a generic icon (to see what I mean look for /usr/share/icons/Adwaita/48x48/mimetypes/application-x-executable.png ).
This is likely due to the gvim .rpm package not refreshing the icons cache, so you have to refresh it yourself, by opening a terminal and typing:


su
<root password>
gtk-update-icon-cache --force /usr/share/icons/hicolor

Afterwards, in the Gnome “Activities overview” gvim shows with its own green icon (look for /usr/share/icons/hicolor/48x48/apps/gvim.png ).
This is often the case with applications not downloaded from OpenSUSE repositories, like “upstream” applications (the Open Document Foundation LibreOffice version might be an example) or general applications (my guess for Mathematica, e.g.).

Issue B)
To show a preview of files in Nautilus, two conditions must be satisfied:

  1. the application involved must be capable of thumbnailing and integration in Gnome;
  2. in Nautilus, File > Preferences > Preview > Show thumbnails must be set accordingly.
    Currently, neither gedit nor gvim show previews for .txt files e.g.

Issue C)
As an example, say that .xyz files are associated with the XYZ application; for those files to show with “XYZ colors” two conditions must be met:

  1. the XYZ application must have some specific icons saved to /usr/share/icons/hicolor/<nnxnn>/mimetypes (see, for instance, LibreOffice icons saved to /usr/share/icons/hicolor/48x48/mimetypes ); after having installed or copied the needed icons there, a refresh of the icon cache might be needed, as described for issue A);
  2. the .xyz files must be set to open with XYZ by default.
    To do that, select an .xyz file, right-click, > Properties > Open With > select XYZ app > Set as default.
    It might also be needed to edit file /usr/share/applications/XYZ.desktop at the “MimeType=” line if the packager didn’t configure it properly.

That’s all, Folks!
If you have issue D) please explain, my crystal ball is broken at the moment :wink:

Bruno, hi lol!
I greatly appreciate your advise. Thanks for your reply.
There must be a detail i’m missing…
I followed the instructions you kindly gave me; a rebooted; and… this is what i get:
https://drive.google.com/file/d/0BzBoLoUQva9aWTltNWI1bU1OMXc/view?usp=sharing
The image shows a Mathematica file (ajuste-datos.nb); a LaTeX file (simple_pendulum.tex).
These files used to have icons.
Any suggestion?
Thanks :wink:

OK, so we are dealing with Issue C), files associated with an application don’t display as you expect.

Let’s take your file “ajuste-datos.nb” as an example.
In your screenshot it is shown as “x-office-document” (see file /usr/share/icons/gnome/256x256/mimetypes/x-office-document.png ).
Now, if I check file /usr/share/mime/application/mathematica.xml I read something like:

<?xml version="1.0" encoding="utf-8"?>
<mime-type xmlns="http://www.freedesktop.org/standards/shared-mime-info" type="application/mathematica">
  <!--Created automatically by update-mime-database. DO NOT EDIT!-->
  <comment>Mathematica Notebook</comment>
...
  <sub-class-of type="text/plain"/>
  <generic-icon name="x-office-document"/>
  <glob pattern="*.nb"/>
  <alias type="application/x-mathematica"/>
</mime-type>

So what you see is the expected behaviour, not a bug. That information is installed in the system by package “shared-mime-info”.
You may find additional information at shared-mime-info-spec
I see that the version installed in Leap is slightly dated, being version 1.2 while version 1.5 is available at shared-mime-info
but I doubt that an update would give what you apparently expect.

Sure it should be possible to fool the system and tweak icons stored at /usr/share/icons/gnome/256x256/mimetypes/ and one or more .xml files stored at /usr/share/mime/ so that files show up as you like, but I have never done that and don’t know a simple “one-click” way of doing so.
You may also notice that two related commands are available, “update-mime-database” and “mime-info-to-mime”, that might be useful but I would not use them unless I know what I’m doing.
Moreover, I would do any experiment in VirtualBox or on a test installation, not on my main “production” system.
I will update this info if I find a simple way to fool the system in the next few days; or maybe somebody with a deeper understanding of Gnome might read this and join with comments.

Hi, I found this by googling: https://github.com/jonathanunderwood/rpm-mathematica/blob/master/Mathematica.spec
Please note where it reads:


# Unfortunately the freedesktop.org.xml contains mime entries for
# mathematica notebook files which set the application type to
# application/mathematica with an alias to
# /application/x-mathematica. This overrides the wolfram shipped mime
# file for notebook files. As a fix, we'll add the
# application/mathematica and application/x-mathematica mime types to
# the desktop file. See:
#
# https://bugs.freedesktop.org/show_bug.cgi?id=93811
# https://bugzilla.redhat.com/show_bug.cgi?id=1300723
#
# We'll also add the Development category rather than creating a
# sub-menu just for mathematica
desktop-file-install wolfram-mathematica%{major_ver}.desktop \
                     --add-mime-type=application/mathematica \
                     --add-mime-type=application/x-mathematica \
                     --add-category=Development \
                     --dir=$RPM_BUILD_ROOT%{_datadir}/applications
# Install mime files
cp -a *.xml $RPM_BUILD_ROOT%{_datadir}/mime/packages/

popd
 
# Install icons
install -d $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/{32x32,64x64,128x128}/{apps,mimetypes}
pushd $RPM_BUILD_ROOT%{destdir}/SystemFiles/FrontEnd/SystemResources/X
for i in "32" "64" "128"; do
    cp -a App.Mathematica.${i}.png $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/${i}x${i}/apps/wolfram-mathematica.png
    cp -a App.Player.${i}.png $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/${i}x${i}/apps/wolfram-mathematicaplayer.png

    for v in "cdf" "mathematica.package" "nb" "player" "wl" ; do
    cp -a vnd.wolfram.${v}.${i}.png $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/${i}x${i}/mimetypes/application-vnd.wolfram.${v}.png
    done
done
popd

This casts some light to the source of the problem and the available solution (# Install mime files and # Install icons).
See also https://bugs.freedesktop.org/show_bug.cgi?id=93811 a bug still open, apparently.
I also checked that updating shared-mime-info to version 1.5 changes nothing about this problem.
Hope this helps; I don’t use Mathematica, so cannot check it out myself.

Thank you very much for all of your support. lol!
I’ll try to follow these directions and will let you know
Hasta luego rotfl!