-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Don Gould wrote:
| When I use VNC on a win pc I get the desktop that the user sees.
|
| When I use VNC on a nix pc I don't get the desktop the user sees, I get a
| different one....
|
| I want to see what the current logged on user is seeing.
|
| What's the simplest way to do this?
|
| I want to be able to view it from my win98 laptop.
|
| Cheers Don

Ah hah! I've got it.

The problem is that to get it to do what you want to do, you either have
to install something like x11vnc to export a "live" desktop. Or do it as
I'll try to illustrate here whereby you never login to a "live" desktop,
but you're always logging in to a vncsession, even when you login
locally. This means that local video performance is pretty much going to
suck but will provide the functionality that you're looking for.

The most important thing for your .vncrc is that you better have a
$vncStartup line in there, otherwise vnc will try to run your .xsession,
and end up in a horrible loop (with my quick fix code anyway.... 25
desktops and no cpu later I figured that out.)

For the .xsession we first see if we're running a vncserver, if not,
start one, change to a lower res, run the viewer, change back to the old
res when the viewer exits, if the user has logged out from gnome, kill
the vncserver so we dont get a blank desktop next time we try to login.

The most annoying thing here is if you logout from gnome, and endup with
a blank desktop users could get confused as you then have to hit F8,
Quit Viewer, or ctrl-alt-bksp to get out.

If you just ctrl-alt-bksp your desktop will keep running in the
vncserver, if you F8 and Quit the viewer again it will keep running
nicely and in both instances you'll be back at your login screen.

- --- ~/.vncrc ------------
$vncStartup = "/usr/bin/gnome-session";
$geometry = "1024x768";
$depth = "16";
- -- end ------------------


- --- ~/.xsession --------- #!/bin/sh

# Are we running a vncserver? If so whats its display.
VNCDISPLAY=`ps x | grep Xrealvnc | cut -c 37-39 | grep ^:`

# If we're not, lets start one and find out what display its on.
if [ "X$VNCDISPLAY" == "X" ]; then
~        vncserver
~        VNCDISPLAY=`ps x | grep Xrealvnc | cut -c 37-39 | grep ^:`
fi

# I want vnc fullscreen no border, so make this the same res as set in
# your ~/.vncrc
xrandr -s 1024x768

# Run the vncviewer
xvncviewer -passwd ~/.vnc/passwd $VNCDISPLAY -fullscreen \
         -shared -truecolour

# See if gnome is still running.
GNOME=`ps x | grep gnome-session | grep -v grep`

# If gnome has exited, kill the vncserver.
if [ "X$GNOME" == "X" ]; then
~        vncserver -kill $VNCDISPLAY
fi

# back to the standard desktop resolution.
xrandr -s 1600x1200

- -- end ------------------

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFAq2FFL43IewNc8hIRAhsyAKCTwWpG/5J4WHhCDKeOPcnvxWxtRgCdEn23
UzQl2RkV6CZQI3VrASH4ThA=
=ofxt
-----END PGP SIGNATURE-----

Reply via email to