[ltp] dual head or xinerama - turning it on and off "on the fly"

André Wyrwa linux-thinkpad@linux-thinkpad.org
Sun, 18 Jul 2004 23:02:52 +0200


Hei,

Klaus Weidner has posted the following some ages ago. Try to search the
archives of Nov 2003, you should find it, there's some discussion about
it under the thread "Re: Dual monitor setup: T40p+XFree-4.3.0".
You'll find his X config file in the original mail also.

Maybe this helps you. (I haven't tried this approach, but it brought me
to the thought of using two separate X displays instead of Xinerama,
which imho has some advantages.)

Regards
André.

---

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

On Fre, 2004-07-16 at 17:49, Osho GG wrote:
> This is so unfortunate. For those who have tried
> dual-head and/or xinerama, suppose I configure it with
> two displays and then manually take care to move the
> windows from the second display to the primary laptop
> display before removing the laptop from port
> replicator, will X work fine with just one display?
> will I be able to use the second display when I put
> the laptop back in the port replicator? 
> 
> thanks,
> Osho
> 
> --- Tod Harter <tharter@giantelectronicbrain.com>
> wrote:
> > The problem is that each mode is a different
> > configuration 'layout' of 
> > the display X is configured with. X only reads its
> > configuration file at 
> > startup, so in order to get it to switch layouts you
> > will HAVE to 
> > restart your X server. In fact realistically the
> > only way I know how to 
> > do what you want thats simple is to start up in
> > runlevel 3 and pass 
> > parameters to X at the startx command. That way you
> > can tell it which 
> > layout to use. So the switching drill would involve
> > shutting down your X 
> > desktop, switching hardware configurations, and
> > typing startx ... which 
> > obviously isn't what you want!
> > 
> > Now I'm pretty sure with some hacking of scripts you
> > can get X to figure 
> > out what your configuration is and then you could
> > run at level 5 and 
> > every time X restarts it will 'do the right thing',
> > but thats about as 
> > close as you can get, as things stand now. Its not
> > TOTALLY infeasible 
> > for this sort of facility to exist, but it would
> > have to be supported by 
> > the driver, and probably would require some redesign
> > in the
> > server itself so that window managers, applications,
> > and X internal data 
> > structures would get updated as well. I would assume
> > that since X can 
> > already switch resolutions on the fly that its
> > mostly a driver issue at 
> > this point.
> > 
> > Personally I wouldn't hold my breath for it.
> > Obviously MS has worked all 
> > this out. X and Linux hasn't.
> > 
> > Osho GG wrote:
> > 
> > >Hi,
> > >
> > >I am planning to get a T42p soon and wonder if the
> > >usage model I have in mind will be possible with
> > >Linux. I would like to use two monitors - LCD
> > display
> > >in the laptop (1600x1200 resolution) and an
> > external
> > >LCD flat panel display (1280x1024 resolution). LCD
> > >flat panel display would be connected to the port
> > >replicator of the thinkpad (either VGA or DVI -
> > >whichever works). Based on what I read, I should be
> > >able to configure X either with dual-head or with
> > >xinerama to get such two displays working.
> > >
> > >What I would like to know is whether it is possible
> > to
> > >use two displays only while thinkpad is in the port
> > >replicator and use one display when thinkpad is
> > >removed from port replicator. When I remove the
> > >thinkpad from the port replicator and take it with
> > me
> > >- can I get the windows on the external display in
> > the
> > >laptop display? Ideally, it would be nice to be
> > able
> > >to use a configuration like that so I can use two
> > >displays while on my desk and still work without
> > >losing the windows while away from desk. Of course,
> > I
> > >wouldn't want to restart my X server every time I
> > >switch between two displays and one display - as
> > that
> > >would mean significant disruption in work. This is
> > >possible to do with Windows and (to it's credit)
> > it's
> > >reasonably smart about figuring out what is the
> > >current display configuration and adjust to it.
> > >
> > >Has anyone tried to get such a configuration to
> > work
> > >well? Any suggestions/pointers would be greatly
> > >appreciated.
> > >
> > >thanks,
> > >Osho
> > >
> > >
> > >
> > >	
> > >		
> > >__________________________________
> > >Do you Yahoo!?
> > >New and Improved Yahoo! Mail - 100MB free storage!
> > >http://promotions.yahoo.com/new_mail
> > >  
> > >
> > 
> > -- 
> > The linux-thinkpad mailing list home page is at:
> >
> http://mailman.linux-thinkpad.org/mailman/listinfo/linux-thinkpad
> > 
> 
> 
> 
> 	
> 		
> __________________________________
> Do you Yahoo!?
> New and Improved Yahoo! Mail - 100MB free storage!
> http://promotions.yahoo.com/new_mail