Skip to content

Instantly share code, notes, and snippets.

@sohailshaukat
Last active July 12, 2024 23:42
Show Gist options
  • Save sohailshaukat/68fbf86ed8375c94a7a9e1c342897f81 to your computer and use it in GitHub Desktop.
Save sohailshaukat/68fbf86ed8375c94a7a9e1c342897f81 to your computer and use it in GitHub Desktop.
Linux Screen Resolution Change script
gtf 1920 1080 60
xrandr --newmode "1920x1080_60.00" 172.80 1920 2040 2248 2576 1080 1081 1084 1118 -HSync +Vsync
xrandr --addmode Virtual1 "1920x1080_60.00"
xrandr --output Virtual1 --mode "1920x1080_60.00"
@sohailshaukat
Copy link
Author

sohailshaukat commented Jul 4, 2019

This script can be used to change the screen resolution of any linux based system to 1920x1080.

For 1920x1080

You can either download the res-change.sh file and execute it in terminal by doing
./res-change.sh
or you can execute each line individually on terminal.

For any other resolution

If you want any other resolution than execute gtf command with desired resolution for example for 1280x720 for 60hz frame rate command would be:
gtf 1280 720 60
this will output something like this:
# 1280x720 @ 60.00 Hz (GTF) hsync: 44.76 kHz; pclk: 74.48 MHz Modeline "1280x720_60.00" 74.48 1280 1336 1472 1664 720 721 724 746 -HSync +Vsync
from this output copy the text after Modeline i.e.
"1280x720_60.00" 74.48 1280 1336 1472 1664 720 721 724 746 -HSync +Vsync
and execute "xrandr --newmode (copied content)" eg:
xrandr --newmode "1280x720_60.00" 74.48 1280 1336 1472 1664 720 721 724 746 -HSync +Vsync
and then add this new mode to the screen name, screen name for me was Virtual1 and keep the name for the new mode as the resolution and hence for me it was
Screenshot from 2019-07-04 21-03-06

xrandr --addmode Virtual1 "1280x720_60.00"
your screen name could be default hence it would be
xrandr --addmode Default "1280x720_60.00"
finally to apply this mode
xrandr --output Virtual1 --mode "1280x720_60.00"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment