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

Klaus Weidner linux-thinkpad@linux-thinkpad.org
Fri, 7 Nov 2003 23:03:58 -0600


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

On Fri, Nov 07, 2003 at 05:12:50PM +0100, Dirk Husemann wrote:
[re: the VNC based dualhead setup]
> great idea...tried it on my TP30 (1400x1050 resolution, ATI 7500 card 
> inside)...had to change the XF86Config a bit to get it working...might 
> be the thinkpad, might also be the fact that I'm using the GATOS 
> drivers...anyhow, i've attached my XF86Config.

For anyone who wants to keep playing with it and is too lazy to type the
long commands to switch environments, I've attached the 'View' shell
script I'm currently using. This way you don't need to type the
VNC passwords.

Examples:

# launch VNC server and display on right-hand monitor
	View server 1024x768 :3
	View extend :3 east	# or: View r :3

# launch a new VNC server w/ different resolution
# display on left monitor this time due to rearranged furniture
	View server 1280x1024 :4
	View tune prev		# switch monitor to new resolution
	View extend :4 west	# or: View l :4

# show the 1024x768 VNC desktop's contents on builtin monitor
	View c :3

-Klaus

--bCsyhTFzCvuiizWE
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=View

#!/bin/sh

PWFILE=$HOME/.vnc/passwd

usage () {
	cat <<-EOF
		Usage: $0 COMMAND
		Examples:
			$0 help
			
	EOF
	exit 1
}

EXPORTED_FUNCS=""

Export () {
	FN="$1"
	DOC="$2"
	EXPORTED_FUNCS="$EXPORTED_FUNCS $FN"
	eval "doc_$FN () {
		DOC='$DOC'	
	}"
}

Export help 'show help about supported commands'
sub_help () {
	for FN in $EXPORTED_FUNCS
	do
		doc_$FN
		echo "$FN - $DOC"
	done
}

kill_proc () {
	Pids=`ps ax | grep -v grep | grep "$1" | awk '{print $1}'`
	for p in $Pids; do kill $p; done
}

Export extend 'show extended desktop on 2nd monitor
	Usage: extend DISPLAY SIDE
		DISPLAY is the VNC display number
		SIDE is east | west | north | south
	Example: extend :3 east'
sub_extend () {
	D="$1"
	S="$2"

	kill_proc 'vncviewer.*:0\.1'
	kill_proc x2vnc

	xvncviewer -passwd $PWFILE -nocursorshape -shared -fullscreen -display :0.1 $D &
	x2vnc -passwdfile $PWFILE -shared -$S localhost$D &
}

Export r 'shortcut for "extend DISPLAY east"'
sub_r () { sub_extend "$1" east; }

Export l 'shortcut for "extend DISPLAY west"'
sub_l () { sub_extend "$1" west; }

Export p 'show VNC desktop DISPLAY on primary monitor'
sub_p () {
	D="$1"

	xvncviewer -passwd $PWFILE -nocursorshape -shared $D &
}

Export server 'launch VNC server
	Usage: server GEOMETRY DISPLAY
	Example: server 1024x768 :3'
sub_server () {
	vncserver -geometry "$@"
}

Export tune 'run xvidtune command on 2nd monitor
	Usage: tune COMMAND
		COMMAND is next | prev | show | ...'
sub_tune () {
	xvidtune -$1 -display :0.1
}

Export next 'alias for "tune next", switch 2nd monitor to next resolution'
sub_next () { sub_tune next; sub_tune show; }

Export prev 'alias for "tune prev", switch 2nd monitor to previous resolution'
sub_prev () { sub_tune prev; sub_tune show; }

Cmd="$1"; shift
[ -z "$Cmd" ] && usage
sub_"$Cmd" "$@"

--bCsyhTFzCvuiizWE--