#!/bin/sh

# Run user configured autostart
$HOME/.ewm/autostart.sh &

# Compositor (picom)
# Terminate already running picom instances
killall -q picom

# Wait until the processes have been shut down
while pgrep -u $UID -x picom >/dev/null; do sleep 1; done

# Launch picom
picom --config $HOME/.config/picom/picom.conf --experimental-backends --xrender-sync-fence &

# Background (nitrogen)
nitrogen --restore &

# Loop
while true; do
	ewm > /dev/null 2>&1
done

# WM
exec ewm