[ltp] Dual monitor setup: T40p+XFree-4.3.0

Klaus Weidner linux-thinkpad@linux-thinkpad.org
Wed, 5 Nov 2003 17:35:59 -0600


--uAKRQypu60I7Lcqm
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Wed, Nov 05, 2003 at 01:38:35PM -0800, pete hilton wrote:
> The only caveat is that I have not been able to get X to behave if you
> start it expecting two displays and only have one.

I have a different approach, which allows you to dymamically add and
remove the second monitor without reconfiguring or restarting anything.
It's a bit hackish, but works well for my purposes.

First get the software you need:
	apt-get install x2vnc vncviewer

My XF86Config-4 is attached, important is the "ServerLayout" section that
refers to the two screens - and of course the two screens also need to be
configured:

Section "ServerLayout"
        Identifier      "indep"
        Screen      0 "LCD"
        Screen      1 "VGA"
        InputDevice     "Generic Keyboard"
        InputDevice     "Configured Mouse"
        InputDevice     "Generic Mouse"
        Option "Xinerama" "false"
EndSection

I do *not* use Xinerama, instead this configures two completely separate
screens (:0.0 and :0.1). If you do a normal "startx", you'll get your
window manager and apps running completely on the builtin LCD, and the
second screen (external monitor connected to VGA port) shows just the
default gray X background. You won't be able to send mouse or keyboard
events to this second screen yet.

Now start a VNC server in the background:

        vncserver -geometry 1024x768 :3

put a fullscreen VNC client on the external screen:

        xvncviewer -nocursorshape -shared -fullscreen -display :0.1 :3

and connect them:

        x2vnc -shared -east localhost:3

Move the mouse off the right edge of the LCD ("-east") to send input to
the apps running on the external screen. If there aren't any, launch
them, i.e.:
	xterm -display :0.1 &
	icewm -display :0.1 &

Advantages of this approach:

- the desktops are completely independent. You can't move windows between
  the screens, but instead you can run different window managers with
  independent virtual desktops on each, which I prefer. Resource hogs
  (i.e. Notes under Wine) tie up only one of your X servers. You could
  even run the Xvnc under a separate user ID for security, i.e. a web
  browser that can't get at your other files.

- if you disconnect the external monitor, get your applicatins back onto
  the main screen using "xvncviewer -shared :3", and continue using them
  normally.

- it's nice for slides or other presentations - run "xvncviewer -shared
  :3" on the internal screen, and you get a copy of the external one,
  including the mouse pointer, on your LCD. If your LCD has a higher
  resolution than the projector, you have space around the screen copy
  for notes, a shell prompt, and other things. If you temporarily need
  more space, you can cover up or minimize the copy window without
  affecting what the projector is displaying.

- runs well with icewm and other non-Xinerama-aware window managers, and
  you never get popup windows split across both your monitors or in dead
  areas.

- run movies fullscreen with mplayer on either monitor, using hardware
  scaling:
	mplayer -fs FILE.mpg 
	mplayer -fs -display :0.1 FILE.mpg
  or as picture-in-picture (one corner of the external display shows a
  movie, the mouse and apps stay behind it):
  	mplayer -geometry +0+0 -display :0.1 FILE.mpg

I'd welcome feedback on this, if there's enough interest I'll do a longer
writeup and put it on my web page.

-Klaus

--uAKRQypu60I7Lcqm
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=XF86Config-4

#### BEGIN DEBCONF SECTION
# XF86Config-4 (XFree86 server configuration file) generated by dexconf, the
# Debian X Configuration tool, using values from the debconf database.
#
# Edit this file with caution, and see the XF86Config-4 manual page.
# (Type "man XF86Config-4" at the shell prompt.)
#
# If you want your changes to this file preserved by dexconf, only make changes
# before the "### BEGIN DEBCONF SECTION" line above, and/or after the
# "### END DEBCONF SECTION" line below.

