Consistent Scaling in various Linux desktop environments

Continuing the discussion from Issue with Designer/Vision Client Launchers on Linux with HiDPI displays:

I have gotten a fairly consistent experience after launching a designer instance, or vision client. However what bugs me is when using a linux distro with the Gnome desktop environment the Designer and Vision Client Launchers are always scaled down when using HiDPI displays.

In this screenshot example I am running PopOS 21.10 with Gnome 40, the display scaling is set to 125% but the launcher seems to be shrunk more than the expected 25%. This doesn’t seem to be an issue with KDE Plasma DE.
It also is not an issue with fractional scaling on the desktop, as when the scaling is set to 200% it gives me the same result.

Is there a way to launch the Designer / Vision Client Launcher with the same JVM arguments I use when launching a designer or client instance?

-Dsun.java2d.uiScale.enabled=true;-Dawt.useSystemAAFontSettings=on;-Dsun.java2d.uiScale=2.0

I don’t have my Linux desktop hooked up to check right now… but I’m pretty sure you can edit either the shell script or application launcher that ends up being used to open the launchers.

Hmm, poking around a little I can only think to maybe modify designerlauncher.sh to include the -D arguments. I thought I had this working differently before…

Actually now that I think about it I don’t remember having to do anything at all for the launchers to scale correctly. They are using JavaFX and should pick up on scaling from the environment. But if you aren’t using 200% I’m guessing you get rounded down.

Would it still be able to get the correct environment variables with the embedded version of java used in the launchers?
On Gnome it gives me the same shrunk appearance when using 200% scaling.

Not sure, I use KDE. Have you restarted or at least logged out of your session since changing the scaling value?

Ah - is the GDK_SCALE environment variable set to 2? (or set at all?)

I tried some quick google searches but I couldn’t find where I find the current setting for GDK_SCALE?

I tried rebooting in-between each scaling adjustment.
Looks normal at 100%


Example of 200%

Example of 125%

It’s an environment variable, up to you to set it permanently some how.

Try it out:

kevin@ubuntu:~/Downloads/designerlauncher$ export GDK_SCALE=2
kevin@ubuntu:~/Downloads/designerlauncher$ app/designerlauncher.sh

Maybe add it to ~/.profile if it works?

Like magic!
I tried adding it to ~./profile but that threw off the scaling for everything else in my environment.
Then I tried adding it to the .desktop file and that didn’t work, I ended up modifying the launcher.sh file to have export GDK_SCALE=2 before launching the .jar and that did it!

Ex.

#! /bin/bash
##Launches an instance of the Vision Client Launcher
# Get the location of the script.
REALDIR=$(cd "$( dirname "${BASH_SOURCE[0]}")" && pwd)

# Logging if error
LAUNCHER_LOGFILE="${REALDIR}/../visionclientlauncher.log"
LOG_MSG="ERROR [LauncherApplication           ] [$(date +"%Y/%m/%d %T")]:"

if [ "$(getconf LONG_BIT)" != "64" ]; then
	"${REALDIR}/../runtime/bin/./java" --version
	if [ $? -ne 0 ]; then
		echo "${LOG_MSG} 64-bit OS not detected. This launcher must run on a 64-bit OS." | tee -a "${LAUNCHER_LOGFILE}"
	fi
fi

#update the .desktop icon
sed -i 's,Icon=launcher.png,'"Icon=${REALDIR}\/launcher.png"',' "${REALDIR}/../visionclientlauncher.desktop"
export GDK_SCALE=2
"${REALDIR}/../runtime/bin/./java" -jar "${REALDIR}/launcher-vision-client-linux.jar" $@ >/dev/null 2>&1 &

I appreciate the help @Kevin.Herron

Good luck. High DPI on Linux is a hopeless pit of despair.

You’ll eventually find that when scaled anything but 100% the Perspective workspace in the Designer isn’t usable. Known issue without a resolution in sight…

1 Like

Dang, I could have lived in ignorance for a least another day without catching onto that perspective issue. Back to the Windows VM I guess :person_shrugging:

Oof that isn’t even a “Oh I can work around it until it’s patched” kind of bug

No, there’s something fundamentally wrong with how the embedded Chromium instance behaves and interacts with lightweight/heavyweight Swing components when in a scaled environment… I don’t think we even know if it’s a Chromium, JXBrowser, or Ignition issue yet.

I spent a couple months trying to use Linux as my primary workstation with a couple of 4K 27" displays configured for high DPI and came out the other side extremely pessimistic about the Linux desktop ever getting its shit together in this regard. I was ignoring Wayland and sticking to Xorg… the fractured ecosystem there just makes things even worse.

1 Like

Same situation here, I’ve been using MacOS for the last 10 years but we heavily on Windows Virtualization for some legacy PLC software. And with the move to Apple Silicone, Windows Virtualization is no longer an option, hence why I’m fighting the pit of despair.

Similar problem here.

The writing has been on the wall for a while now, so one thing I’ve started is to move from local VMs running the PLC programming software to centralized VMs (running on vSphere and big hardware at the office).

Still a PITA that I can’t just have a Windows x64 VM on a M1 MBP though.

1 Like

Oh, and I also just have 2 work laptops now… a Dell running Windows and one of the new M1 Max MBPs… I hate having 2 laptops, and I hate using the Windows laptop, which I’ve been forced to do for a couple months as I work on the upcoming 61850 driver.

Windows removed itself from consideration as quickly as it entered. Since Windows 10 isn’t that far from EOL I was testing VMware Workstation on Windows 11, seemed like a good option since it was compatible with the VMware Fusion software we used on Macs. Then a Windows update broke virtualization, then VMware patched the software, the next Windows update broke it again.

Heh. My bare metal is KDE at 100%. I just got 4k monitors big enough so the pixel size is very close to my 17" 1080p laptop. Why go big if you can’t use the extra real estate?

(KVM via virt-manager and virt-viewer rocks my Rockwell/GE/whatever Windows VMs. Stable for about a decade now.)

1 Like