Adjusting Chrome's Scaling Factor on Ubuntu

If you are a using 4K monitor with your Full HD laptop, it is highly possible that you will end up having scaling problems at some point.

Because Fractional Scaling is not a complete solution. Scaling to fractional values causes blurry renderings most of the time. So you have three options:

1 - Setting the external monitor resolution to 1920x1080 which is something I wouldn’t want to look at. Things got blurry most of the time.
2 - Use the external monitor with default 4K resolution which makes things too small.
3 - Sell your 4K monitor and buy a full HD one so you will have the same resolution for both the laptop screen and external monitor. But still, downscaling or zooming 4K monitor will perform better because of the increased pixel density.

If you are like me and if you want to keep your 4K monitor, you can change the scaling factor from Gnome Tweaks. This will apply some scaling to all of your applications. Open Tweaks app and go to Fonts section:

Changing Scaling Factor might help you

But not each program behaves the same. There are different kinds of programs built with different technologies like GTK apps, Qt apps, and Electron apps. And applying a global font scaling might not have the same effect on all apps.

Chrome and VS Code are the most crucial ones, at least for me.

For VS Code, there is a config you can change. Open the settings and look for window.zoomLevel.
Setting it to 2 will perform much better density and resolution on a 4K monitor.

For Chrome, it is a bit more complicated. If you just zoom in or out inside the browser, only the content of the pages will be effected. But the window and tabs and all other places will remain small. This is the difference between zooming and scaling factor.

On Ubuntu, we can change the Chrome’s scaling factor by passing a startup flag (--force-device-scale-factor) to the Chrome comamnd. To pass that flag we need to edit the desktop file for Google Chrome:

1
sudo vim /usr/share/applications/google-chrome.desktop

Inside that file, look for the line starts with Exec=. You should see something like this:

Related line from google-chrome.desktop file

Before the % sign, add our flag. This must be the final version of the line:

1
Exec=/usr/bin/google-chrome-stable --force-device-scale-factor=1.2 %U

Note: There are 3 sections in that file for different states of the Chrome. Default Window, New Window, New Private Window. And for each section there is a similar Exec= line. Find all of them add the same flag so you can have the same scale factor when you open a new window a private one.

That’s it. Do not forget to restart the Chrome after these changes.