#Packager: George Vlahavas <vlahavas~at~gmail~dot~com>

pkgname=pekwm
pkgver=0.1.12
pkgrel=2gv
source=("http://www.pekwm.org/projects/pekwm/files/pekwm-$pkgver.tar.gz" "pekwm.desktop" "xinitrc.pekwm" "gilouche.tar.gz" "menu" "vars")
docs=("readme" "install" "copying" "changelog*" "authors" "news" "todo" "license")
url=http://pekwm.org/projects/pekwm
dotnew=('etc/pekwm/vars' 'etc/pekwm/start' 'etc/pekwm/mouse' 'etc/pekwm/menu' 'etc/pekwm/keys' 'etc/pekwm/config' 'etc/pekwm/autoproperties')
options=('noautodotnew' 'nosrcpack')

slackdesc=\
(
#|-----handy-ruler------------------------------------------------------|
"pekwm (The Pek Window Manager)"
"pekwm is a window manager that once upon a time was based on the"
"aewm++ window manager, but it has evolved enough that it no longer"
"resembles aewm++ at all. It has a much expanded feature-set, including"
"window grouping (similar to ion, pwm, or fluxbox), autoproperties,"
"xinerama, keygrabber that supports keychains, and much more."
)


build() {
	cd $startdir/src/$pkgname-$pkgver
	./configure --prefix=/usr --libdir=/usr/lib${LIBDIRSUFFIX} --localstatedir=/var --sysconfdir=/etc --build=$arch-slackware-linux
	make || return 1
	make install DESTDIR=$startdir/pkg

	mkdir -p $startdir/pkg/usr/share/xsessions
	cp $startdir/src/pekwm.desktop $startdir/pkg/usr/share/xsessions/
	mkdir -p $startdir/pkg/etc/X11/xinit
	cp $startdir/src/xinitrc.pekwm $startdir/pkg/etc/X11/xinit/
	chmod 755 $startdir/pkg/etc/X11/xinit/xinitrc.pekwm

	# Change default theme to giilouche
	cp -R $startdir/src/gilouche $startdir/pkg/usr/share/pekwm/themes/
	sed -i "s|Theme =.*|Theme = \"/usr/share/pekwm/themes/gilouche\"|" $startdir/pkg/etc/pekwm/config

	# Other default settings
	sed -i "s/Workspaces =.*/Workspaces = \"4\"/" $startdir/pkg/etc/pekwm/config
	sed -i "s/WorkspacesPerRow =.*/WorkspacesPerRow = \"4\"/" $startdir/pkg/etc/pekwm/config
	sed -i "s/WorkspaceNames =.*/WorkspaceNames = \"Main;Web;Music;Work\"/" $startdir/pkg/etc/pekwm/config
	cp -f $startdir/src/vars $startdir/pkg/etc/pekwm/vars

	# Replace default menu
	cp -f $startdir/src/menu $startdir/pkg/etc/pekwm/menu
}