5
$\begingroup$

Is it possible to change a setting or something in order to open files in existing Mathematica instances instead of in a new instances when double clicking the file. (This is convenient since Mathematica limits the number of instances that are allowed to open based on the license.)

Using the command line a solution was proposed in https://mathematica.stackexchange.com/a/13610/45020 however that question does not go into how to achieve the same thing in through a file explorer through double clicking / open with.

This question is similar but was considered a duplicate of the question in the first link because it didn't emphasize that it was looking for a graphical interface solution and not a command line one.

I use Ubuntu 20.04 with Nemo 4.42 as my file explorer.

$\endgroup$

2 Answers 2

5
$\begingroup$

I created a script MathematicaSingleInstance in /usr/local/bin that refers to /usr/local/bin/Mathematica as follows:

#!/bin/bash

Mathematica -sl "$@"

After making the file executable (see Properties/Permissions), Mathematica files can be set to be opened using MathematicaSingleInstance by default and this indeed opens all Mathematica files in the first opened instance.

$\endgroup$
2
$\begingroup$

Under Gnome (I use Pop OS), I just added the -sl flag to the Exec line in /usr/share/applications/wolfram-mathematica13.desktop and it seems to work well:

[Desktop Entry]
Version=1.0
Type=Application
Name=Mathematica 13
Comment=Technical Computing System
TryExec=/usr/local/Wolfram/Mathematica/13.1/Executables/Mathematica
Exec=/usr/local/Wolfram/Mathematica/13.1/Executables/Mathematica -sl --name M-13.1 %F
Icon=wolfram-mathematica
StartupWMClass=M-13.1
MimeType=application/mathematica;application/x-mathematica;application/vnd.wolfram.nb;application/vnd.wolfram.cdf;application/vnd.wolfram.player;application/vnd.wolfram.mathematica.package;application/vnd.wolfram.wl;x-scheme-handler/wolfram+cloudobject;x-scheme-handler/wolframmathematica+cloudobject;

UPDATE: For some reason, this stopped working for me as described above. The solution I found is to save the .desktop file to this location instead: ~/.local/share/applications/. This is better as the file can be kept with your local user permissions making is easier to update for new Mathematica releases.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.