Chrome UI Size and Zoom Levels in Ubuntu 16.04

chromiumdisplaygoogle-chromeUbuntu

I've been using Ubuntu 16.04 with dual 4k displays for about 3-4 months now, but all of a sudden today, the zoom level & UI size seems off in Chrome.

The dual-display screenshot has 3 windows (from left to right): Visual Studio Code, Chromium, and Chrome.

As you can see, Chrome and Chromium are arriving at different conclusions for what scale things ought to be.

a screenshot wherein Visual Studio Code, Chrome, and Chromium indicate the zoom problem

Since Visual Studio Code is built on the Electron Platform, it's effectively an instance of Chrome, so that's why I included it here for comparison. The left pane w/ the file list is normally about 60% of the size in this screen shot.

For both Chrome and VS Code, zooming out 2-levels gets it roughly to where it's been all along.

So, Question: How do I fix this so that I don't have to zoom in/out in Chrome?

Also:

  • in Display settings in Ubuntu remain the same–both displays @ 3840×2160 res and a 1.5x scale factor for 'menu and title bars'.

  • My system is an i5 6600K w/ GTX 960 using the NVIDIA binary driver, v 361.45.18

  • the Menu font in all windows appears slightly larger than usual

Best Answer

I figured this out, thanks in part to the Angel who wrote this.

tl;dr: do this:

  1. Go to your Settings -> Displays
  2. Note what the value of the slider is at "Scale for menu and title bars" (mine was 1.5)
  3. Open a terminal
  4. sudo gedit /usr/share/applications/google-chrome.desktop
  5. Find this line:

Exec=/usr/bin/google-chrome-stable %U

  1. Change it to this (where n is the value you noted in step #2):

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

  1. Save/close, relaunch Chrome.

Unfortunately this doesn't seem to work with VS Code, but that's less of an issue, as you can simply zoom out (View Menu -> Zoom Out), and it affects the entire UI.

Explanation: Ubuntu applies a system-wide scaling factor to the UI in hi-DPI monitors. Chrome thinks it's so special, so it ignores that and does its own thing.

The link above recommends changing to a 1 scaling factor, but this is the equivalent of 0 scaling (not OK for hi-dpi).

By mirroring the system scale factor, you bring Chrome in-line w/ everything else.

Related Question