6

I'm using Ubuntu 20.04 with Linux Kernel 5.7.10-050710-generic and GNOME Shell 3.36.3.

I have set font scaling factor to 1.25 but lately when I restart while the scaling factor lasts to the UI, it is not applyed to gnome shell.

To make it work again I have to manually reset it to 1.25 again.

Any suggestions?

Luca
  • 163
  • 6
  • Does is work correctly when using a Ubuntu supported kernel? – guiverc Jul 26 '20 at 10:36
  • 1
    @guiverc No, it doesn't. It used to work though. So It's either a component of gnome shell updated the problem or some broken configs. I should try to clean install ubuntu and see. – Luca Jul 26 '20 at 11:18
  • Exact same thing started happening to me last week. Not just on restart, but on waking from sleep, and logging out/in. – Lexible Jul 30 '20 at 15:07
  • @Lexible I'm glad I'm not the only one . – Luca Jul 30 '20 at 15:31
  • Caveat: I am using the low-latency kernel – Lexible Jul 30 '20 at 16:00
  • 1
    It's a bug in mutter package after a recent update: https://bugs.launchpad.net/ubuntu/+source/mutter/+bug/1892440 See also this askubuntu dicussion where some workaround have been provided (waiting for a package update): https://askubuntu.com/questions/1269090/ubuntu-20-04-interface-font-too-small-after-restart-even-with-high-scaling-fact – Lorenz Keel Aug 24 '20 at 07:20

1 Answers1

5

I experience this too, with fresh Ubuntu 20.04 installation. I see the root cause of this was found ( https://bugs.launchpad.net/ubuntu/+source/mutter/+bug/1892440 ).

I can offer my workaround: add to autostart a trivial command that explicitly sets the "text scaling factor" after login. This change will be correctly noticed by the GNOME shell, making the GNOME shell text correctly scaled.

To do this, create a file $HOME/.config/autostart/fix-font-scaling.desktop with this content:

[Desktop Entry]
Name=Fix Font Scaling
GenericName=Fix Font Scaling
Exec=/home/michalis/bin/fix-font-scaling.sh
Terminal=false
Type=Application
StartupNotify=false
X-GNOME-Autostart-enabled=true

Where /home/michalis/bin/ is just an example, it's where I keep the script.

Then make a script /home/michalis/bin/fix-font-scaling.sh with contents like this:

#!/bin/bash
set -eu

wait a bit, otherwise the change seems to not be noticed properly

sleep 1s

change to 1.5 then to 1.25, it seems necessary for GNOME shell to register this "change"

gsettings set org.gnome.desktop.interface text-scaling-factor 1.5 gsettings set org.gnome.desktop.interface text-scaling-factor 1.25

Make it executable (chmod +x /home/michalis/bin/fix-font-scaling.sh).

And adjust the 1.25 above as needed.

Note that this overrides the text scaling you have set by settings ("Accessibility -> Large Text", or GNOME tweak tool "text scaling").


Note: what does set -eu do?

It makes writing bash scripts safer, so I learned to use this automatically in all my bash scripts :)

It's a shortcut for set -e and set -u.

  • The set -e means that a bash script will exit with non-zero status as soon as some command exits with non-zero status. E.g. if sleep command fails for any weird reason, then following gsettings calls will not be done. Without set -e, bash scripts happily continue their execution, even when something along the way reported failure.

  • The set -u means that the script fails when you try to use an undefined variable, like echo ${SOMETHING_UNDEFINED}. So set -u allows to catch errors in the script easier. It has no effect in this particular script that uses no variables :) It's was just my force of habit to use it.

There's a great article discussing this (and some related) bash constructs, to make bash scripts easier to write/debug, on http://redsymbol.net/articles/unofficial-bash-strict-mode/ .

  • +1 Thank you so much! Can you explain what the set -eu portion of the script is doing? Thank you again. – Lexible Sep 19 '20 at 18:30
  • 1
    It makes writing bash scripts more reliable. set -eu means that a script will stop execution when a command (like sleep) reports failure, and also any usage of undefined variables will stop the execution. I added a longer explanation of it to my answer above, and there's a great article explaining it in even more detail on http://redsymbol.net/articles/unofficial-bash-strict-mode/ ;) – Michalis Kamburelis Sep 22 '20 at 22:01