Fixing screen resolution on Linux with xrandr

Not the best start of the week today.  For some weird reason my desktop’s screen resolution crashed into a safe 1024×768 mode today.  No updates, no changes in configuration, not even a reboot – just in the middle of the working morning.  I’ve tried to fix it to no avail, installed updates, and even rebooted.  Nothing seemed to help.  Google to the rescue, and I find this handy page that shows step by step how to use xrandr to fix things.  I knew about xrandr for a few years now, but it’sbeen decades since I had to use it, so I’m rusty.  15 seconds later I have the following script ready:

#!/bin/bash

#gtf 1280 1024 60
xrandr --newmode "1280x1024_60.00"  108.88  1280 1360 1496 1712  1024 1025 1028 1060  -HSync +Vsync
xrandr --addmode VGA1 1280x1024_60.00
xrandr --output VGA1 --mode 1280x1024_60.00

Run it once and all is back to normal. In fact, after a few minutes in 1024×768 mode, it feels like I have a better monitor now than I used to. They say, you need to lose something to really appreciate what you have. Until today I thought I had a crappy old monitor. But just a few minutes in a lower resolution make me appreciate it a lot now.

Leave a Comment