Chrome UI size & zoom levels in Ubuntu 16.04
Solution 1
I figured this out, thanks in part to the Angel who wrote this.
tl;dr: do this:
- Go to your Settings -> Displays
- Note what the value of the slider is at "Scale for menu and title bars" (mine was 1.5)
- Open a terminal
sudo gedit /usr/share/applications/google-chrome.desktop
- Find this line (at approx 108):
Exec=/usr/bin/google-chrome-stable %U
- 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
- 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.
Solution 2
I managed to get Chrome to auto-scale to the same scale I'm using in gnome desktop by doing the following:
I created a bash script at /usr/bin/chrome-scaled
:
#!/bin/bash text_scale=$(gsettings get org.gnome.desktop.interface text-scaling-factor) /usr/bin/google-chrome-stable --high-dpi-support=1 --force-device-scale-factor=$text_scale %U
And then I created a new desktop shortcut at /user/share/applications/chrome-scaled.desktop
:
[Desktop Entry] Version=1.0 Name=Google Chrome GenericName=Web Browser Comment=Access the Internet Exec=/usr/bin/chrome-scaled Terminal=false Icon=google-chrome Type=Application Categories=Network;WebBrowser; MimeType=text/html;text/xml;application/xhtml_xml;image/webp;x-scheme-handler/http;x-scheme-handler/https;x-scheme-handler/ftp; X-Ayatana-Desktop-Shortcuts=NewWindow;NewIncognito Name[en_CA]=Chrome Scaled
Then I opened the shortcut and locked it to my launcher. Now, whatever scale you're using in gnome will also be used in Chrome.
You could also potentially avoid creating the new .desktop file and just edit the google-chrome.desktop
file instead.
Solution 3
The problem still persists when using Google Chrome under Ubuntu 18.04.
I didn't want to touch the system-wide desktop file (which I believe may get overridden by a Chrome update), so I've edited the Chrome launcher using the Alacarte menu editor, adding the --force-device-scale-factor=n
as Brandon has instructed.
It worked, but only for launching Chrome from the overview. When launching it from the dock, the scale factor override was disregarded, and all the fonts were again small.
To fix it, I've edited the ~/.local/share/applications/google-chrome.desktop
(created probably by Alacarte), inserting --force-device-scale-factor=n
in every line after Exec=/usr/bin/google-chrome-stable
- there are three such lines in the desktop file, and Alacarte only altered the first, but not those for "New Window" and "New Incognito Window".
Now the font dpi override works even when launching Chrome from the dock, and I haven't had to alter files as root.
Solution 4
Try adding:
Exec=/usr/bin/google-chrome-stable --force-device-scale-factor=0.8 %U
in chrome.desktop
file and fonts in tabs and menu look nice.
Solution 5
For chromium
and ubuntu
:
Edit /etc/chromium-browser/default
:
CHROMIUM_FLAGS="--force-device-scale-factor=n --high-dpi-support=1"
Related videos on Youtube
![Brandon](https://lh4.googleusercontent.com/-gWp7oX5nhpQ/AAAAAAAAAAI/AAAAAAAAAtM/PbMg9rrpOuA/photo.jpg?sz=256)
Brandon
Updated on September 18, 2022Comments
-
Brandon almost 2 years
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.
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 @ 3840x2160 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
-
joesk over 7 yearsAs noted by Angel in the linked article above this is now fixed in Chrome however a very related issue is the issue I am having. Is there anyway to get Chrome to refresh the scaling after you make a change without having to restart Chrome?
-
Keith OYS about 7 yearsI'm on Ubuntu 16.04 as well using Google Chrome
Beta
. This answer worked with a tweak of replacing everygoogle-chrome
instance withgoogle-chrome-beta
. Cheers. -
8D Masters almost 7 yearsI can't set scale factor to 0.5 for example, however my fonts in Chromium still too big. Any other solution?
-
Nur almost 7 yearsI applied this answer to my system (scaling = 0.875), but it doesn't seem to have any effect on Chrome at all.
-
Nur almost 7 yearsDoes this still works for you? I tried this (at 0.8 and 0.875) but it doesn't have any effect.
-
jaimedash over 6 yearsseems like it uses the system scaling now, per the accepted answer. I am using gnome tweak tool to modify that and it affects chrome too apps.ubuntu.com/cat/applications/gnome-tweak-tool
-
Ricky Boyce almost 6 yearsWorks, but also shrinks the content within the browser
-
Alfredo Hernández almost 6 yearsI also had to edit the
Exec
for the Actions for it to work, otherwise it would just use the default hidpi settings and ignore the editedExec
order. -
MeowMeow over 5 yearsIf your using a launcher, make sure to up date it there as well. It worked for both chrome stable, and beta 71.0.35
-
Apoorv Potnis over 5 yearsIn Ubuntu 18.10, the scaling factor can be found by installing Gnome Tweaks and then in the 'Fonts'.
-
Apoorv Potnis over 5 yearsAfter doing the changes you mentioned, the effects took place after I logged out and then logged in again. I also removed Google Chrome from favorites and then added it again.
-
Aubergine almost 5 years76.03 tweaking this setting in the mentioned file - zero effect. 18.04 , Mint 19.1 , you need to tweak ~/.local/share/applications/google-chrome.desktop
-
BradHards about 3 yearsI used these flags in my local
.bashrc
, which helped a lot using a snap installation of chromium-browser. -
DaVince about 3 yearsThe issue came back in recent Chrome versions for me and made the UI scaling absolutely massive - it was probably multiplying my KDE scaling of 2 with its own scaling factor of 2. Using the parameter mentioned in this answer to 2 fixes that.
-
cipricus about 3 yearsPlaying with the numerical scale-factor seems to me the best way to find the proper UI size: 0.8 will reduce, above 1.0 will increase it. On a hidpi laptop display (Kubuntu/Plasma desktop) the UI items were too small, so I use 1.3.
-
Seek Truth almost 3 yearsThis is commenting out incognito windows and should not be used. Recommend erasing this answer if possible.