Adding Matlab to launcher in Ubuntu

I screwed up my Matlab2013b installation on Ubuntu 14.04, so decided to re-install. Upgraded to Matlab2014b in the process.

Installation was straight forward – download linux 64-bit from Mathworks site, install to /usr/local/MATLAB and have the installer make the symbolic links to the executable binaries for me. Matlab has really polished that process.

2014b no longer gives me problems with tab-complete menus.

One little thing – while searching for Matlab in the Unity menu (invoked by pressing the Meta or Windows key), the Matlab icon comes up. Dragging it to the launcher menu also works, but instead of getting the same icon, it’s simply a picture of a question mark. Cosmetically very unpleasing and confusing.

The fix:

The launcher icon is specified in
/usr/share/applications/matlab.desktop:

#!/usr/bin/env xdg-open
[Desktop Entry]
Type=Application
Icon=/usr/share/icons/matlab.png
Name=MATLAB
Comment=Start MATLAB - The Language of Technical Computing
#Uncomment the following line and comment the line after to
#force matlab to use the 32 bits architecture
#Exec=matlab -arch=glnx86 -desktop
Exec=matlab -desktop
Categories=Development;
#Uncomment the following line if you've got several matlab icons in the launcher
#StartupWMClass=com-mathworks-util-PostVMInit

The value of the Icon field specifies what image to use as launcher icon. It seems the default path is not valid.

The Matlab icon in the Unity search menu is configured by (I think..):
/usr/share/app-install/desktop/matlab-support:matlab.desktop:

[Desktop Entry]
X-AppInstall-Package=matlab-support
X-AppInstall-Popcon=3
X-AppInstall-Section=multiverse

Version=1.0
Type=Application
Terminal=false
Exec=matlab -desktop
Name=MATLAB
Icon=_usr_share_icons_hicolor_48x48_apps_matlab
Categories=Development;Math;Science
Comment=Scientific computing environment
StartupNotify=true
StartupWMClass=com-mathworks-util-PostVMInit

X-Ubuntu-Gettext-Domain=app-install-data

The value for the Icon field actually refers to
/usr/share/app-install/icons/_usr_share_icons_hicolor_48x48_apps_matlab.png. It’s good to change field value to that to better reflect this.

So, we can either take
/usr/share/app-install/icons/_usr_share_icons_hicolor_48x48_apps_matlab.png and give it to the Icon field in the first config file, or copy that image to the location specified by the default path in the first config file.

After this, Matlab has a nice icon in the launcher menu.

Advertisements

About collapsedwavefn

I have a lot of thoughts. Some of them I'd like to share.
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s