3

When I run Matlab from its launcher, a second icon will show up. Funny thing is that if I put the mouse on the new icon, the text that appears on it is not the one I have in my .desktop file. So my guess is that the launcher is launching the script but it is not capable of associating it with its icon, so it launches a secondary one.

So far it only happened with Matlab.

I don't know what happened, it was working fine and now it doesn't. I don't feel I have changed anything.

I have the .desktop file in .local/share/launchers. Its code is:

[Desktop Entry]
Type=Application
Name=Matlab
Comment=Matlab
Exec=/usr/local/MATLAB/R2012a/bin/matlab -desktop
Icon=/home/kais3r/.local/share/launchers/Matlab.png
Terminal=false
Categories=Math;IDE;
StartupNotify=true

But I don't think the problem is related to this. Maybe some of the last updates? I don't know.

6 Answers6

3

Add the following line to your .desktop file

StartupWMClass=com-mathworks-util-PostVMInit
Clark
  • 230
  • I had already tried that one and didn't work. Anyway I tried again and it still happens. I have found that it also happens to a friend using gnome 3. – Jordi Arjona May 24 '12 at 12:57
1

I had the same problem with Matlab R2013a. I opened .desktop file and found that the content was right except for the fact that there was a blank line between StartupNotify=true and StartupWMClass=com-mathworks-util-PostVMInit. I removed the blank line, restarted matlab, and it worked. Now only one icon appears as expected. Not sure, how it worked!

muru
  • 197,895
  • 55
  • 485
  • 740
1

Here https://wiki.archlinux.org/index.php/matlab#Activation mentions a possible solution (I had the same problem):

In order for icons to appear correctly StartupWMClass needs to be set in the desktop entry. To find it out start MATLAB, run xprop | grep WM_CLASS on terminal and select the MATLAB window.

Luca
  • 11
0

In Matlab2017b the line the needed to be added to the .desktop file was

StartupWMClass=sun-awt-X11-XFramePeer
Zanna
  • 70,465
0

Add the following line to your .desktop file

StartupWMClass=com-mathworks-util-PostVMInit

For me it worked. The second icon appears only when matlab is starting and there is the little window with written "Matlab: the Language of Technical computing"; then it disappears and only one icon remains.

I've also installed the package matlab-support, maybe it can be useful.

Michele
  • 904
  • 7
  • 23
  • Hey... that solution was already proposed and said that was not working :) I also have that package and have the same problem – Jordi Arjona Aug 27 '12 at 06:43
0

Have you tried this?

(Please note of course it's safer just to move the file outside of the directory e.g move it to the desktop before deleting, to ensure it solves the issue first before deleting the file.)

For anyone interested I am posting the solution to the problem. I have run the following command in /usr/share/applications and ~/.local/share/applications to find files containing the entry Matlab regardless of the case; I learned that trick from StackOverflow.

grep -Ril "Matlab" /usr/share/applications/

The output was:

/usr/share/applications/matlab.desktop

being the file I generated manually. However, when I ran the command in the other directory

grep -Ril "Matlab" ~/.local/share/applications/

The output was:

/home/ongun/.local/share/applications/com-mathworks-util-postvminit.desktop
/home/ongun/.local/share/applications/mimeapps.list

After checking the first entry (since it was a .desktop file) I found that it was the culprit and deleting it remedied the duplicate icon in Dash.

The above solution, in blockquote is taken from here, this worked for me

Mark
  • 153