How to switch off HiDPI scaling for individual applications

Please post suggestions for improvement of Cinnamon on:
https://github.com/linuxmint/Cinnamon
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
kybos
Level 1
Level 1
Posts: 6
Joined: Tue Dec 11, 2018 6:11 am

How to switch off HiDPI scaling for individual applications

Post by kybos »

I use the HiDPI global setting for my 4k monitor. This works pretty well for most applications.
One of the problematic ones is NetBeans - here Cinnamon scales the fonts OK, but this breaks the UI in many places as the UI elements are not adjusted accordingly. Starting with version 9, NetBeans supports UI scaling using the GDK_SCALE env variable, so with GDK_SCALE = 2 the UI elements are scaled correctly, but then the fonts are much too big and break the UI again (being scaled both by Netbeans and Cinnamon, obviously).
GDK_DPI_SCALE and netbeans --font-size have no effect on this.

So my question is: How can I switch off the Cinnamon scaling for this app only?

Thanks,
Kybos
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
aknickolai
Level 1
Level 1
Posts: 15
Joined: Fri Apr 06, 2018 12:43 pm

Re: How to switch off HiDPI scaling for individual applications

Post by aknickolai »

I don's use Cinnamon, but these are the parameters that I muck with to get GTK scaling correct in KDE are:

GDK_SCALE=2
GDK_DPI_SCALE=0.5

The first line doubles the scaling for all elements, the second line removes the scaling for fonts.
kybos
Level 1
Level 1
Posts: 6
Joined: Tue Dec 11, 2018 6:11 am

Re: How to switch off HiDPI scaling for individual applications

Post by kybos »

Yes, that's the standard GTK3 way, but unfortunately, as I wrote above, GDK_DPI_SCALE is not understood by NetBeans...
aknickolai
Level 1
Level 1
Posts: 15
Joined: Fri Apr 06, 2018 12:43 pm

Re: How to switch off HiDPI scaling for individual applications

Post by aknickolai »

Whoops, sorry I missed that...

Did you try launching the program with GDK_SCALE=1 or GDK_SCALE=0.5?

I can't remember what Cinammon's default HDPI multiplier is, but if you undo that scaling right multiplier with GDK_SCALE for netbeans it should launch un-scaled.

Also, take a look at:

http://wiki.netbeans.org/FaqFontSize
kybos
Level 1
Level 1
Posts: 6
Joined: Tue Dec 11, 2018 6:11 am

Re: How to switch off HiDPI scaling for individual applications

Post by kybos »

Yes, no luck with all that, unfortunately...
Cinnamons HiDPI multiplier is 2, by the way.

Thanks anyway.
aknickolai
Level 1
Level 1
Posts: 15
Joined: Fri Apr 06, 2018 12:43 pm

Re: How to switch off HiDPI scaling for individual applications

Post by aknickolai »

I stumbled across this the other day and remembered this post!

https://github.com/kaueraal/run_scaled

It does exactly what you are looking for. I use it to play Wesnoth (no HiDPI support) on a 4k screen.
kybos
Level 1
Level 1
Posts: 6
Joined: Tue Dec 11, 2018 6:11 am

Re: How to switch off HiDPI scaling for individual applications

Post by kybos »

Thanks, I know that script, it's the last resort for apps that do not scale at all in 4k (like Audacity). But it does not help with the inconsistent scaling in NetBeans.

I found a very good solution for my problem in this post:
https://issues.apache.org/jira/browse/NETBEANS-765

In short:
1. Install latest NetBeans (currently 11)
2. Install latest JDK (currently 11)
3. Install Darcula LAF add-on (from github)
4. Start in bash with GDK_SCALE=2 netbeans

Not only is the scaling correct for all UI elements and fonts, but it even looks really good...
Locked

Return to “Cinnamon”