Quickly Switch Screen Resolution in Gnome

Menu

During the lockdow I started using my laptop’s screen, rather than the external monitor I have at work. It wasn’t easy at the beginning, but it ended up becoming a habit.

On a 15“ monitor screen estate is precious, but HiDPI resolutions are tiring for the eye. Thus I started switching resolution to accommodate the task at hand: more screen when I develop web applications, lower resolution and bigger fonts when I read e-mail or write.

To switch quickly resolutions in Gnome I have the following setup:

  1. I run Gnome on X11, so that I can use xrandr. Wayland does not seem to have something similar.
  2. I defined a set of aliases to change resolution from the command line (see below)
  3. I defined a set of “Keyboards Shortcuts” (Gnome > Settings > Keyboard Shortcuts) to change resolution using the keyboard (see below).

If you want to try the same setup, put in your /.bash_profile something like, adapting display name and screen resolutions to your case1:

alias zoom1="xrandr --output eDP-1 --mode 1920x1080"
alias zoom2="xrandr --output eDP-1 --mode 2048x1152"
alias zoom3="xrandr --output eDP-1 --mode 2560x1440"
alias zoom4="xrandr --output eDP-1 --mode 2880x1620"
alias zoom5="xrandr --output eDP-1 --mode 3200x1800"
alias zoom6="xrandr --output eDP-1 --mode 3840x2160"

If you prefer working with the keyboard, use the “Keyboard Shortcuts” pane of the Gnome Settings.

GnomeSettings-KeyboardShortcuts.png

This is not the only solution, of course: a similar result can be obtained using:

  1. The Zoom factor and enabling fractional scaling.
  2. The Scaling Factor, which can be set using Gnome Tweaks or gsettings, from the command line
  3. The variable GDK_SCALE, to scale a single application, like, for instance in the following command: GDK_SCALE=2 thunderbird

The ArchWiki, as usual, explains the various options in details, see the HiDPI page.

A final note on customizing screen resolutions to your needs. You can get the resolutions which best fit your monitor with xrandr or, better, using the “Displays” pane in the Gnome Settings, which has the advantage of reporting also the screen ratio. The name of the display can be gotten using xrandr

GnomeSettings-Displays.png

Footnotes:

1

… and, if you are wondering, I am aware that the naming convention is probably the opposite of what it should be.

Author: Adolfo Villafiorita

Last modified: 2020-10-05 Mon 14:04 (created on: 2020-10-05 Mon 00:00)

Published: 2020-10-23 Fri 17:04