xrandr : another great open source utility

Posted: June 2, 2012 in Technology
Tags: , , , , ,

Few days back,some rightmost part of my laptop screen got dead. Though I am still looking for a fully fledged solution but in the process I learnt about this very cool utility “xrandr” from xorg. Having the problems with refresh rate, needs custom resolution not available in your GUI application, need to setup another screen for your PC,all these question can be answered by this utility. in earlier releases of Ubuntu, xorg used to supply an xorg.conf file inside /etc/X11 directory which had all these options to configure your system but from 11.10, they have configured the X server to autodetect the configurations for your system though you still can create your custom configuration by creating this file in /etc/X11 but for that you need to dig a lot for different configuration options. xrandr does a lot of that for you. For e.g. to change your system’s resolution to lets say 1072X800, follow the following steps :
jkapil@jkapil-pc:~$ xrandr
Screen 0: minimum 320 x 200, current 1280 x 800, maximum 8192 x 8192
LVDS1 connected 1280x800+0+0 (normal left inverted right x axis y axis) 303mm x 190mm
1280x800 60.0*+
1024x768 60.0
800x600 60.3 56.2
640x480 59.9
VGA1 disconnected (normal left inverted right x axis y axis)
HDMI1 disconnected (normal left inverted right x axis y axis)
DP1 disconnected (normal left inverted right x axis y axis)
DP2 disconnected (normal left inverted right x axis y axis)
jkapil@jkapil-pc:~$ cvt 1072 800
# 1072x800 59.83 Hz (CVT) hsync: 49.72 kHz; pclk: 70.00 MHz
Modeline "1072x800_60.00" 70.00 1072 1136 1240 1408 800 803 813 831 -hsync +vsync
jkapil@jkapil-pc:~$ xrandr --newmode "1072x800_60.00" 70.00 1072 1136 1240 1408 800 803 813 831 -hsync +vsync
jkapil@jkapil-pc:~$ xrandr --addmode LVDS1 1072x800_60.00
jkapil@jkapil-pc:~$ xrandr --output LVDS1 --mode 1072x800_60.00
jkapil@jkapil-pc:~$ xrandr -s 0

first command gives the details of available output displays and the resolution modes available (read already configured) for your system. It also reports the physical size of your screen. There is another utility “xdpyinfo” which also reports the detailed info. about your displays and some information reported may differ from xrandr output but I found the xrandr output as accurate.
next command reports the modeline for the resolution you want.
Next command uses the modeline reported in previous command to add another resolution configuration for your system. Next command associates this configuration to the particular display output. In my case its “LVDS1” which is generally the laptop screen. You can specify the other outputs also. In second last command we switch to that mode by specifying its name. last command brings back the first resolution on the array of resolutions configured (see first output). You can specify either the resolution mode name or the serial no. of the resolution mode in last command.
For multi monitor configuration, specifying the rotation technique, monitors positions w.r.t. each other etc. can also be configured using this. You can use manpage of xrandr to browse through the vast scope of the xrandr.
https://wiki.archlinux.org/index.php/Xrandr is a very good link to understand the various functionality of xrandr.
If you face any problems, you can anyways write to xorg here about your problems.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s