TROMjaro Forum

DPI scaling issues and quick fixes

For context I’m running a 2880 x 1620 display giving a DPI of ~ 212 on a 15.6" laptop screen. So as usual in XFCE I leave the scale setting under Display options untouched at 1x, and instead set Appearance → Settings → Window Scaling to 2x. I believe this is equivalent to going to the XFCE Settings Editor and in the last listed channel “xsettings” and having the first value Gdk > WindowScalingFactor set to 2.

There are a few remaining issues in TROMjaro after doing this:
__

1. Window header scaling

By default, some window headers are scaled, and others are not. This is very easy to fix initially by selecting the -HiDPI theme variant in Window Manager → Style → Theme settings. E.g. if you have Skeuos-Green-Dark-XFWM selected here, switch it to Skeuos-Green-Dark-XFWM-HiDPI.

Unfortunately this gets reset and needs to be reapplied on every reboot. To fix this I needed to comment out all three lines relating to xfwm4 in /bin/fix-theming

[EDIT: With latest update I have had to redo this and with the new file I just commented out the middle two xfwm lines in the first block of code – i.e. lines 6: :

# xfwm4_theme=$(find /usr/share/themes/ /usr/local/share/themes/ "$HOME"/.themes/ "$HOME"/.local/share/themes/ -mindepth 2 -maxdepth 2 -type d -name xfwm4 -printf '%h\n' 2>/dev/null | grep -o "/${theme}[^/]*$" | sort | head -n1)

and 10:
# xfconf-query -c xfwm4 -p /general/theme -n -t string -s "${xfwm4_theme#/}"
]

I’m not sure what the best general case fix here would be. Ideally the code here would detect either the DPI, or that a scaling factor is applied, and if so, select a HiDPI variant window manager theme if available.
__

2. QT App scaling

I found that all QT programs were still not getting scaled at all. E.g. RiseUp VPN, VLC, Qoob, Tauon, MusicBrainz Picard, Shotcut, Lite XL, Stacer, QDirStat, Flameshot, Manjaro Settings Manager, XnView, Marble, Carla, Filelight, KolourPaint… and presumably any other KDE app like Kdenlive, Kate etc.

I fixed this by adding:

# Scale QT apps
export QT_SCALE_FACTOR=2

…to ~.profile (it did not work when added to either .bashrc or .bash_profile for some reason)

Since this works out of the box in MX Linux, I spent some time trying to figure out how they were doing it. Eventually with grep I discovered the file /etc/X11/Xsession.d/56xfce4-qtconfig which I think is how they are automating it:

# Set QT variables to only pass to gtk2 Xfce environment
# /etc/X11/Xsession.d/56xfce4-qtconfig
#
BASESTARTUP=$(basename "$STARTUP" | cut -d\  -f1)
if [ "$BASESTARTUP" = x-session-manager ]; then
	BASESTARTUP=$(basename $(readlink /etc/alternatives/x-session-manager))
fi
case "$BASESTARTUP" in
  xfce4-session|startxfce4)
	  #set qt environment variables to follow user chosen platform
	  #default plugin is gtk2
	  #$HOME/.config/MX-Linux/qt_plugin.conf can hold a user settable value
	  file="$HOME/.config/MX-Linux/qt_plugin.conf"
	  plugin="gtk2"
	  if [ -e "$file" ]; then
		plugin=$(cat "$file")
	  fi
	  export QT_QPA_PLATFORMTHEME="$plugin"
	  export QT_PLATFORMTHEME="$plugin"
	  export QT_PLATFORM_PLUGIN="$plugin"
	  if command -v xfconf-query >/dev/null; then
		 export QT_SCALE_FACTOR=$(xfconf-query -c xsettings -p /Gdk/WindowScalingFactor 2>/dev/null)
		 [ -z "${QT_SCALE_FACTOR}" ] && unset QT_SCALE_FACTOR
	  fi
	  ;;
esac

Edit:

Borrowing from this example, I have now updated my .profile to instead read:

# Scale QT apps
export QT_SCALE_FACTOR=$(xfconf-query -c xsettings -p /Gdk/WindowScalingFactor 2>/dev/null)

This seems to work fine for me as a more generic solution (just don’t forget the final close bracket like I did the first time or you won’t be able to load or log into the desktop environment…). I’m not sure why they need all the other bits in that file, but presumably there is good reason for it.

Maybe the way of extracting the system scaling factor here with xfconf-query could also be used as part of a solution for better choosing which window header theme to use.

__

3. Others

After doing all the above, scaling still did not work for either HardInfo or GIMP. I haven’t been able to find any fix for HardInfo unfortunately despite trying a few different environment variables. But GIMP is easily enough resolved as follows:

