#!/bin/sh # (c) 2000-2002 MandrakeSoft # $Id: xinitrc 600 2006-02-15 16:15:46Z chris $ # Set a background here because it's not done anymore # in Xsesion for non root users if [ "`whoami`" != root ]; then xsetroot -solid "#21449C" fi # Screen Resolution Detection by Christophe DUMEZ # looking for supported resolution nb_res=`grep dls-vnc /etc/services | wc -l` if [ $nb_res -eq 0 ]; then echo "Error: /etc/services wasn't edited for vnc !" exit 1 fi list_res=`grep dls-vnc /etc/services | cut -d" " -f1 | cut -d"-" -f2 | cut -b 4- | sort -nr` # we try to get screen width width=`xdpyinfo | grep dimensions | cut -d" " -f7 | cut -d"x" -f1` if [ "x$width" = "x" ]; then # not able to detect screen width, using 1024x768 echo "Note: using default resolution of 1024x768" vnc_port=`grep dls-vnc1024 /etc/services | cut -d" " -f2 | cut -d"/" -f1` else # screen width detected successfully echo "Note: screen width detected is $width" count=0 # trying to find the best resolution available regarding screen width for res in $list_res; do count=$(($count+1)) if [ $width -ge $res ]; then width=$res echo "Note: using available width of $width" break fi if [ $count -eq $nb_res ];then echo "Error: screen width too small !" exit 1 fi done vnc_port=`grep dls-vnc$width /etc/services | cut -d" " -f2 | cut -d"/" -f1` fi echo "Note: using vncview on port $vnc_port" # launching vncviewer on correct port (corresponding to resolution) exec vncviewer -fullscreen -compresslevel 8 dls::$vnc_port