Re: ASCFG

David S. Jackson (dsj@dsj.net)
Wed, 11 Nov 1998 20:18:25 +0000



--mxv5cy4qt+RJ9ypb
Content-Type: text/plain; charset=us-ascii

Thus spake Wandered Inn (esoteric@denali.atlnet.com):

> "David S. Jackson" wrote:
> > 
> > Hi,
> > 
> > I'm new to this ~/GNUstep/Library/Afterstep/ multifile configuration
> > deal.  I'm used to the single .steprc approach.  But I want to go
> > along to get along, so I wrote this little script to help me modify
> > files.  Since I couldn't get ascp to compile properly as long as the
> > library dependencies are on developmental libraries.  Anyway, I
> > thought I'd share it with you all for grins.  If you can get some use
> > out of it, that's great, and if not, well thanks for looking anyway.
> 
> I assume you meant to attach it, but it wasn't there. :)

OOOPS!  :-\

--
David S. Jackson                           http://www.dsj.net
=======BEGIN GEEK CODE BLOCK======
Version: 3.12
GTW/GL d- s+:+ a42 C+++ USL++++ P+>+++ L+++ E++ W++ N++@ o-- 
K- w--- O++@ M V PS+ PE++ Y+>++ PGP++(+++) t+ 5 X+ R-@ tv b++ 
DI+++ D++ G++ e++ h---- r+++ y++++
=======END GEEK CODE BLOCK========

--mxv5cy4qt+RJ9ypb
Content-Type: text/plain; charset=us-ascii
Content-Description: afterstep config script
Content-Disposition: attachment; filename=ascfg

#! /bin/sh

#   Syntax:  ascfg

#   ASCFG version 0.02 is a shell script to edit configuration files
#   for the Afterstep windowmanager, post version 1.2.

#   Copyright (C) 1998  David S. Jackson <dsj@dsj.net>

#   This program is free software; you can redistribute it and/or
#   modify it under the terms of the GNU General Public License as
#   published by the Free Software Foundation; either version 2 of the
#   License, or (at your option) any later version.

#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
#   General Public License for more details.

#   You should have received a copy of the GNU General Public License
#   along with this program; if not, write to the Free Software
#   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
#   02111-1307, USA.  Or visit http://www.gnu.org/copyleft/gpl.html.

#                              ##############

#   I still need to figure a way to update entire themes.  I'll have
#   to work on that.


###################################
###Here are some variable setups###
###################################
APP=emacsclient
DOPATH=~/GNUstep/Library/AfterStep
BACKPATH=~/ASbackups
LOOKBACK=$BACKPATH/looks
FEELBACK=$BACKPATH/feels
LOOKPATH=$DOPATH/looks
FEELPATH=$DOPATH/feels

###################################
###  Function Setups           ####
###################################
BackUp()                                ## The backup function
{
cp $FILE $BACKPATH
BACKPATH=~/ASbackups
}

EditIt()                                ## The Edit function
{
$APP $FILE
FILE=""                                 # Reset $FILE to empty
}

ChangeAnimate()                         # animate
{
FILE=$DOPATH/animate
BackUp
EditIt
}

ChangeAsmail()                          # ~/.asmailrc or asmail
{
if [ -f ~/.asmailrc ]; then
    FILE=$HOME/.asmailrc
    BackUp
    EditIt
else
    FILE=$DOPATH/asmail
    BackUp
    EditIt
fi
}

ChangeForms()           #For ftp and other forms
{
FILE=$DOPATH/forms
BackUp
EditIt
}

ChangeAppStyles()        #This is for the database file
{
FILE=$DOPATH/database
BackUp
EditIt
}

ChangeBase()             #This is for 8,16,24bpp base file (paths, desktops)
{
echo "What colordepth are you working in? [8 or 16 or 24]:  "
read depth

case $depth in

    8)
       FILE=$DOPATH/base.8bpp
       BackUp
       EditIt
       ;;
    16)
       FILE=$DOPATH/base.16bpp
       BackUp
       EditIt
       ;;
    24)
       FILE=$DOPATH/base.24bpp
       BackUp
       EditIt
       ;;
    *)
       echo "Enter 8 or 16 or 24.  Try again!"
       ChangeBase
       ;;
esac
}

ChangeAudio()                     #Audio
{
FILE=$DOPATH/audio
BackUp
EditIt
}

