a1693427efc22e3cb7ec2f69e2f8807d916fa836
[live-initramfs-grml.git] / scripts / live-bottom / 30accessibility
1 #!/bin/sh
2
3 #set -e
4
5 # initramfs-tools header
6
7 PREREQ=""
8
9 prereqs()
10 {
11         echo "${PREREQ}"
12 }
13
14 case "${1}" in
15         prereqs)
16                 prereqs
17                 exit 0
18                 ;;
19 esac
20
21 # live-initramfs header
22
23 if [ -n "${NOACCESSIBILITY}" ]
24 then
25         exit 0
26 fi
27
28 . /scripts/live-functions
29
30 if [ -z "${USERNAME}" ]
31 then
32         echo "No default user for accessibility options."
33         exit 0
34 fi
35
36 log_begin_msg "Configuring accessibility options"
37
38 # live-initramfs script
39
40 gconf_version=$(chroot /root /usr/bin/dpkg-query -W --showformat='${Version}' gconf2 2>/dev/null) || gconf_version=""
41
42 gct ()
43 {
44         if [ "${gconf_version}" ]
45         then
46                 chroot /root sudo -u "${USERNAME}" gconftool-2 "${@}"
47         fi
48 }
49
50 case ${ACCESS} in
51         access=v1)
52                 # Lesser Visual Impairment
53                 gct -s -t string /desktop/gnome/interface/gtk_theme HighContrastLargePrint
54                 gct -s -t string /desktop/gnome/interface/icon_theme HighContrast
55                 gct -s -t string /desktop/gnome/interface/monospace_font_name "monospace 18"
56                 gct -s -t string /desktop/gnome/interface/font_name "sans 18"
57                 gct -s -t string /apps/metacity/general/theme Atlanta
58                 gct -s -t string /desktop/gnome/background/picture_filename ""
59                 gct -s -t string /desktop/gnome/background/picture_options none
60                 gct -s -t string /desktop/gnome/background/primary_color \#666666
61                 gct -s -t string /desktop/gnome/background/secondary_color \#7F7F7F
62                 gct -s -t string /desktop/gnome/background/color_shading_type solid
63                 gct -s -t int /desktop/gnome/peripherals/mouse/cursor_size 48
64                 gct -s -t string /desktop/gnome/peripherals/mouse/cursor_theme whiteglass
65                 ;;
66
67         access=v2)
68                 # Moderate Visual Impairment
69                 gct -s -t bool /desktop/gnome/interface/accessibility true
70                 gct -s -t bool /desktop/gnome/applications/at/visual/startup true
71                 gct -s -t bool /apps/gksu/disable-grab true
72
73                 if type orca > /dev/null 2>&1
74                 then
75                         mkdir -p /root/home/${USERNAME}/.orca
76                         echo "import orca.settings" >> /root/home/${USERNAME}/.orca/user-settings.py
77                         echo "orca.settings.enableSpeech = False" >> /root/home/${USERNAME}/.orca/user-settings.py
78                         echo "orca.settings.enableMagnifier = True" >> /root/home/${USERNAME}/.orca/user-settings.py
79                         chroot /root chown -R ${USERNAME}:${USERNAME} /home/${USERNAME}/.orca
80                 fi
81                 ;;
82
83         access=v3)
84                 # Blindness
85                 # Disabled for now, until we know eSpeak works.
86                 #gct -s -t bool /desktop/gnome/sound/enable_esd false
87                 gct -s -t bool /desktop/gnome/interface/accessibility true
88                 gct -s -t bool /desktop/gnome/applications/at/visual/startup true
89                 gct -s -t bool /apps/gksu/disable-grab true
90                 gct -s -t string /desktop/gnome/applications/window_manager/default /usr/bin/metacity
91                 ;;
92
93         braille=ask)
94                 # Braille
95                 gct -s -t bool /desktop/gnome/interface/accessibility true
96                 gct -s -t bool /desktop/gnome/applications/at/visual/startup true
97                 gct -s -t bool /apps/gksu/disable-grab true
98                 gct -s -t string /desktop/gnome/applications/window_manager/default /usr/bin/metacity
99
100                 if type orca > /dev/null 2>&1
101                 then
102                         mkdir -p /root/home/${USERNAME}/.orca
103                         echo "import orca.settings" >> /root/home/${USERNAME}/.orca/user-settings.py
104                         echo "orca.settings.enableSpeech = False" >> /root/home/${USERNAME}/.orca/user-settings.py
105                         echo "orca.settings.enableBraille = True" >> /root/home/${USERNAME}/.orca/user-settings.py
106                         chroot /root chown -R ${USERNAME}:${USERNAME} /home/${USERNAME}/.orca
107                 fi
108                 ;;
109
110         access=m1)
111                 # Minor Motor Difficulties
112                 gct -s -t bool /desktop/gnome/accessibility/keyboard/enable true
113                 gct -s -t bool /desktop/gnome/accessibility/keyboard/mousekeys_enable true
114                 gct -s -t bool /desktop/gnome/accessibility/keyboard/stickykeys_enable true
115                 gct -s -t bool /desktop/gnome/accessibility/keyboard/stickykeys_modifier_beep true
116                 gct -s -t bool /desktop/accessibility/gnome/keyboard/stickykeys_two_key_off false
117                 gct -s -t bool /desktop/gnome/peripherals/keyboard/repeat true
118                 gct -s -t int /desktop/gnome/peripherals/keyboard/delay 700
119                 gct -s -t int /desktop/gnome/peripherals/keyboard/rate 10
120                 gct -s -t bool /apps/gksu/disable-grab true
121
122                 if [ -e /root/etc/xdg/xfce4/mcs_settings/keyboard.xml ]
123                 then
124                         sed -i 's/0/1/' /root/etc/xdg/xfce4/mcs_settings/keyboard.xml
125                 fi
126                 ;;
127
128         access=m2)
129                 # Motor Difficulties - pointing devices
130                 gct -s -t bool /desktop/gnome/accessibility/keyboard/enable true
131                 gct -s -t bool /desktop/gnome/interface/accessibility true
132                 gct -s -t bool /desktop/gnome/accessibility/keyboard/stickykeys_enable true
133                 gct -s -t bool /desktop/gnome/accessibility/keyboard/stickykeys_modifier_beep false
134                 gct -s -t bool /desktop/accessibility/gnome/keyboard/stickykeys_two_key_off false
135                 gct -s -t list --list-type=string /desktop/gnome/accessibility/startup/exec_ats [onboard]
136
137                 if [ -e /root/etc/xdg/xfce4/mcs_settings/keyboard.xml ]
138                 then
139                         sed -i '/Sticky/ s/0/1/' /root/etc/xdg/xfce4/mcs_settings/keyboard.xml
140                 fi
141                 ;;
142 esac
143
144 log_end_msg