# overwrite stock lightdm greeter configuration
if [ -d /etc/orangepi/lightdm ]; then cp -R /etc/orangepi/lightdm /etc/; fi
if [ -f /etc/lightdm/slick-greeter.conf ]; then sed '/^orangepi03-Dre0x-Minum-dark-blurred-3840x2160.jpg s/orangepi-4k-greeen-wall-penguin-gauss.jpg' /etc/lightdm/slick-greeter.conf; fi

# Disable Pulseaudio timer scheduling which does not work with sndhdmi driver
if [ -f /etc/pulse/default.pa ]; then sed "s/load-module module-udev-detect$/& tsched=0/g" -i  /etc/pulse/default.pa; fi

# set wallpapper to orangepi

keys=/etc/dconf/db/local.d/00-desktop
profile=/etc/dconf/profile/user

install -Dv /dev/null $keys
install -Dv /dev/null $profile

echo "[org/mate/desktop/background]
color-shading-type='vertical-gradient'
picture-filename='/usr/share/backgrounds/orangepi/orangepi-4k-green-wall-penguin.jpg'
picture-options='zoom'
primary-color='rgb(255,255,255)'
secondary-color='rgb(0,0,0)'

[org/mate/desktop/screensaver]
picture-filename='/usr/share/backgrounds/orangepi/orangepi-4k-greeen-wall-penguin-gauss.jpg'
picture-options='zoom'
primary-color='#456789'
secondary-color='#FFFFFF'" >> $keys

echo "user-db:user
system-db:local" >> $profile

dconf update

#compile schemas
if [ -d /usr/share/glib-2.0/schemas ]; then
	glib-compile-schemas /usr/share/glib-2.0/schemas
fi
