<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Adrian's Thoughts &#187; X</title>
	<atom:link href="http://blog.frith.co.za/tag/x/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.frith.co.za</link>
	<description>Ramblings about life, university, mathematics, computing, Linux, open source, etc.</description>
	<lastBuildDate>Thu, 19 Mar 2009 10:23:21 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>XRandR &#8211; finally, simple monitor configuration for Linux</title>
		<link>http://blog.frith.co.za/2007/12/06/xrandr-finally-simple-monitor-configuration-for-linux/</link>
		<comments>http://blog.frith.co.za/2007/12/06/xrandr-finally-simple-monitor-configuration-for-linux/#comments</comments>
		<pubDate>Thu, 06 Dec 2007 00:05:00 +0000</pubDate>
		<dc:creator>adrian</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[Graphics]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[monitor]]></category>
		<category><![CDATA[X]]></category>
		<category><![CDATA[xrandr]]></category>

		<guid isPermaLink="false">http://blog.frith.co.za/2007/12/06/xrandr-finally-simple-monitor-configuration-for-linux/</guid>
		<description><![CDATA[The most recent Linux distribution releases &#8211; Ubuntu 7.10, Fedora 8 and so on &#8211; are now shipping with version 1.2 of the XRandR extension for the X server. This allows the user to dynamically change resolutions, refresh rates, and &#8211; this is the really impressive thing &#8211; switch monitors on and off on the [...]]]></description>
			<content:encoded><![CDATA[<p>The most recent Linux distribution releases &#8211; Ubuntu 7.10, Fedora 8 and so on &#8211; are now shipping with version 1.2 of <a href="http://www.x.org/wiki/Projects/XRandR">the XRandR extension</a> for the X server. This allows the user to dynamically change resolutions, refresh rates, and &#8211; this is the really impressive thing &#8211; switch monitors on and off on the fly. All of this, without ever having to edit <code>xorg.conf</code>, or restart the X server, or reboot. This was one of the major things that the Linux desktop lacked compared to other major operating systems.</p>
<p>Until very recently, using my external monitor with my laptop required several irritating customisations &#8211; you can see the details in <a href="http://blog.frith.co.za/2006/12/17/ubuntu-widescreen-monitor-radeon-aiglx-beryl/">my earlier post</a>:</p>
<ol>
<li>To have it switch on, and run in Xinerama mode along with my laptop panel, required fiddling with MetaModes and other fiddly settings of the <code>radeon</code> driver.</li>
<li>To drive it at its native resoution (1440&#215;900) i had to add a custom modeline to <code>xorg.conf</code> (except on Fedora, for some reason).</li>
<li>If the X server originally started without the external monitor attached, then it would have to be restarted to detect the monitor once it was attached. And restarting X means having to log out and lose all my application state.</li>
</ol>
<p>XRandR 1.2 has removed all three of these irritations. It requires (almost) no preconfiguration, autodetects all resolutions correctly, and detects monitors when they are plugged in without a restart.</p>
<p>Let&#8217;s take a brief look at some of what XRandR can do: this is basically what I do with it daily. Note that at the moment graphical tools to control XRandR are still under development and none are really at a releaseable state (in my opinion); but now that the infrastructure exists in the X server and the drivers, tools to control it will come soon. What I use here is the command-line tool, sensibly named <code>xrandr</code>.<span id="more-25"></span></p>
<p>Let&#8217;s say I boot the computer without the external monitor plugged in. As you would expect, my desktop is automatically set to the native resolution of the laptop panel (in my case, 1024&#215;768). I can see what resolutions and refresh rates are available:</p>
<blockquote><p><code>$ <em>xrandr -q</em><br />
Screen 0: minimum 320 x 200, current 1024 x 768, maximum 2464 x 1024<br />
VGA-0 disconnected (normal left inverted right x axis y axis)<br />
DVI-0 disconnected (normal left inverted right x axis y axis)<br />
LVDS connected 1024x768+0+0 (normal left inverted right x axis y axis) 0mm x 0mm<br />
&nbsp;&nbsp;&nbsp;1024x768       60.0*+   60.0<br />
&nbsp;&nbsp;&nbsp;800x600        60.3<br />
&nbsp;&nbsp;&nbsp;640x480        59.9<br />
S-video disconnected (normal left inverted right x axis y axis)</code></p></blockquote>
<p>This tells me that the only attached monitor is the laptop panel (called LVDS); that it can run at the three different resolutions listed, and at the refresh rates listed next to the resolutions. The &#8220;<code>*</code>&#8221; indicates the mode that is currently in use, and the &#8220;<code>+</code>&#8221; indicates which mode is preferred by the monitor.</p>
<p>If i wanted to, I could switch to some other resolution:</p>
<blockquote><p><code>$ <em>xrandr --output LVDS --mode 800x600</em></code></p></blockquote>
<p>But that looks horrible, so I switch back to the preferred resolution:</p>
<blockquote><p><code>$ <em>xrandr --output LVDS --auto</em></code></p></blockquote>
<p>Now everything&#8217;s back to normal. There are various rotation and reflection options as well, but I won&#8217;t discuss them because (a) they&#8217;re silly, and (b) you can look them up in the man page if you need them.</p>
<p>Here comes the interesting part. Now I plug in my external monitor. Nothing happens immediately; but if I run the query command, there&#8217;s some new information:</p>
<blockquote><p><code>$ <em>xrandr -q</em><br />
Screen 0: minimum 320 x 200, current 1024 x 768, maximum 2464 x 1024<br />
VGA-0 connected (normal left inverted right x axis y axis)<br />
&nbsp;&nbsp;&nbsp;1440x900       59.9 +   75.0     59.9<br />
&nbsp;&nbsp;&nbsp;1280x1024      75.0     59.9<br />
&nbsp;&nbsp;&nbsp;1280x960       74.9<br />
&nbsp;&nbsp;&nbsp;1360x765       59.8<br />
&nbsp;&nbsp;&nbsp;1152x864       74.8     60.0<br />
&nbsp;&nbsp;&nbsp;1024x768       75.1     70.1     65.7     60.0<br />
&nbsp;&nbsp;&nbsp;832x624        74.6<br />
&nbsp;&nbsp;&nbsp;800x600        72.2     75.0     60.3     56.2<br />
&nbsp;&nbsp;&nbsp;640x480        75.0     72.8     66.7     60.0<br />
&nbsp;&nbsp;&nbsp;720x400        70.1<br />
DVI-0 disconnected (normal left inverted right x axis y axis)<br />
LVDS connected 1024x768+0+0 (normal left inverted right x axis y axis) 0mm x 0mm<br />
&nbsp;&nbsp;&nbsp;1024x768       60.0*+   60.0<br />
&nbsp;&nbsp;&nbsp;800x600        60.3<br />
&nbsp;&nbsp;&nbsp;640x480        59.9<br />
S-video disconnected (normal left inverted right x axis y axis)</code></p></blockquote>
<p>So I can now see all the modes supported by the external monitor (called VGA-0). I switch the monitor on:</p>
<blockquote><p><code>$ <em>xrandr --output VGA-0 --auto</em></code></p></blockquote>
<p>This switches on the monitor in a sort-of clone mode: the output from the laptop panel is duplicated on the external monitor; but because the external monitor is larger, it appears in the top left, and the desktop size expands to the size of the external monitor. (At the moment, GNOME doesn&#8217;t handle this too well, and the GNOME panel stays in the same place, meaning that it&#8217;s in the middle of what&#8217;s visible on the external monitor.) So now I can switch off the laptop panel:</p>
<blockquote><p><code>$ <em>xrandr --output LVDS --off</em></code></p></blockquote>
<p>(GNOME handles this correctly and moves the panel.)</p>
<p>Now, if you look at the query output above, you&#8217;ll see that the monitor claims that its preferred mode has a refresh rate of 59.9Hz, although it also supports a 75Hz mode at the same resolution. I find the latter mode more friendly on my eyes, so I switch to it:</p>
<blockquote><p><code>$ <em>xrandr --output VGA-0 --mode 1440x900 --rate 75.0</em></code></p></blockquote>
<p>I want to use the extra desktop space available on my laptop panel; but by default it would just be cloning the output of the external monitor, which wouldn&#8217;t help. So I use another option to position the outputs:</p>
<blockquote><p><code>$ <em>xrandr --output LVDS --auto --left-of VGA-0</em></code></p></blockquote>
<p>This places the panel to the left of the external monitor. There are corresponding <code>--right-of</code>, <code>--above</code> and <code>--below</code> options.</p>
<p>Finally, I want to switch off the external monitor so that I can take my laptop away from the desk:</p>
<blockquote><p><code>$ <em>xrandr --output VGA-0 --off</em></code></p></blockquote>
<p>Now I&#8217;m back where I started.</p>
<p>This is all very cool, but there are a couple of cautionary notes. The necessary drivers are only included in very recent distro releases (Ubuntu 7.10 and Fedora 8 in particular). Currently only the open-source Intel, Radeon and NV drivers support XRandR 1.2; neither the ATi nor the NVIDIA proprietary drivers support it. For now, you pretty much have to use the command-line tool &#8211; though that will change quickly. Finally, you sometimes have to set the <code>Virtual</code> option in <code>xorg.conf</code> to indicate the largest possible size of your desktop &#8211; but this is a one-off setting, and I hope that distros will start setting it to a sensible default automatically.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.frith.co.za/2007/12/06/xrandr-finally-simple-monitor-configuration-for-linux/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