Section "Files"
	#FontPath	"unix/:7110"			# local font server
	# if the local font server has problems, we can fall back on these
	FontPath	"/usr/lib/X11/fonts/misc"
	FontPath	"/usr/lib/X11/fonts/cyrillic"
	FontPath	"/usr/lib/X11/fonts/100dpi/:unscaled"
	FontPath	"/usr/lib/X11/fonts/75dpi/:unscaled"
	FontPath	"/usr/lib/X11/fonts/TrueType"
	FontPath	"/usr/lib/X11/fonts/Type1"
	FontPath	"/usr/lib/X11/fonts/Speedo"
	FontPath	"/usr/lib/X11/fonts/100dpi"
	FontPath	"/usr/lib/X11/fonts/75dpi"
EndSection

Section "Module"
	Load	"ddc"
	Load	"GLcore"
	Load	"dbe"		# double buffer extension
	Load	"dri"
	Load	"extmod"

	# This loads the miscellaneous extensions module, and disables
	# initialisation of the XFree86-DGA extension within that module.
	SubSection  "extmod"
		Option "omit xfree86-dga"
	EndSubSection

	Load	"glx"
	Load	"bitmap"
	Load	"speedo"
	Load	"type1"
	Load	"freetype"
	Load	"record"
	#Load	"int10"
	#Load	"pex5"
	#Load	"vbe"
	#Load	"xie"
EndSection

Section "InputDevice"
	Identifier	"Generic Keyboard"
	Driver		"keyboard"
	Option		"CoreKeyboard"
	Option		"XkbRules"	"xfree86"
	Option		"XkbModel"	"pc104"
	Option		"XkbLayout"	"us"
	#Option		"XkbVariant"	"nodeadkeys"
	#Option		"XkbOptions"	"ctrl:nocaps"
EndSection

Section "InputDevice"
	Identifier	"Configured Mouse"
	Driver		"mouse"
	#Driver		"synaptics" # crashes w/ newest DRI X11 cvs
	Option		"CorePointer"
	Option		"Device"		"/dev/psaux"
	Option		"Protocol"		"PS/2"
	Option		"ZAxisMapping"		"4 5"

	#Device          String Synaptics device
	#SHMConfig       Bool   switch on/off shared-memory for configuration
	#LeftEdge        Int    coordinates for left edge
	#RightEdge       Int    coordinates for right edge
	#TopEdge         Int    coordinates for top edge
	#BottomEdge      Int    coordinates for bottom edge
	#FingerLow       Int    min. finger pressure after ending with movement
	#FingerHigh      Int    max. finger pressure before beginning with move
	#MaxTapTime      Int    max. time (time of 1/80s) for detecting a tap
	#MaxTapMove      Int    max. movement of the finger for detecting a tap
	#VertScrollDelta Int    move-distance of the finger for a scroll event
	#EdgeMotionSpeed Int    edge motion speed when dragging
	#Repeater        String repeater device
	#MinSpeed        Float  min. Speed-factor
	#MaxSpeed        Float  max. Speed-factor
	#AccelFactor     Float  acceleration-factor

#	Option          "Edges"         "1900 5400 1800 3900"
#	#Option          "Finger"        "25 30"
#	Option          "Finger"        "999 999"
#	Option          "MaxTapTime" "20"
#	Option          "MaxTapMove" "220"
#	Option          "VertScrollDelta" "100"
#	Option          "MinSpeed"      "0.02"
#	Option          "MaxSpeed"      "0.18"
#	Option          "AccelFactor" "0.0010"
#	#  Option       "Repeater"      "/dev/ps2mouse"
#	#  Option       "SHMConfig"     "on"

	Option		"Emulate3Buttons"
EndSection

Section "InputDevice"
	Identifier	"Generic Mouse"
	Driver		"mouse"
	Option		"SendCoreEvents"	"true"
	Option		"Device"		"/dev/input/mice"
	Option		"Protocol"		"ImPS/2"
	Option		"ZAxisMapping"		"4 5"
EndSection

