summaryrefslogtreecommitdiff
path: root/scripts/live-bottom/30accessibility
blob: 127c48fbe1009f260ff75863b20292e2ec17ba40 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#!/bin/sh

PREREQ=""
DESCRIPTION="Configuring accessibility options..."

. /scripts/live-functions

prereqs()
{
       echo "$PREREQ"
}

case $1 in
# get pre-requisites
prereqs)
       prereqs
       exit 0
       ;;
esac

log_begin_msg "$DESCRIPTION"

gconf_version=$(chroot /root /usr/bin/dpkg-query -W --showformat='${Version}' gconf2 2>/dev/null) || gconf_version=""

gct() {
    if [ "$gconf_version" ]; then
        chroot /root sudo -u "$USERNAME" gconftool-2 "$@"
    fi
}

kderc_addtoprefixes() {
    if [ -e "/root/etc/kderc" ]; then
        sed -i "s|\\(prefixes=/usr/share/kubuntu-default-settings/kde-profile/default/\\)|\\1,$1|" /root/etc/kderc
    fi
}

for x in $(cat /proc/cmdline); do
                case $x in
                        # Lesser Visual Impairment
                        access=v1)
                        gct -s -t string /desktop/gnome/interface/gtk_theme HighContrastLargePrint
                        gct -s -t string /desktop/gnome/interface/icon_theme HighContrast
                        gct -s -t string /desktop/gnome/interface/monospace_font_name "monospace 18"
                        gct -s -t string /desktop/gnome/interface/font_name "sans 18"
                        gct -s -t string /apps/metacity/general/theme Atlanta
                        gct -s -t string /desktop/gnome/background/picture_filename ""
                        gct -s -t string /desktop/gnome/background/picture_options none
                        gct -s -t string /desktop/gnome/background/primary_color \#666666
                        gct -s -t string /desktop/gnome/background/secondary_color \#7F7F7F
                        gct -s -t string /desktop/gnome/background/color_shading_type solid
                        gct -s -t int /desktop/gnome/peripherals/mouse/cursor_size 48
                        gct -s -t string /desktop/gnome/peripherals/mouse/cursor_theme whiteglass

                        kderc_addtoprefixes /usr/share/kubuntu-default-settings/kde-profile/lesser-visual-impairment/
                        if [ -d /root/usr/share/xubuntu-default-settings/accessibility ]; then
                            cp -a /root/usr/share/xubuntu-default-settings/accessibility/* /root/etc/xdg/
                        fi
                        ;;
                        # Moderate Visual Impairment
                        access=v2)
                        gct -s -t bool /desktop/gnome/interface/accessibility true
                        gct -s -t list --list-type=string /desktop/gnome/accessibility/startup/exec_ats [orca]
                        if [ -e /root/usr/share/pycentral/gnome-orca/site-packages/orca/settings.py ]; then
                            sed -i '/^enableSpeech\W/ s/True/False/;/^enableMagnifier/ s/False/True/' /root/usr/share/pycentral/gnome-orca/site-packages/orca/settings.py
                        fi
                        kderc_addtoprefixes /usr/share/kubuntu-default-settings/kde-profile/lesser-visual-impairment/,/usr/share/kubuntu-default-settings/kde-profile/moderate-visual-impairment/
                        ;;
                        # Blindness
                        access=v3)
                        gct -s -t bool /desktop/gnome/sound/enable_esd false
                        gct -s -t bool /desktop/gnome/interface/accessibility true
                        gct -s -t list --list-type=string /desktop/gnome/accessibility/startup/exec_ats [orca]
                        ;;
                        # Minor Motor Difficulties
                        access=m1)
                        gct -s -t bool /desktop/gnome/accessibility/keyboard/enable true
                        gct -s -t bool /desktop/gnome/accessibility/keyboard/mousekeys_enable true
                        gct -s -t bool /desktop/gnome/accessibility/keyboard/stickykeys_enable true
                        gct -s -t bool /desktop/gnome/accessibility/keyboard/stickykeys_modifier_beep true
                        gct -s -t bool /desktop/accessibility/gnome/keyboard/stickykeys_two_key_off false
                        gct -s -t bool /desktop/gnome/peripherals/keyboard/repeat true
                        gct -s -t int /desktop/gnome/peripherals/keyboard/delay 700
                        gct -s -t int /desktop/gnome/peripherals/keyboard/rate 10

                        kderc_addtoprefixes /usr/share/kubuntu-default-settings/kde-profile/minor-motor-difficulties/
                        if [ -e /root/etc/xdg/xfce4/mcs_settings/keyboard.xml ]; then
                            sed -i 's/0/1/' /root/etc/xdg/xfce4/mcs_settings/keyboard.xml
                        fi 
                        ;;
                        # Motor Difficulties - pointing devices
                        access=m2)
                        gct -s -t bool /desktop/gnome/accessibility/keyboard/enable true
			gct -s -t bool /desktop/gnome/interface/accessibility true
                        gct -s -t bool /desktop/gnome/accessibility/keyboard/stickykeys_enable true
                        gct -s -t bool /desktop/gnome/accessibility/keyboard/stickykeys_modifier_beep false
                        gct -s -t bool /desktop/accessibility/gnome/keyboard/stickykeys_two_key_off false
                        gct -s -t list --list-type=string /desktop/gnome/accessibility/startup/exec_ats [onboard]

                        kderc_addtoprefixes /usr/share/kubuntu-default-settings/kde-profile/minor-motor-difficulties/,/usr/share/kubuntu-default-settings/kde-profile/motor-difficulties-pointing-devices/
                        if [ -e /root/etc/xdg/xfce4/mcs_settings/keyboard.xml ]; then
                            sed -i '/Sticky/ s/0/1/' /root/etc/xdg/xfce4/mcs_settings/keyboard.xml
                        fi 
                        ;;
		esac
done
log_end_msg