0
$\begingroup$

On my Linux (Manjaro KDE, QT version 5.14.2) machine with 1920 x 1080 screen resolution machine, if I launch Mathematica 12.1 from the terminal using the following commands, the notebook and window size look good to me.

QT_AUTO_SCREEN_SCALE_FACTOR=1 QT_SCALE_FACTOR=1.2 Mathematica &

How can I set these variables as default every time I launch Mathematica (from GUI or from the terminal by just typing mathematica)?

My init.m file looks like this

SetOptions[$FrontEnd, 
Default2DTool->"Select",
Default3DTool->"RotateView",
VersionsLaunched->{"12.1.0"},
PrivateFrontEndOptions->{"InterfaceSettings"->{
 "PredictiveInterface" -> {"ShowMinimized" -> False, "FirstUse" -> False}},
"LastRegistrationReminderDate"->{2020, 5, 4},
"WolframAlphaSettings"->{
 "Autoload" -> True, "BaseURL" -> "Automatic", "SendMathematicaSessionInfo" -> 
  True, "AppID" -> Automatic}}
]

I tried adding the terminal command directly to the init.m file but that did not work.

$\endgroup$
5
  • $\begingroup$ I think this is operating system question. For example, you can define $\endgroup$ – user18792 May 5 '20 at 6:24
  • 1
    $\begingroup$ alias Mathematica='QT_AUTO_SCREEN_SCALE_FACTOR=1 QT_SCALE_FACTOR=1.2 Mathematica &' in .bashrc. then typing Mathematica will call the above sequence. Or you can export the above variables, then the setting will be applied to all programs. In a similar way you can edit the script which is called by pressing gui button (this depends on graphical environment you use). $\endgroup$ – user18792 May 5 '20 at 6:34
  • $\begingroup$ @user18792 Thanks. I tried adding `Mathematica='QT_AUTO_SCREEN_SCALE_FACTOR=1 QT_SCALE_FACTOR=1.2 Mathematica &' to the .bashrc file but that also doesn't work for some reason. $\endgroup$ – Apoorv Potnis May 5 '20 at 7:16
  • 1
    $\begingroup$ You need to add word "alias" before the first Mathematica (which creates alias). Also to unlogin and login again from the user in order changes take place. Also you can test it before including first executing "alias Mathematica='QT_AUTO_SCREEN_SCALE_FACTOR=1 QT_SCALE_FACTOR=1.2 Mathematica &' " in terminal (remove outer quatation marks, however keep single quatation marks. Can read about creating aliases in many places, for example here askubuntu.com/questions/1414/how-to-create-a-permanent-alias $\endgroup$ – user18792 May 5 '20 at 8:43
  • $\begingroup$ @user18792 That workaround worked for me. I also added it to the command executed when I open using GUI and that works as well. Can you post your comment as an answer so that I can accept it? $\endgroup$ – Apoorv Potnis May 5 '20 at 9:01
2
$\begingroup$

You can create alias for the particular command as

alias Mathematica='QT_AUTO_SCREEN_SCALE_FACTOR=1 QT_SCALE_FACTOR=1.2 Mathematica &'

After testing it in terminal you can make the alias permanent by adding it, for example, in .bashrc file. If you want that QT_AUTO_SCREEN_SCALE_FACTOR=1 QT_SCALE_FACTOR=1.2 values to be applied to all other commands, your can add

export QT_AUTO_SCREEN_SCALE_FACTOR=1
export QT_SCALE_FACTOR=1.2 

in the same .bashrc

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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