#!/bin/sh

# install per-user-runsvdir in ~/sv
# drop available services in ~/.config/sv
# and link to ~/sv to enable them

user= # insert your username here

sed -i -e "s/\@USER\@/$user/g" sv/runsvdir/run

install -d /etc/sv/runsvdir-$user
install -m755 sv/runsvdir/run /etc/sv/runsvdir-$user/run
install -m755 sv/runsvdir/finish /etc/sv/runsvdir-$user/finish
ln -sf /run/runit/supervise.runsvdir-$user /etc/sv/runsvdir-$user/supervise

# patch bspwm to be run with dbus session
cp /usr/share/xsessions/bspwm.desktop /usr/share/xsessions/bspwm-dbus.desktop
sed -i -e 's/Exec=*/dbus-launch --exit-with-x11 bspwm/g' /usr/share/xsession/bspwm-dbus.desktop
