/*
 * Some generic macros for WindowMaker configuration files
 * 
 */

#define ROOT_BACKGROUND_SCRIPT	$HOME/gnustep/Library/WindowMaker/.rootbg

#define WORKSPACE_STATE_SCRIPT	$HOME/gnustep/Library/WindowMaker/.workspace_state

// #include <.autodetect>

#define WMDOC "file:///usr/local/share/WindowMaker/Documentation/HTML/wmaker_toc.html"

#define HAVE_XLESS

#ifndef TILEROOT
#define TILEROOT xv -root -rmode 2 -quit
#endif

#ifndef SAVEWS
#define SAVEWS savews
#endif

#ifndef GETFILE
#define GETFILE(t)
#endif

/*
 * SOLIDROOT(COLOR) - sets the root background color to COLOR or none
 * 	if COLOR is -
 * A script with the selected color is saved in the config dir. It must
 * be called upon startup. (usually from winitrc)
 */
#define SOLIDROOT(COLOR)      /bin/rm -f ROOT_BACKGROUND_SCRIPT;\
		xsetroot -solid COLOR;\
		echo "xsetroot -solid '"#COLOR"'" > ROOT_BACKGROUND_SCRIPT; 

/*
 * CLEARROOT - set the root background to nothing
 */
#define CLEARROOT /bin/rm -f ROOT_BACKGROUND_SCRIPT; xsetroot

/*
 * IMAGEROOT(FILE) - set the root background to a image
 */
#define IMAGEROOT(FILE)	TILEROOT \
		$HOME/gnustep/Library/WindowMaker/tiles/#FILE ; \
		echo TILEROOT" "$HOME/gnustep/Library/WindowMaker/tiles/#FILE\
			> ROOT_BACKGROUND_SCRIPT

/*
 * 
 * MANUAL_SEARCH(ITEM) - search manual page for ITEM
 * 
 */
#ifdef HAVE_XLESS
#define MANUAL_SEARCH(ITEM)          \
        if ( man #ITEM > /dev/null ); then \
                man #ITEM | xless; \
        else \
                xmessage -center -title "Manual Browser" \
                        Sorry, but there is no manual page \
                        entry for #ITEM...;\
        fi
#else
#define MANUAL_SEARCH(ITEM)          \
        if ( man #ITEM > /dev/null ); then \
                xterm -e man #ITEM ; \
        else \
                xmessage -center -title "Manual Browser" \
                        Sorry, but there is no manual page \
                        entry for #ITEM...;\
        fi
#endif

/*
 * SAVE_WORKSPACE - saves the current workspace state in the 
 * 	~/gnustep/Library/WindowMaker/.workspace_state file.
 */
#define SAVE_WORKSPACE	(SAVEWS > WORKSPACE_STATE_SCRIPT)


/*
 * SETGRADIENT(STYLEFILE) - sets a gradient scheme
 */

#define SETGRADIENT(STYLEFILE) \
	( ln -sf $HOME/gnustep/Library/WindowMaker/style/#STYLEFILE \
		$HOME/gnustep/Library/WindowMaker/default.style )


/*
 * SETTHEME(STYLEFILE,BACKDROP) - sets the gradient scheme and the background
 *					image
 */
#define SETTHEME(STYLEFILE,BACKDROP) SETGRADIENT(STYLEFILE) ; IMAGEROOT(BACKDROP)


#define StaticGray		0
#define GrayScale		1
#define StaticColor		2
#define PseudoColor		3
#define TrueColor		4
#define DirectColor		5
