Enable Hidpi Scaling on Lubuntu (VirtualBox)

June 21, 2018

HiDPI

Edit ~/.Xresources in your home directory. If the file doesn’t exist, create one.

Xft.dpi: 141
Xft.autohint: 0
Xft.lcdfilter:  lcddefault
Xft.hintstyle:  hintfull
Xft.hinting: 1
Xft.antialias: 1
Xft.rgba: rgb

NOTE: 141dpi is for 15.6” monitor with 1920x1080 resolution (FHD) (roughly 125% scaling). Use DPI Love to calculate the dpi for your screen.

You can use sudo service lightdm restart to preview the changes immediately without a restart (WARNING: save your work as all apps shall be force closed)

Or you can reboot to see if changes to ~/.Xresources works.

LxPanel

Once you successfully change the dpi, you will notice the bottom panel still looks pretty small.

Right click on the panel, click Panel Settings -> Geometry. Adjust the height and icon size to enlarge the bottom panel.

Sublime Text 3

You will notice Sublime Text 3 still looks pretty small.

Goto Preferences -> Settings and set dpi_scale. Restart Sublime Text 3 for the changes to take effect.

{
  "dpi_scale": 1.25,
  ...
}

Google Chrome

You can force google chrome dpi scaling.

google-chrome --force-device-scale-factor=1

NOTE: I just edit the desktop shortcut on lubuntu (right click, Properties -> Desktop Entry -> Command = opt/google/chrome/google-chrome --force-device-scale-factor=1 %U)

Dual/Multi Monitor - Different Scaling For Each Screen

If you have dual monitor which require different scaling, you can try xrandr.

Run xrandr to list the name of screens.

xrandr --listmonitors

My setup shown VGA-1 and VGA-2 (probably because I am running Lubuntu within VirtualBox).

125% scaling looks fine on my 1920x1080 primary 15” screen, but it looks pretty large on my secondary 1366x768 19” monitor.

I adjust the secondary screen scaling by running:

xrandr --output VGA-2 --scale 1.25x1.25

NOTE for virtualbox: The xrandr scaling works but my mouse cursor screw up on the second screen on virtualbox. Sadly I have yet to find a solution for this problem.

VirtualBox

I am running a Windows 10 Host with Lubuntu 16.04 Guest

Using VirtualBox Scale Factor (View -> Scale Factor -> 125%) works, but the display is blur (not sharp).

Using ~/.Xresources to change the dpi works perfectly with sharp display.

Using xrandr for second monitor screw up the mouse cursor.

References:

This work is licensed under a
Creative Commons Attribution-NonCommercial 4.0 International License.