ChangePager()                     # Pager  (either in 'pager' or 'base.xbpp')
{
echo "Do you want to change number of Virtual Desktops? "
read desks

if [ $desks = y ]; then
    ChangeBase
else
    FILE=$DOPATH/pager
    BackUp
    EditIt
fi
}

ChangeWharf()                     # Wharf
{
FILE=$DOPATH/wharf
BackUp
EditIt
}

ChangeWinlist()                   # Winlist
{
FILE=$DOPATH/winlist
BackUp
EditIt
}

ChangeAutoexec()                  # Autoexec
{
FILE=$DOPATH/autoexec
BackUp
EditIt
}

ChangeCompatibility()             # Compatibility
{
FILE=$DOPATH/compatibility
BackUp
EditIt
}

#################################
###    Edit Look & Feel Files ###
#################################

ChangeLooks()                                 # backups for looks go into  
{                                             # a different backpath and 
select file in $( ls $LOOKPATH ); do          # reside in a different place.
    FILE=$LOOKPATH/$file                      # My kludge for editing/copying
    BACKPATH=$LOOKBACK                        # them kinda works, though.
    BackUp $FILE
    EditIt $FILE
    echo "Would you like to continue? [y/n] "
    read domore
    if [ $domore -eq y ]; then
	selectone
    else
	break
    fi
done
}

ChangeFeels()                                 # See above note on ChangeLooks()
{                                              
select file in $( ls $FEELPATH ); do           
    FILE=$FEELPATH/$file                       
    BACKPATH=$FEELBACK
    BackUp $FILE
    EditIt $FILE
    echo "Would you like to continue? [y/n] "
    read domore
    if [ $domore -eq y ]; then
	selectone
    else
	break
    fi
done
}

#################################
###       Main Program     ######
#################################


############################
## This is the user's menu##
############################
while [ 1 ]; do
    clear
    echo -e "\n\nWelcome to AsCfg, A Free AfterSTep Config Utility."
    echo -e "Please select from the list below: \n\n "
    echo -e "\t\tAsAnimate: \t\ttype n "
    echo -e "\t\tAsmail: \t\ttype m"
    echo -e "\t\tAsForms: \t\ttype f"
    echo -e "\t\tAsStyles: \t\ttype s"
    echo -e "\t\tAsBase: \t\ttype b"
    echo -e "\t\tAsAudio: \t\ttype a"
    echo -e "\t\tAsPager: \t\ttype p"
    echo -e "\t\tAsWharf: \t\ttype w"
    echo -e "\t\tAsWinlist: \t\ttype l"
    echo -e "\t\tAsAutoexec: \t\ttype x"
    echo -e "\t\tAsCompatibility: \ttype c"
    echo -e "\t\tChange Looks: \t\ttype L"
    echo -e "\t\tChange Feels: \t\ttype F"
    echo -e "\t\tQuit: \t\t\ttype q\n"
    echo "Your choice? "
    read file                            ## Read user's choice of file to edit

    #################################
    ## Process the user's selection##
    #################################
    case $file in

	L)
	    ChangeLooks
	    continue
	    ;;
	F)
	    ChangeFeels
	    continue
	    ;;
	n)
	    ChangeAnimate
	    continue
	    ;;
        m)
	    ChangeAsmail
	    continue
	    ;;
	f)
	    ChangeForms
	    continue
	    ;;
	s)
	    ChangeAppStyles
	    continue
	    ;;
	b)
	    ChangeBase
	    continue
	    ;;
	a)
	    ChangeAudio
	    continue
	    ;;
	p)
	    ChangePager
	    continue
	    ;;
	w)
	    ChangeWharf
	    continue
	    ;;
	l)
	    ChangeWinlist
	    continue
	    ;;
	x)
	    ChangeAutoexec
	    continue
	    ;;
	c)
	    ChangeCompatibility
	    continue
	    ;;
	q)
	    break
	    ;;

	*)
	    echo -e "Please enter a valid option; try again...\n"
	    continue
	    ;;
    esac

done            ## Exit the while loop

############################
## Farewell!  Bon Voyage! ##
############################ 

echo -e "Mission accomplished!  Now just update or restart \nAfterStep for the values to take effect!\n"


--mxv5cy4qt+RJ9ypb--

--
   WWW:   http://www.afterstep.org/
   FTP:   ftp://ftp.afterstep.org/
   MAIL:  http://www.caldera.com/linuxcenter/forums/afterstep.html