keyboard-shortcutsscreen-resolutionubuntu-24.04

Ubuntu 24.04 - Keyboard shortcut to change display resolution


Is it possible to easily change resolution on Ubuntu 24.04 with keyboard shortcuts?

I use some older CAD applications that unfortunately do not scale well to my 5120x2160 res and the small fonts are killing me. Whenever I run those applications, I have to go into Settings >> Display >> Resolution and choose 2560x1080 (then also click on "Keep resolution" etc).

Any shortcuts or quicker solutions are much appreciated.

Thanks

enter image description here


Solution

  • You can use xrandr to change your screen's resolution with a cli. You can launch commands using custom keyboard shortcuts.

    This only works on X11. You will need to switch if you are on Wayland.

    1. Open terminal.
    2. Type xrandr. You should see a list of supported resolutions.
    3. Type xrandr | awk '/ connected/ {print $1}'. Note down your monitor's name.
    4. Type xrandr --output <your-display-name> --mode <resolution>. This should change your resolution.
    5. Open Setting -> Keyboard -> View and Customize Shorcuts -> Custom Shortcuts -> Add Shortcut.
    6. Give it a name, paste the previous command and set a custom keystroke combination.

    You will have to set two shortcuts to lower and reset your resolution.

    Example:

    xrandr --output eDP-1-0 --mode 1920x1080