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 / local / jwmconfig / taskbarConfig < prev    next >
Encoding:
Text File  |  2006-05-06  |  2.0 KB  |  102 lines

  1. #!/bin/bash
  2. #
  3. # Code adapted for Puppy 1.0.9, JWM 1.7
  4. # by Kwiller on 6-May-2006
  5. #
  6. ###################
  7.  
  8. ##-----taskbarPlace----->>
  9.  
  10. TMP="/tmp/checklist.tmp.$$"
  11. ISSET="true"
  12. ISOFF="false"
  13. CONFIG="/root/.jwmrc-tray"
  14. CONFIG2="/root/.jwmrc-tray-bak"
  15. CONF="/root/.jwmrc-tray-temp"
  16.  
  17. #----Set defaults---->>
  18. AUTO_OFF=ON
  19. AUTO_SET=off
  20.  
  21. #----Are current settings non-default---->>
  22. SET_AHD=`grep -c "autohide=\"$ISSET\"" $CONFIG`
  23.  
  24. if [ "$SET_AHD" -eq "1" ]; then
  25.     AUTO_OFF=off
  26.     AUTO_SET=ON
  27. fi
  28.  
  29. #-----Backup current settings----->>
  30. cp $CONFIG $CONFIG2
  31.  
  32. SEDSET=s!autohide=\"$ISOFF\"!autohide=\"$ISSET\"!g
  33. SEDOFF=s!autohide=\"$ISSET\"!autohide=\"$ISOFF\"!g
  34.  
  35.  
  36. #-------------gui----------->>
  37.  
  38. Xdialog --backtitle "JWM Taskbar Configuration" \
  39.     --title "Taskbar" \
  40.         --radiolist "Choose a tray autohide option" 13 46 2 \
  41. "OFF"  "Tray Autohide off." $AUTO_OFF \
  42. "ON"    "Tray Autohide on" $AUTO_SET 2>$TMP
  43.  
  44. retval=$?
  45.  
  46. #--------cancel pressed----->>
  47. case $retval in
  48.   1 | 255) exit 0;;
  49. esac
  50.  
  51. #---------save changes----->>
  52.  
  53. OPTN=`cat $TMP`
  54.  
  55. #-----If there new settings chosen then make the changes----->>
  56. if [ "$OPTN" = "ON" ]; then
  57.   if [ "$SET_AHD" -eq "0" ]; then
  58.     sed -e "$SEDSET" $CONFIG > $CONF
  59.     mv $CONF $CONFIG
  60.   fi
  61. else
  62.   if [ "$SET_AHD" -eq "1" ]; then
  63.     sed -e "$SEDOFF" $CONFIG > $CONF
  64.     mv $CONF $CONFIG
  65.   fi
  66. fi
  67.  
  68. #------check new configuration----->>
  69. jwm -p 2> $TMP
  70.  
  71. CHECKCONF=`cat $TMP`
  72.  
  73. if [ "$OPTN" = "ON" ]; then
  74.   RES=`grep -c "autohide=\"$ISSET\"" $CONFIG`
  75. else
  76.   RES=`grep -c "autohide=\"$ISOFF\"" $CONFIG`
  77. fi
  78.  
  79. #----notify of result----->>
  80.  
  81. if [ "$RES" -eq "1" ]; then
  82.   if [ -z $CHECKCONF ]; then 
  83.     RESTOP="Change Saved"
  84.     RESMSG="The tray autohide option is now $OPTN"
  85.     rm -f $CONFIG2
  86.   else
  87.     RESTOP="Change Reversed"
  88.     RESMSG="New config corrupt. Keeping original"
  89.     mv $CONFIG2 $CONFIG
  90.   fi
  91. else
  92.   RESTOP="Change Failed"
  93.   RESMSG="Configuration has not been altered"
  94.   mv $CONFIG2 $CONFIG
  95. fi
  96.  
  97. Xdialog --title "$RESTOP" --msgbox "$RESMSG" 0 0
  98.  
  99. #--------clean exit------->>
  100. rm -f $TMP
  101. exit 0
  102.