GIMP

Icons
Either set your desired DPI under Preferences → Interface → Display or select a custom icon size under Preference → Interface → Icon Theme.

Fonts
Go to the file:
/usr/share/gimp/2.0/themes/Dark/gtkrc
(or try changing to file in the ‘Light’ or ‘System’ directories instead of ‘Dark’. I thought it would be ‘System’, but ‘Dark’ is the one that worked for me).
In this file uncomment the line:
font_name = "Sans 11"
and change the 11 here to whatever you like to set the main menu font size.
And then also find the line:
GimpDock::font-scale = 0.8333
and similarly adjust the 0.8333 to set how the font size in the docks in scaled relative to the above. I ended up setting font_name to “Sans 20” and font-scale to 1.
__

P.S.

4. Wine

As described here, you can also increase the font size in Windows applications running under Wine, by running winecfg and then adjusting the DPI settings in the ‘Graphics’ tab. I’m not sure if there is any way to also automate that, but the script example shown here suggests that it might be possible:
https://forum.winehq.org/viewtopic.php?t=34980
e.g. perhaps could simply multiply the 0x60 (default 96 DPI in hexadecimal) shown here by the scaling factor returned by the xfconf-query above.

I never do scaling like that and there are a lot of issues, from my tests. with doing it that way. The best way is to go to the Display Settings and scale it from there:

This way everything should look just fine. I do not know what XFCE has this “window scaling” option since it is all over the place from my tests.

Hi Tio,

Sorry for sending you all that during your busy period – I happened to have the energy for it that day and wanted to make the most of that to get it off my plate. Hope you have been able to catch up on some rest after the TROM meeting!

That is interesting to hear, as it is completely the opposite of my own experiences! :smile: I guess it will depend a bit on your own particular DPI and screen size.

The scaling setting under Display settings in your screenshot works the opposite way around to how most people would expect. I.e. increasing the scaling factor here makes everything smaller, rather than larger. You can set it to a ‘Custom’ value <1 to make things bigger (e.g. setting it to 0.5 to double the size of elements), but I have never found that to work well in XFCE.
I have just done some more testing to check this, and indeed, setting it to 0.5 gives inconsistent results and makes alot of elements like the panel items super blurry/fuzzy.

By comparison, at least for my configuration, using the 2x Window Scaling setting in combination with the fixes above, everything is working perfectly. At the same time, the Display setting scaling you show, does seem to work OK when using values >1 to make things smaller. So you can for example first set the Window Scaling factor to 2x as I have it, and then, if that makes things too large, use a Display setting scaling of 1.25 or 1.5 to make everything a little smaller again and end up with a working fractional scaling setup. I haven’t done extensive testing of this, but it appears to work just fine on first look.

Maybe something like that might work well with the 1920x1200 resolution shown in your screenshot? I guess that would only need a little scaling, or perhaps none at all for a larger sized screen.

It is one area where Manjaro does not seem to do such a great job. Have a look at the MX Linux configuration sometime if you ever get a chance. I consider them to be the masters of XFCE and they have a lot of good defaults and fixes in place for it (…though they also make some strange choices like replacing Mousepad with Featherpad which doesn’t follow theming :see_no_evil: )

I understand your points. I am adding to my to do list to look into these fixes you did. Perhaps we can do something for this. For the next weeks I will be busy with the release of the documentary, but after that we can look closely into this. Thanks again!

No worries and no rush. I still have many other things I want to submit to this forum eventually. I’ve made a really important step forward with my health over the past month, so between that and the summer weather, I’m much more inclined to be working on rebuilding my body now than playing with computers :grin:

And congratulations on the release of the documentary! Looking forward to checking it out soon. I saw you re-opened the Matrix channel so planning to try to catch you there on wider TROM subjects :slight_smile:

1 Like

Take care of your health first ofc! That’s the best computer you’ll ever have :wink: And thank you!

2 Likes

For the window header scaling, I suppose you could read in the display scaling factor, as done for the QT solution above using:
xfconf-query -c xsettings -p /Gdk/WindowScalingFactor

But I was just wondering now whether a simpler and safer solution could be to add a checkbox to the TROMjaro theme selector which allows the user to choose whether to use hi-dpi window headers or not? It would avoid having to try to detect anything, or make any assumptions about the user’s preference in this. I initially was thinking it might be easier to implement too, but on second thoughts maybe not, since I suppose the underling logic is much the same in the end, but also requires a UI change.

Just a thought :slightly_smiling_face:

Well exactly what we will work next with the theme switcher :smiley:

1 Like