<?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>Blog Amain &#187; dual-monitor</title>
	<atom:link href="http://blog.zoomeren.nl/tag/dual-monitor/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.zoomeren.nl</link>
	<description>Open Source / Linux</description>
	<lastBuildDate>Fri, 21 May 2010 21:47:50 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Auto enable a gnome-panel for each connected monitor</title>
		<link>http://blog.zoomeren.nl/2010/03/05/a-gnome-panel-for-each-connected-monitor/</link>
		<comments>http://blog.zoomeren.nl/2010/03/05/a-gnome-panel-for-each-connected-monitor/#comments</comments>
		<pubDate>Thu, 04 Mar 2010 23:54:12 +0000</pubDate>
		<dc:creator>Amain</dc:creator>
				<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[dual-head]]></category>
		<category><![CDATA[dual-monitor]]></category>
		<category><![CDATA[gnome]]></category>
		<category><![CDATA[gnome-panel]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[multiple monitors]]></category>

		<guid isPermaLink="false">http://blog.zoomeren.nl/?p=135</guid>
		<description><![CDATA[In Gnome it is possible to have a gnome-panel for each monitor. This is very useful. One can create a new gnome-panel by pressing right-click on a existing gnome-panel ( make sure that when the entire gnome-panel space is filled with applets and programs you temporarily remove some applets or close some programs ). Click [...]]]></description>
			<content:encoded><![CDATA[<p>In Gnome it is possible to have a gnome-panel for each monitor. This is very useful. One can create a new gnome-panel by pressing right-click on a existing gnome-panel ( make sure that when the entire gnome-panel space is filled with applets and programs you temporarily remove some applets or close some programs ). Click &#8220;New panel&#8221; and a new panel will be created. Press-and-keep-pressed ALT and move the new gnome-panel with the mouse to the other monitor.</p>
<p>However, when not using one of the monitors, Gnome does not know what to do with the panel normally displayed on that monitor and places it on the default monitor, resulting in two gnome-panels on one monitor. This is not so useful! <img src='http://blog.zoomeren.nl/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>To circumvent this default Gnome behavior use the following procedure:</p>
<ul>
<li>Download <em>gnome-panel-switch.sh</em> script and put it somewhere you like:</li>
</ul>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># Auto adjust the number of pannels based on the number of</span>
<span style="color: #666666; font-style: italic;"># connected monitors.</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># Author : Amain 2010</span>
<span style="color: #666666; font-style: italic;"># Website: blog.zoomeren.nl</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Monitor states:</span>
<span style="color: #666666; font-style: italic;">#   - connected 1440x900+0+0  ( connected and used )</span>
<span style="color: #666666; font-style: italic;">#   - connected               ( connected not used )</span>
<span style="color: #666666; font-style: italic;">#   - disconnected            ( disconnected       )</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #007800;">NR_OF_MONITORS</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>xrandr <span style="color: #660033;">-q</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #ff0000;">&quot; connected [0-9]\+x[0-9]\+&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">wc</span> <span style="color: #660033;">-l</span> <span style="color: #7a0874; font-weight: bold;">&#41;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Second panel name</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># note: retrieve the panel name using gconf-editor</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #007800;">SECOND_PANEL_NAME</span>=<span style="color: #ff0000;">&quot;panel_0&quot;</span>     
&nbsp;
<span style="color: #000000; font-weight: bold;">case</span> <span style="color: #007800;">$NR_OF_MONITORS</span> <span style="color: #000000; font-weight: bold;">in</span>
        <span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
                <span style="color: #666666; font-style: italic;"># Disable external monitor ( setting screen to -1 )</span>
                <span style="color: #666666; font-style: italic;">#</span>
                gconftool-<span style="color: #000000;">2</span> <span style="color: #660033;">--type</span> int <span style="color: #660033;">--set</span>  <span style="color: #000000; font-weight: bold;">/</span>apps<span style="color: #000000; font-weight: bold;">/</span>panel<span style="color: #000000; font-weight: bold;">/</span>toplevels<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$SECOND_PANEL_NAME</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">screen</span> <span style="color: #660033;">--</span> <span style="color: #660033;">-1</span>
        <span style="color: #000000; font-weight: bold;">;;</span>
&nbsp;
        <span style="color: #000000;">2</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
                <span style="color: #666666; font-style: italic;"># Enable external monitor ( restart is needed after setting screen to -1 )</span>
                <span style="color: #666666; font-style: italic;">#</span>
                gconftool-<span style="color: #000000;">2</span> <span style="color: #660033;">--type</span> int <span style="color: #660033;">--set</span>  <span style="color: #000000; font-weight: bold;">/</span>apps<span style="color: #000000; font-weight: bold;">/</span>panel<span style="color: #000000; font-weight: bold;">/</span>toplevels<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$SECOND_PANEL_NAME</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">screen</span> <span style="color: #000000;">0</span>
                <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">killall</span> gnome-panel
        <span style="color: #000000; font-weight: bold;">;;</span>
&nbsp;
        <span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
                <span style="color: #666666; font-style: italic;"># no action</span>
        <span style="color: #000000; font-weight: bold;">;;</span>
<span style="color: #000000; font-weight: bold;">esac</span></pre></div></div>

<ul>
<li>sudo chmod +x <em>gnome-panel-switch.sh</em></li>
<li>sudo mv /usr/bin/gnome-display-properties /usr/bin/gnome-display-properties.bin</li>
<li>sudo vi /usr/bin/gnome-display-properties and paste the following script ( don&#8217;t forget to adjust the path in line where gnome-panel-switch.sh is called! ):</li>
</ul>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># Auto adjust the number of pannels based on the number of</span>
<span style="color: #666666; font-style: italic;"># connected monitors.</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># Author : Amain 2010</span>
<span style="color: #666666; font-style: italic;"># Website: blog.zoomeren.nl</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Open gnome-display-properties dialog</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>gnome-display-properties.bin
&nbsp;
<span style="color: #666666; font-style: italic;"># Auto enable/disable gnome-panels</span>
<span style="color: #666666; font-style: italic;">#</span>
YOURPATH<span style="color: #000000; font-weight: bold;">/</span>gnome-panel-switch.sh</pre></div></div>

<ul>
<li>sudo chmod +x /usr/bin/gnome-display-properties</li>
<li>Start gnome-panel-switch.sh every time Gnome starts to auto disable/enable the correct number of gnome-panels per display. Use Gnome Startup in the System Settings menu and add the invocation for this script.</li>
<li>Important note: when /usr/bin/gnome-display-properties is replaced during a Ubuntu upgrade one looses the changes!</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.zoomeren.nl/2010/03/05/a-gnome-panel-for-each-connected-monitor/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
