Adding MRView to Ubuntu dash

Hi,
thanks for developing and maintaining this tool. I am using an Ubuntu 22.04 machine, and I have followed the Anaconda installation path in here

I am interesting in having MRView in my Ubuntu dash/dock. Adding an mrview.desktop file to my ~/.local/share/applications with the following content:

[Desktop Entry]
Name=MRView
Exec="/opt/anaconda3/bin/mrview"
Icon=/my_icon.png
Type=Application
Terminal=false
Categories=Other;
X-GNOME-SingleWindow=true

allows me to add it to the dash/dock as a favorite. However, the GUI is just empty. See screenshots attached (just launching mrview from command line vs. using the mrview.desktop approach).

Command line call to mrview (features are also working):

Adding it to favorites:

Is there a way to fix this?

Thanks.

Hi @jhlegarreta,

This is likely a quirk of running in the anaconda environment – it expects to be set up correctly before running, and the startup scripts for anaconda are typically invoked from your shell’s startup scripts (normally ~/.bashrc). The simplest way to modify your desktop file is probably to start mrview within its own shell, which you might be able to do by replacing the Exec= line with something like:

Exec="bash -c mrview"

Note I’ve not tested this…

All the best,
Donald.

Thanks for the answer Donald.

Did not work with that alone, but after spending some time I made it work. I realized that when launching the application the context menu showed the option “Launch using Discrete Graphics Card”, and it would be only when clicking on it that the application would start correctly after adding it to the dash. So after some research I found this post.

Also, in order to launch the application correctly from the dash, and prior to adding it to the dash, I need to execute:

gio launch $HOME/.local/share/applications/mrview.desktop

following this post.

It is unclear to me why this last step is required, though.

So for the sake of completeness, the .desktop file is:

[Desktop Entry]
Name=MRView
Exec=env __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia DRI_PRIME=1 bash -c "/opt/anaconda3/bin/mrview"
Icon=/path/to/my_mrview_icon.png
Type=Application
Terminal=false
Categories=Science;
X-GNOME-SingleWindow=true

Also, I had to provide the absolute path to the binary in the .desktop Exec field.

1 Like