# Depends on rxvt-unicode (used instead of uxterm)

# Exit on error:
set -e

wget http://dl.suckless.org/dwm/dwm-6.0.tar.gz
tar xf dwm-6.0.tar.gz
cd dwm-6.0

sed -i '/^PREFIX/s|/local||' config.mk
sed -i '/^XINERAMA/s/^/#/' config.mk
sed -i '/^CFLAGS/s/Os/O2/' config.mk

# Replace uxterm with urxvt
cp config.def.h config.h
sed -i 's/uxterm/urxvt/' config.h

make clean install

cd ..

cat > .xinitrc << EOF
while true; do
    xsetroot -name \"$( date +"%e %B %R" )\"
    sleep 1m
done &
exec dwm
EOF

echo "You can copy .xinitrc to your user's home"

exit 0
