Skip to content

Instantly share code, notes, and snippets.

@ymollard
Last active September 25, 2024 12:02
Show Gist options
  • Save ymollard/8adcef9653c892333e2c to your computer and use it in GitHub Desktop.
Save ymollard/8adcef9653c892333e2c to your computer and use it in GitHub Desktop.
Set the screen to a custom resolution with xrandr
# 1. Select first the resolution you would like to get the modeline (preferably the screen native resolution)
$ cvt 1920 1080
# 1920x1080 59.96 Hz (CVT 2.07M9) hsync: 67.16 kHz; pclk: 173.00 MHz
Modeline "1920x1080_60.00" 173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync
# 2. Identify your screen name (here VGA-0 with a low res)
$ xrandr
Screen 0: minimum 8 x 8, current 2560 x 1080, maximum 16384 x 16384
VGA-0 connected 640x480+1920+0 (normal left inverted right x axis y axis) 0mm x 0mm
640x480 59.9*+
320x240 60.1
DP-0 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 344mm x 194mm
1920x1080 60.0*+ 40.0
# 3. Create a new mode by pasting the modeline got at step 1
$ xrandr --newmode "1920x1080_60.00" 173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync
# 4. Add this new mode to the identified screen using its string id
xrandr --addmode VGA-0 "1920x1080_60.00"
# 5. Enable this mode now!
xrandr --output VGA-0 --mode "1920x1080_60.00"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment