home *** CD-ROM | disk | FTP | other *** search
/ PCNET 2006 September - Disc 1 / PCNET_CD_2006_09.iso / linux / puppy-barebones-2.01r2.iso / pup_201.sfs / usr / sbin / xrandrshell < prev    next >
Encoding:
Text File  |  2006-01-31  |  1.9 KB  |  54 lines

  1. #!/bin/sh
  2. #(c) Copyright Barry Kauler 2006 www.puppylinux.com
  3.  
  4. XRANDR="`xrandr -q`"
  5. RESCHOICES="`echo "$XRANDR" | tr '*' ' ' | tr -s " " | grep "^ [0-9]" | cut -f 1-5 -d " " | sed -e 's/ x /x/g'`"
  6.  
  7. SELECTIONS="`echo "$RESCHOICES" | tr "\n" "X" | sed -e 's/X/ off /g'`"
  8.  
  9. #echo "$SELECTIONS"
  10.  
  11. TESTINDEX="`Xdialog --left --title "Xorg Resolution Changer" --stdout --no-tags --radiolist "Please choose a resolution to test.\n\nNote: After testing a resolution, you\nwill be given the opportunity to make\nit permanent if you wish.\nIF THE NEW RESOLUTION DOES NOT WORK, WAIT\n60 SECONDS OR PRESS CTRL-ALT-BACKSPACE" 0 0 8 $SELECTIONS 2> /dev/null `"
  12.  
  13. if [ ! $? -eq 0 ];then
  14.  #made no choice.
  15.  exit
  16. fi 
  17.  
  18. xrandr -s $TESTINDEX
  19.  
  20. TESTLINE="`echo "$XRANDR" | tr '*' ' ' | tr -s " " | grep "^ [0-9]" | grep " $TESTINDEX "`"
  21. TESTX="`echo -n "$TESTLINE" | cut -f 3 -d " "`"
  22. TESTY="`echo -n "$TESTLINE" | cut -f 5 -d " "`"
  23. TESTVR="`echo -n "$TESTLINE" | cut -f 2 -d ')' | cut -f 2 -d " "`"
  24.  
  25. xmessage -bg "violet" -center -timeout 60 -title "Xorg Resolution Changer" -buttons Permanent:12,Session:11,RESTORE_DEFAULT:10  "X is now running at a resolution of ${TESTX}x${TESTY}
  26. at a vertical refresh frequency of ${TESTVR} Hz.
  27.  
  28. Note:
  29. some window managers, such as JWM, do not work
  30. properly after a resolution change, however they
  31. do work properly after the w.m. is restarted with
  32. the new resolution (see Shutdown menu).
  33.  
  34. Do you want to make this permanent?...
  35. Or, just keep this resolution for current session?...
  36. Or, go back to default resolution?...
  37. IF YOU DO NOT CHOOSE IN 60 SECONDS, X
  38. WILL RESTORE TO PREVIOUS RESOLUTION"
  39.  
  40. RETVAL=$?
  41. if [ $RETVAL -lt 11 ];then
  42.  rm -f /etc/xrandrindex
  43.  xrandr -s 0
  44.  exit
  45. fi
  46. if [ $RETVAL -eq 11 ];then #keep current session only.
  47.  rm -f /etc/xrandrindex
  48.  exit
  49. fi
  50.  
  51. echo -n "$TESTINDEX" > /etc/xrandrindex
  52.  
  53. Xdialog --title "Xorg Resolution Changer" --msgbox "The next time you boot Puppy, X will start\nwith a screen resolution of ${TESTX}x${TESTY}" 0 0
  54.