<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.thinkwiki.org/w/index.php?action=history&amp;feed=atom&amp;title=Automatic_Display_Switching_on_Resume</id>
	<title>Automatic Display Switching on Resume - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://www.thinkwiki.org/w/index.php?action=history&amp;feed=atom&amp;title=Automatic_Display_Switching_on_Resume"/>
	<link rel="alternate" type="text/html" href="https://www.thinkwiki.org/w/index.php?title=Automatic_Display_Switching_on_Resume&amp;action=history"/>
	<updated>2026-05-23T01:16:40Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.31.12</generator>
	<entry>
		<id>https://www.thinkwiki.org/w/index.php?title=Automatic_Display_Switching_on_Resume&amp;diff=48693&amp;oldid=prev</id>
		<title>Gettalong15: /* Automatic Display Switching on Resume */</title>
		<link rel="alternate" type="text/html" href="https://www.thinkwiki.org/w/index.php?title=Automatic_Display_Switching_on_Resume&amp;diff=48693&amp;oldid=prev"/>
		<updated>2010-05-31T17:25:37Z</updated>

		<summary type="html">&lt;p&gt;‎&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Automatic Display Switching on Resume&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;Revision as of 17:25, 31 May 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l3&quot; &gt;Line 3:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 3:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;I have a T410s and a Mini Dock 3 Plus and wanted Ubuntu 10.04 to automatically switch to the external monitor on resume if it is connected. However, gnome-power-manager and gnome-display-manager can't do this correctly currently and therefore I have written a script to automate this.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;I have a T410s and a Mini Dock 3 Plus and wanted Ubuntu 10.04 to automatically switch to the external monitor on resume if it is connected. However, gnome-power-manager and gnome-display-manager can't do this correctly currently and therefore I have written a script to automate this.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The following script should be saved in the file &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;{{&lt;/del&gt;/etc/pm/sleep.d/10_activate_monitor&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;}} &lt;/del&gt;and does the following on resume:&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The following script should be saved in the file &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;tt&amp;gt;&lt;/ins&gt;/etc/pm/sleep.d/10_activate_monitor&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;/tt&amp;gt; &lt;/ins&gt;and does the following on resume:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* If any external monitor is attached, activate it (the first monitor from the list &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;{{&lt;/del&gt;EXTERNALS&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;}}&lt;/del&gt;), and disable the internal monitor if the lid is closed.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* If any external monitor is attached, activate it (the first monitor from the list &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;tt&amp;gt;&lt;/ins&gt;EXTERNALS&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;/tt&amp;gt;&lt;/ins&gt;), and disable the internal monitor if the lid is closed.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* If no external monitor is attached, activate the internal monitor.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* If no external monitor is attached, activate the internal monitor.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key c1thinkwiki:diff::1.12:old-48692:rev-48693 --&gt;
&lt;/table&gt;</summary>
		<author><name>Gettalong15</name></author>
		
	</entry>
	<entry>
		<id>https://www.thinkwiki.org/w/index.php?title=Automatic_Display_Switching_on_Resume&amp;diff=48692&amp;oldid=prev</id>
		<title>Gettalong15: â†Created page with '= Automatic Display Switching on Resume =  I have a T410s and a Mini Dock 3 Plus and wanted Ubuntu 10.04 to automatically switch to the external monitor on resume if it is...'</title>
		<link rel="alternate" type="text/html" href="https://www.thinkwiki.org/w/index.php?title=Automatic_Display_Switching_on_Resume&amp;diff=48692&amp;oldid=prev"/>
		<updated>2010-05-31T17:10:22Z</updated>

		<summary type="html">&lt;p&gt;â†Created page with &amp;#039;= Automatic Display Switching on Resume =  I have a T410s and a Mini Dock 3 Plus and wanted Ubuntu 10.04 to automatically switch to the external monitor on resume if it is...&amp;#039;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= Automatic Display Switching on Resume =&lt;br /&gt;
