#!/bin/rc # manage equis/vnc/x11 screens on several different operating systems if(~ $service cpu terminal) rfork e switch($1){ case -d for(i in `{ps ax|grep -i x11|awk '{print $1;}'}) kill -9 $i case -e scr=(`{cat /dev/draw/new >[2]/dev/null}) w=$scr(11) h=$scr(12) if(~ $w 640 && ~ $h 480){ # nothing to see here } if(~ $w 1024 1376 && ~ $h 768){ window -r 343 1 1365 767 'label equis; X11/equis -ac' } if(~ $w 1280 && ~ $h 800){ window -r 1 1 1279 767 'label equis; X11/equis -ac' } if(~ $w 1280 && ~ $h 1024){ window -r 1 1 1279 1023 'label equis; X11/equis -ac' } if (~ $w 1680 1600 && ~ $h 1050 1200){ window -r 178 150 1599 1199 'label equis; X11/equis -ac' } if(~ $w 1920 && ~ $h 1080){ window -r 130 1 1793 1062 'label equis; X11/equis -ac' } case -r k x11vnc x11vnc -display :0 -passwdfile .vnc/passwd -repeat -capslock & case -v vncv wm case -x res=1280x767x24 xinit -- /usr/X11R6/bin/Xvfb :0 -screen 0 $res & sleep 5 x11vnc -display :0 -passwdfile /home/sl/lib/vnc.passwd -capslock & case * echo usage: x [-ervx] >[1=2] exit usage }