Skip to main content
#!/bin/bash
#
# 1. Install Mate
# 2. Install lightdm
# 3. Install orca
# 4. Configure lightdm
# 5. Set gsettings switches for root
#

if [ `whoami` != 'root' ]; then
    echo 'Script must be run as root'
    exit 1
fi

set -e

# Install Mate, the lightdm desktop manager and orca
echo 'Installing a bunch of stuff, this will take a long time...'
apt-get install -yq mate-core mate-desktop-environment lightdm gnome-orca

# Make some changes to the speech-dispatcher config file
# Make the audio output method alsa
echo 'Configuring speech-dispatcher to use alsa...'
sed -i 's|# AudioOutputMethod "pulse"| AudioOutputMethod "alsa"|' /etc/speech-dispatcher/speechd.conf
# uncomment the AddModule espeak directive
echo 'Configuring speech-dispatcher modules...'
sed -i 's|#\(AddModule "espeak"\)|\1|' /etc/speech-dispatcher/speechd.conf
# uncomment the DefaultModule espeak directive
sed -i 's|#\(DefaultModule "espeak"\)|\1|' /etc/speech-dispatcher/speechd.conf

# Prevent pulseaudio from autospawning
echo 'Configuring pulseaudio to stop it autospawning...'
sed -i 's|; autospawn = yes|autospawn = no|' /etc/pulse/client.conf

# Remove pulseaudio config files from alsa config paths
echo 'Deleting pulse config files from /usr/share/alsa...'
rm /usr/share/alsa/pulse*
rm /usr/share/alsa/alsa.conf.d/*pulse*

# remove unnecessary speech-dispatcher modules
echo 'Removing unused speech-dispatcher modules...'
rm /usr/lib/speech-dispatcher-modules/sd_generic
rm /usr/lib/speech-dispatcher-modules/sd_cicero	
rm /usr/lib/speech-dispatcher-modules/sd_flite

# Stop unrelated stuff from starting pulseaudio
echo 'Stopping unrelated and unused stuff from starting pulseaudio...'
chmod -x /usr/bin/start-pulse*

# Configure lightdm with an orca wrapper
echo 'Configuring the lightdm desktop manager with an Orca wrapper...'
sed -i 's|#greeter-wrapper=$|greeter-wrapper=/usr/bin/orca-dm-wrapper|' /etc/lightdm/lightdm.conf

# add the lightdm user to the audio group
usermod -a -G audio lightdm

# Set accessibility switches
echo 'Setting accessibility switches for root user...'
dbus-launch gsettings set org.mate.interface accessibility true
dbus-launch gsettings set org.gnome.desktop.a11y.applications screen-reader-enabled true

# Switch off icons in menus and buttons
echo 'Switching off menu and button icons for root user...'
dbus-launch gsettings set org.mate.interface menus-have-icons false
dbus-launch gsettings set org.mate.interface buttons-have-icons false

exit 0