&lt;br /&gt;
I have a T410s and a Mini Dock 3 Plus and wanted Ubuntu 10.04 to automatically switch to the external monitor on resume if it is connected. However, gnome-power-manager and gnome-display-manager can't do this correctly currently and therefore I have written a script to automate this.&lt;br /&gt;
&lt;br /&gt;
The following script should be saved in the file {{/etc/pm/sleep.d/10_activate_monitor}} and does the following on resume:&lt;br /&gt;
&lt;br /&gt;
* If any external monitor is attached, activate it (the first monitor from the list {{EXTERNALS}}), and disable the internal monitor if the lid is closed.&lt;br /&gt;
* If no external monitor is attached, activate the internal monitor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
. /usr/share/acpi-support/power-funcs&lt;br /&gt;
&lt;br /&gt;
INTERNAL=&amp;quot;LVDS1&amp;quot;&lt;br /&gt;
EXTERNALS=&amp;quot;VGA1 HDMI1 DP1 HDMI2 HDMI3 DP2 DP3&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
case &amp;quot;$1&amp;quot; in&lt;br /&gt;
        thaw|resume)&lt;br /&gt;
		for x in /tmp/.X11-unix/*; do&lt;br /&gt;
		    displaynum=`echo $x | sed s#/tmp/.X11-unix/X##`&lt;br /&gt;
		    getXuser;&lt;br /&gt;
&lt;br /&gt;
		    grep -q closed /proc/acpi/button/lid/*/state&lt;br /&gt;
		    LID_CLOSED=$?&lt;br /&gt;
&lt;br /&gt;
		    if [ x&amp;quot;$XAUTHORITY&amp;quot; != x&amp;quot;&amp;quot; ]; then&lt;br /&gt;
		        export DISPLAY=&amp;quot;:$displaynum&amp;quot;&lt;br /&gt;
&lt;br /&gt;
		    	INTERNAL_STATE=$(xrandr | grep ^$INTERNAL | grep &amp;quot; con&amp;quot; | sed &amp;quot;s/.*connected//&amp;quot; | sed &amp;quot;s/ //&amp;quot; | sed &amp;quot;s/ .*//g&amp;quot;)&lt;br /&gt;
		    	for I in $EXTERNALS; do&lt;br /&gt;
		    		EXTERNAL=$I&lt;br /&gt;
		    		EXTERNAL_STATE=$(xrandr | grep ^$EXTERNAL | grep &amp;quot; con&amp;quot; | sed &amp;quot;s/.*connected//&amp;quot; | sed &amp;quot;s/ //&amp;quot; | sed &amp;quot;s/ .*//g&amp;quot;)&lt;br /&gt;
		    		if [ ! \( -z &amp;quot;$EXTERNAL_STATE&amp;quot; \) ]; then break; fi&lt;br /&gt;
		    	done&lt;br /&gt;
&lt;br /&gt;
		    	logger -t &amp;quot;pm-utils-custom-display&amp;quot; &amp;quot;$INTERAL -- $INTERNAL_STATE :: $EXTERNAL -- $EXTERNAL_STATE&amp;quot;&lt;br /&gt;
			if [ ! \( -z &amp;quot;$EXTERNAL_STATE&amp;quot; \) ]; then&lt;br /&gt;
				logger -t &amp;quot;pm-utils-custom-display&amp;quot; &amp;quot;Activating external display&amp;quot;&lt;br /&gt;
				if [ $LID_CLOSED = 0 ]; then xrandr --output $INTERNAL --off; fi&lt;br /&gt;
				xrandr --output $EXTERNAL --auto&lt;br /&gt;
			else&lt;br /&gt;
				logger -t &amp;quot;pm-utils-custom-display&amp;quot; &amp;quot;Activating internal display&amp;quot;&lt;br /&gt;
				xrandr --output $INTERNAL --auto&lt;br /&gt;
				xrandr --output $EXTERNAL --off&lt;br /&gt;
			fi&lt;br /&gt;
		    fi&lt;br /&gt;
		done&lt;br /&gt;
                ;;&lt;br /&gt;
        *) exit $NA&lt;br /&gt;
                ;;&lt;br /&gt;
esac&lt;br /&gt;
&lt;br /&gt;
exit 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Gettalong15</name></author>
		
	</entry>
</feed>