Setting environment variable for Plasma on startup

So I’m using fractional scaling 'cause I’m stuck on a 1600p monitor and the default is too small. This causes me to be affected by this bug. There is a workaround, but it requires me to set an environment variable called QT_SCALE_FACTOR_ROUNDING_POLICY before entering Plasma.

I tried to set it up using Autostart in the Settings, which didn’t work. Could a more experienced user help me out?

See if this helps:
https://userbase.kde.org/Session_Environment_Variables

Qt6 Reference:

Those look like instructions for Plasma 5. Do they still work?

In addition, when I try to run the following:

#!/bin/bash
export QT_SCALE_FACTOR_ROUNDING_POLICY=Round

I get this error in autostart:

Am I doing something wrong?

Share the fix_test.sh you created.

Yes, try for yourself.

The text before the screenshot is the contents of fix_test.sh.

Check SELinux policy is not the problem here perhaps.

I tested using a script in ~/.config/plasma-workspace/env/, and it set my test environment variable as expected.

I was setting it through the GUI, let me see if copying it to that folder fixes things

Actually, just in case, could you show me the contents of your script? Just to check if mine has anything different.

Mine is identical apart from the variable name.

It works! So the solution is to not use the Autostart GUI in settings and instead put the script in .config/plasma-workspaces/env yourself.

Good result. Thanks for the update.

A DE agnostic approach may also be to set it in ~/.bashrc as required.

Yes, that’s exactly right.

If you use the autostart GUI, you script will start too late. If you put it in “.config/plasma-workspace/env” then it is run before your session is fully up, so that environment settings are shared by all of your session.

Another alternative is to put it in your shell startup file, which also runs early.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.