# Toss redundant sample files:
for file in pipewire.desktop pipewire-pulse.desktop ; do
  cmp -s etc/xdg/autostart/${file} etc/xdg/autostart/${file}.sample && rm etc/xdg/autostart/${file}.sample
done

# Disable pulseaudio.desktop:
if [ -r etc/xdg/autostart/pulseaudio.desktop ]; then
  if ! grep -q "^Hidden=true$" etc/xdg/autostart/pulseaudio.desktop ; then
    echo "Hidden=true" >> etc/xdg/autostart/pulseaudio.desktop
  fi
fi

# Pipewire is now the default multimedia server, so if we see pulseaudio
# running let's kill it so that it doesn't interfere:
killall --ns $$ /usr/bin/pulseaudio 1> /dev/null 2> /dev/null

# Recompile glib schemas:
if [ -e usr/share/glib-2.0/schemas ]; then
  if [ -x /usr/bin/glib-compile-schemas ]; then
    /usr/bin/glib-compile-schemas usr/share/glib-2.0/schemas >/dev/null 2>&1
  fi
fi
