Best practice: Working with different screen resolution (FHD and 4K)

Currently, I have a 14 FHD notebook screen connected to a 27 FHD monitor. This works find since both have the same resolution. Now, I want to move to a bigger screen / higher resolution (DPI). I have tested a 27 4K but this setup requires an screen scaling since all elements are just too tiny.

The web is full of blogs covering the topic of Linux OS scaling: Tweak tools, and GTK, QT … scaling factor settings … but it is getting more complex for Qubes OS running many minimal templates.

I am wondering if someone has already a good / easy / robust approach to easily adjust the screen settings to work in both conditions:

A. at home, connected to one or two big screen with QHD or 4k monitor(s),
B. traveling, using only the FHD notebook screen

I see two solutions, install to all minimal templates (base template) tweak tools to do adjust the settings manually - one by one. Or a script which checks the screen setup (one or more screen detected) and makes the scaling of GTK, QT, icon, font size … when launching the qubes.

Is there someone who has already a working script or (semi-)automatic screen management for Qubes OS?

Beside the two use cases, I tested a few settings on a 4K monitor only (DPI, scaling…) and I can see:

  • surprisingly normal appVMs (based on Debian 12; standalone template) worked out of the box (red windows)

  • all dom0 applications which belong to the systems tools follow the Appearance settings but all the Qube apps (Qube Manager, Qube Settings window etc.) does not adjust the resizing settings.

  • as expected minimal templates do not any resizing setting

Just do avoid spending money for nothing, anyone out there who has a working Qubes OS 4K setup running? Please drop your settings, configs, workarounds… Thank you.

1 Like

I gave up with 4K (auto-)settings. QHD (2560x1440) is the best compromise for me - my Qubes OS setup. QHD 27" works fine for me without modifying the scaling settings and due to the limitation of HDMI 2.0 (4K max. 60 Hz) I have 144 Hz available.

Nevertheless, I would like to drop some notes for someone who might want to follow up on this topic.

  • Librewolf (Firefox) fix for 4K:
    open a tab: about:config and set config parameter
    layout.css.devPixelsPerPx to 2

  • My script I used; auto-run during startup
    Issue: xrandr needs access to the X server (it works when you open a terminal and launch the script, but not automatically without a terminal opened)

# auto display scaling for 4K monitor (3840x2160; 16x9)
# prerequisites  (for *x2160 pixel detection):
#   - no pivot setup
#   - if notebook, then HD notebook and 16:9 ratio
DPI_dectection=$(xrandr | grep connected | grep -v disconnected)

if [[ ${DPI_dectection} == *"x2160"* ]]; then
    export QT_SCALE_FACTOR=${DPI_scale}
    export QT_FONT_DPI=${DPI_factor}
    export GDK_SCALE=${DPI_scale}
    export GDK_DPI_SCALE=1
    gsettings set org.gnome.desktop.interface text-scaling-factor ${DPI_scale}
    export QT_SCALE_FACTOR=1
    export GDK_SCALE=1
    export GDK_DPI_SCALE=1
    gsettings set org.gnome.desktop.interface text-scaling-factor 1.0

An alternative, which I did not test (credits go to @solene)

One method could be to make a script in dom0 that could figure if you need 4k or not, then in the rc.local script, you call it using qrexec to know if you are using 4K, then you could overwrite variables in /etc/profile instead of exporting, that should work IMO (if rc.local starts before X)

1 Like