Section "Device"
	Identifier	"Radeon0"
	Screen		0
	Driver		"radeon"
	#Option		"ForcePCIMode" "true" # works but crashes
	#Option		"SWcursor" "true" # paranoid mode
	Option		"AGPMode" "1" # needs agpgart >= 2.4.21-rc1-ac2
	#Option          "UseFBDev"              "true"
	Option		"MonitorLayout" "NONE, TMDS"
	#Option		"PanelOff" "true"
	Option		"CloneDisplay" "0"
	Option		"CloneMode" "1280x1024"
	Option		"CloneHSync" "30-80"
	Option		"CloneVRefresh" "60-90"
	BusID		"PCI:1:0:0"
EndSection

Section "Device"
	Identifier	"Radeon1"
	Screen		1
	Driver		"radeon"
	#Option		"ForcePCIMode" "true" # works but crashes
	#Option		"SWcursor" "true" # paranoid mode
	Option		"AGPMode" "1" # needs agpgart >= 2.4.21-rc1-ac2
	#Option          "UseFBDev"              "true"
	Option		"MonitorLayout" "NONE, TMDS"
	#Option		"PanelOff" "true"
	BusID		"PCI:1:0:0"
EndSection

Section "Monitor"
	Identifier	"LCD"
	Option		"DPMS"
EndSection

Section "Monitor"
	Identifier	"External Monitor"
	HorizSync	30-60
	VertRefresh	43-90
	Option		"DPMS"
EndSection

Section "Screen"
	Identifier	"LCD"
	Device		"Radeon0"
	Monitor		"LCD"
	DefaultDepth	24
	SubSection "Display"
		Depth		16
		Modes		"1400x1050" "1280x1024" "1024x768" "800x600" "640x480"
	EndSubSection
	SubSection "Display"
		Depth		24
		Modes		"1400x1050" "1280x1024" "1024x768" "800x600" "640x480"
	EndSubSection
	SubSection "Display"
		Depth		32
		Modes		"1400x1050" "1280x1024" "1024x768" "800x600" "640x480"
	EndSubSection
EndSection

Section "Screen"
	Identifier	"VGA"
	Device		"Radeon1"
	Monitor		"External Monitor"
	DefaultDepth	24
	SubSection "Display"
		Depth		24
		Modes		"1280x1024" "1024x768" "800x600" "640x480"
	EndSubSection
EndSection

Section "Screen"
	Identifier	"s1024"
	Device		"Radeon0"
	Monitor		"LCD"
	DefaultDepth	24
	SubSection "Display"
		Depth		8
		Modes		"1024x768"
	EndSubSection
	SubSection "Display"
		Depth		16
		Modes		"1024x768"
	EndSubSection
	SubSection "Display"
		Depth		24
		Modes		"1024x768"
	EndSubSection
EndSection

Section "Screen"
	Identifier	"s640"
	Device		"Radeon0"
	Monitor		"LCD"
	DefaultDepth	24
	SubSection "Display"
		Depth		8
		Modes		"640x480"
	EndSubSection
	SubSection "Display"
		Depth		16
		Modes		"640x480"
	EndSubSection
	SubSection "Display"
		Depth		24
		Modes		"640x480"
	EndSubSection
EndSection

Section "ServerLayout"
	Identifier	"indep"
	Screen      0 "LCD"
	Screen      1 "VGA"
	InputDevice	"Generic Keyboard"
	InputDevice	"Configured Mouse"
	InputDevice	"Generic Mouse"
	Option "Xinerama" "false"
EndSection

Section "ServerLayout"
	Identifier	"xine"
	Screen      0 "LCD"
	Screen      1 "VGA" Above "LCD"
	InputDevice	"Generic Keyboard"
	InputDevice	"Configured Mouse"
	InputDevice	"Generic Mouse"
	Option "Xinerama" "true"
EndSection

Section "DRI"
	Mode	0666
EndSection

### END DEBCONF SECTION

--uAKRQypu60I7Lcqm--