#!/bin/sh # front end to Xnest, and solution to the silly MDI/SDI "debate" since # it can make any SDI app an MDI one. (so write you app in SDI, # preferably with regroupable tabs a la gaim) # runs the commands given in a nested X server, or your default X session # if none are given (this is xinit, so it would use your .xinitrc, # not .xsession) # Xnest does have some bugs. xephyr is better than Xnest but its rare. # License: MIT X11 License. if you have X11, you have a copy of it. # Copyright 2005 pixelfairy (code is trivial, but im not a lawyer) # TODO: vnc version? would be almost identical argc=`echo $@ | wc -w` argc_count=0 xinitfile=/tmp/nestx-xinit-$$ xsocketdir=/tmp/.X11-unix xdisplay=0 if [ -d $xsocketdir ];then while [ -e $xsocketdir/X$xdisplay ];do xdisplay=`expr $xdisplay + 1` done fi if [ $argc == 0 ];then startx -- /usr/X11R6/bin/Xnest :$xdisplay exit 0 fi for i in $@;do argc_count=`expr $argc_count + 1` if [ $argc_count == $argc ];then echo "$i " >> $xinitfile appname=$i else echo "$i &" >> $xinitfile fi done startx $xinitfile -- /usr/X11R6/bin/Xnest :$xdisplay -name nestx-$appname-$xdisplay rm $xinitfile