home *** CD-ROM | disk | FTP | other *** search
Wrap
#!/bin/sh #BK video-wizard (c) 2003,2004,2005,2006 www.goosee.com/puppy CFREQ1="" #custom frequency, with leading x. CFREQ0="" #ditto, no x. CURRENTX="`readlink /usr/X11R6/bin/X`" if [ ! "$CURRENTX" = "Xvesa" ];then xmessage -bg "#ff8080" -center -name "xutilities" -title "Xvesa Video Wizard" "The Xvesa Kdrive X server is the default for Puppy, however is not currently running. The current X server is: $CURRENTX. If Xfbdev, the framebuffer Kdrive X server, or Xorg, the full server, is running, select the Xfbdev/Xorg Video Wizard from the menu -- they have the option of switching back to the default Xvesa server. Click OK button to exit..." exit fi Xvesa -listmodes > /tmp/Xmodes.txt 2>&1 BLURB0="Welcome to my real-time Video Wizard!" echo "Press a button to test a video mode." > /tmp/videowizard.txt echo "IMPORTANT: if a mode does not work, press CTRL-ALT-BACKSPACE" >> /tmp/videowizard.txt echo "(hold down CTRL and ALT keys and tap BACKSPACE key)." >> /tmp/videowizard.txt echo "Please remember this key combination. It is the standard Linux" >> /tmp/videowizard.txt echo "technique for emergency shutdown of the X graphics server." >> /tmp/videowizard.txt echo "NOTE: x16 is 16-bit color which is 65,536 colors (HighColor)," >> /tmp/videowizard.txt echo " x24 is 24-bit color which is 16 million colors (TrueColor)." >> /tmp/videowizard.txt echo "WARNING: these modes are supported by your video card, but do" >> /tmp/videowizard.txt echo "not choose a mode that exceeds your monitor capability." >> /tmp/videowizard.txt echo " " >> /tmp/videowizard.txt echo "MORE offers more video mode choices." >> /tmp/videowizard.txt echo "XOPTIONS enables you to specify extra X server startup options." >> /tmp/videowizard.txt echo " " >> /tmp/videowizard.txt echo -ne "IF YOU WANT TO USE THE CURRENT MODE, PRESS \"OK\"" >> /tmp/videowizard.txt BUTTONS="640x480x16:10,MORE:16,OK:17" cat /tmp/Xmodes.txt | grep "0x0118" if [ $? -eq 0 ];then #=0 if found. BUTTONS="640x480x16:10,640x480x24:11,800x600x16:12,800x600x24:13,1024x768x16:14,1024x768x24:15,MORE:16,XOPTIONS:18,OK:17" else cat /tmp/Xmodes.txt | grep "0x0117" if [ $? -eq 0 ];then #=0 if found. BUTTONS="640x480x16:10,640x480x24:11,800x600x16:12,800x600x24:13,1024x768x16:14,MORE:16,XOPTIONS:18,OK:17" else cat /tmp/Xmodes.txt | grep "0x0115" if [ $? -eq 0 ];then #=0 if found. BUTTONS="640x480x16:10,640x480x24:11,800x600x16:12,800x600x24:13,MORE:16,XOPTIONS:18,OK:17" else cat /tmp/Xmodes.txt | grep "0x0114" if [ $? -eq 0 ];then #=0 if found. BUTTONS="640x480x16:10,640x480x24:11,800x600x16:12,MORE:16,XOPTIONS:18,OK:17" else cat /tmp/Xmodes.txt | grep "0x0112" if [ $? -eq 0 ];then #=0 if found. BUTTONS="640x480x16:10,640x480x24:11,MORE:16,XOPTIONS:18,OK:17" fi fi fi fi fi #/tmp/videomode only exists when testing a mode... rm -f /tmp/videomodex #v2.0.0 see /usr/sbin/fitimage2root if [ -e /tmp/videomode ];then CMODE="`cat /tmp/videomode`" echo -n "$CMODE" > /tmp/videomodex #v2.0.0 #in case new mode no good, ctrl-alt-backspace will come up in safe mode... echo -n "0x0111 640x480x16" > /tmp/videomode else CMODE="`cat /etc/videomode`" fi BLURB1="`cat /tmp/videowizard.txt`" while :; do #big loop STAYX=0 xmessage -bg "#ffe0e0" -center -name "xutilities" -title "Puppy Video Wizard. Current mode: $CMODE" -buttons "$BUTTONS" -file -<<MSG1 $BLURB0 $BLURB1 MSG1 case ${?} in 10)# 640x480x16 echo -n "0x0111 640x480x16$CFREQ1" > /tmp/videomode ;; 11)# 640x480x24 echo -n "0x0112 640x480x24$CFREQ1" > /tmp/videomode ;; 12)# 800x600x16 echo -n "0x0114 800x600x16$CFREQ1" > /tmp/videomode ;; 13)# 800x600x24 echo -n "0x0115 800x600x24$CFREQ1" > /tmp/videomode ;; 14)# 1024x768x16 echo -n "0x0117 1024x768x16$CFREQ1" > /tmp/videomode ;; 15)# 1024x768x24 echo -n "0x0118 1024x768x24$CFREQ1" > /tmp/videomode ;; 16)# MORE complete list of modes... exec rxvt -geometry 70x28 -e video-wizard-more ;; 18)# extra options when start X... OPTCURRENT="`cat /etc/xextraoptions`" OPTNEW="`Xdialog --title "Extra X startup options" --left --stdout --inputbox "-shadow may give smoother scrolling\n-2button emulate middle button by pressing both together\n(changes will take effect after X is restarted)" 0 0 "$OPTCURRENT"`" if [ $? -eq 0 ];then echo -n "$OPTNEW" > /etc/xextraoptions fi STAYX=1 #flag to stay in X. ;; 17)# = OK echo -n "$CMODE" > /etc/videomode rm -f /tmp/videomodex #v2.0.0 see /usr/sbin/fitimage2root rm -f /tmp/videomode rm -f /tmp/videowizard.txt rm -f /tmp/Xflag #prevent endless restarts. see xwin*. break;; 0)# i want to handle window close-box... break;; 1)# i want to handle window close-box... break;; esac if [ $STAYX -eq 0 ];then rm -f /tmp/Xflag #prevent endless restarts. see xwin*. exec killall X #restart X in new test mode. fi done #on very 1st boot, PUPMODE=5, put up a welcome box... #(for Xorg, see /usr/sbin/delayedrun, called from /root/.xinitrc) PUPMODE=2 [ -f /etc/rc.d/PUPMODE ] && PUPMODE=`cat /etc/rc.d/PUPMODE` if [ $PUPMODE -eq 5 ];then #rc.modules should have detected sound, loaded module, written to /etc/modprobe.conf. #rc.local0 executes rc.alsa to start sound. now bark... if [ ! "`grep 'alias snd\-card\-0' /etc/modprobe.conf`" = "" ];then aplay /usr/share/audio/2barks.au & fi dillo --rcfile /etc/welcomedillorc file:///usr/share/doc/welcome1stboot.htm killall aplay 2> /dev/null fi ###end###