Skip to content

Instantly share code, notes, and snippets.

@vordan
Created April 8, 2017 06:55
Show Gist options
  • Save vordan/9498f38c423a3d39dc815e61acdea8dc to your computer and use it in GitHub Desktop.
Save vordan/9498f38c423a3d39dc815e61acdea8dc to your computer and use it in GitHub Desktop.
Set monitor resolution on GDM start
As root:
--------------------------------------------------------------------------------
Generate monitor resolution string:
cvt 1680 1050 60
Sample output:
# 1680x1050 59.95 Hz (CVT 1.76MA) hsync: 65.29 kHz; pclk: 146.25 MHz
Modeline "1680x1050_60.00" 146.25 1680 1784 1960 2240 1050 1053 1059 1089 -hsync +vsync
--------------------------------------------------------------------------------
Find the outputs:
xrandr
Sample output:
DVI-I-1 connected primary 1680x1050+0+0 (normal left inverted right x axis y axis) 0mm x 0mm
VGA-1 connected 1680x1050+1680+0 (normal left inverted right x axis y axis) 474mm x 296mm
HDMI-1 disconnected (normal left inverted right x axis y axis)
--------------------------------------------------------------------------------
Copy the Modeline to clipboard and paste it as follows:
xrandr --newmode "1680x1050_60.00" 146.25 1680 1784 1960 2240 1050 1053 1059 1089 -hsync +vsync
--------------------------------------------------------------------------------
Setup the resolutions for outputs:
xrandr --addmode VGA-1 "1680x1050_60.00"
xrandr --output VGA-1 --mode "1680x1050_60.00"
xrandr --addmode DVI-I-1 "1680x1050_60.00"
xrandr --output DVI-I-1 --mode "1680x1050_60.00"
--------------------------------------------------------------------------------
To set resolution on GDM start:
cp .config/monitors.xml /var/lib/gdm/.config/
vi /etc/mdm/Init/Default
Look for the following lines:
PATH=/usr/bin:$PATH
OLD_IFS=$IFS
Add the following lines below them (depending on resolution):
xrandr --newmode "1680x1050_60.00" 146.25 1680 1784 1960 2240 1050 1053 1059 1089 -hsync +vsync
xrandr --addmode VGA-1 "1680x1050_60.00"
xrandr --output VGA-1 --mode "1680x1050_60.00"
xrandr --addmode DVI-I-1 "1680x1050_60.00"
xrandr --output DVI-I-1 --mode "1680x1050_60.00"
--------------------------------------------------------------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment