wmii

git clone git://oldgit.suckless.org/wmii/
Log | Files | Refs | README | LICENSE

wihack.sh (822B)


      1 #!/bin/sh -f
      2 unset WMII_HACK_TRANSIENT WMII_HACK_TYPE WMII_HACK_TAGS
      3 
      4 usage() {
      5 	echo 1>&2 Usage: \
      6 	"$0 [-transient <window>] [-type <window_type>[,...]] [-tags <tags>] <command> [<arg> ...]"
      7 	exit 1
      8 }
      9 
     10 checkarg='[ ${#@} -gt 0 ] || usage'
     11 export WMII_HACK_TIME=$(date +%s)
     12 
     13 while [ ${#@} -gt 0 ]
     14 do
     15 	case $1 in
     16 	-transient)
     17 		shift; eval $checkarg
     18 		export WMII_HACK_TRANSIENT=$1
     19 		shift;;
     20 	-type)
     21 		shift; eval $checkarg
     22 		export WMII_HACK_TYPE=$1
     23 		shift;;
     24 	-tags)
     25 		shift; eval $checkarg
     26 		export WMII_HACK_TAGS=$1
     27 		shift;;
     28 	-*)
     29 		usage;;
     30 	*)
     31 		break;;
     32 	esac
     33 done
     34 
     35 eval $checkarg
     36 
     37 if [ ! -u "`which $1`" -a ! -g "`which $1`" ]
     38 then
     39 	export LD_PRELOAD=libwmii_hack.so
     40 	export LD_LIBRARY_PATH="@LIBDIR@${LD_LIBRARY_PATH:+:}${LD_LIBRARY_PATH}"
     41 else
     42 	unset WMII_HACK_TRANSIENT WMII_HACK_TYPE WMII_HACK_TAGS
     43 fi
     44 exec "$@"
     45