Adding upstream version 3.0~a26.
[debian-live-boot.git] / scripts / live-bottom / 30accessibility
blob4ed1c6d62119c047b6345c5399a53e8eeeb33291
1 #!/bin/sh
3 #set -e
5 # initramfs-tools header
7 PREREQ=""
9 prereqs()
11 echo "${PREREQ}"
14 case "${1}" in
15 prereqs)
16 prereqs
17 exit 0
19 esac
21 # live-boot header
23 if [ -n "${NOACCESSIBILITY}" ]
24 then
25 exit 0
28 . /scripts/live-functions
30 if [ -z "${USERNAME}" ]
31 then
32 echo "No default user for accessibility options."
33 exit 0
36 log_begin_msg "Configuring accessibility options"
38 # live-boot script
40 gconf_version=$(chroot /root /usr/bin/dpkg-query -W --showformat='${Version}' gconf2 2>/dev/null) || gconf_version=""
42 gct ()
44 if [ "${gconf_version}" ]
45 then
46 chroot /root sudo -u "${USERNAME}" gconftool-2 "${@}"
50 remove_applet ()
52 # Code to remove an applet from the default panel setup
53 # This is rather hacky, but I can't think of a one or two line regular
54 # expression to do this any more efficiently. Patches welcome. In
55 # addition, setting these via gconf also doesn't work for some reason.
57 local line_no prior_line next_line
59 line_no="$(grep -n "<string>$1</string>" /root/usr/share/gconf/defaults/05_panel-default-setup.entries | cut -f 1 -d :)"
60 [ "$line_no" ] || return
61 prior_line="$((line_no-1))"
62 next_line="$((line_no+1))"
64 sed -i -n "${prior_line},${next_line}!p" /root/usr/share/gconf/defaults/05_panel-default-setup.entries
66 chroot /root update-gconf-defaults
69 add_sudoers_file ()
72 cat <<EOF > /root/etc/sudoers.d/a11y-sudo
73 # TO allow accessibility in GTK to work with sudo.
74 Defaults env_keep = "ORBIT_SOCKETDIR XDG_SESSION_COOKIE GTK_MODULES"
75 EOF
77 chmod 0440 /root/etc/sudoers.d/a11y-sudo
80 case ${ACCESS} in
81 access=v1)
82 # Lesser Visual Impairment
83 gct -s -t string /desktop/gnome/interface/gtk_theme HighContrastLargePrint
84 gct -s -t string /desktop/gnome/interface/icon_theme HighContrast
85 gct -s -t string /desktop/gnome/interface/monospace_font_name "monospace 18"
86 gct -s -t string /desktop/gnome/interface/font_name "sans 18"
87 gct -s -t string /apps/metacity/general/theme Atlanta
88 gct -s -t string /desktop/gnome/background/picture_filename ""
89 gct -s -t string /desktop/gnome/background/picture_options none
90 gct -s -t string /desktop/gnome/background/primary_color \#666666
91 gct -s -t string /desktop/gnome/background/secondary_color \#7F7F7F
92 gct -s -t string /desktop/gnome/background/color_shading_type solid
93 gct -s -t int /desktop/gnome/peripherals/mouse/cursor_size 48
94 gct -s -t string /desktop/gnome/peripherals/mouse/cursor_theme whiteglass
97 access=v2)
98 # Moderate Visual Impairment
99 gct -s -t bool /desktop/gnome/interface/accessibility true
100 gct -s -t bool /desktop/gnome/applications/at/visual/startup true
101 gct -s -t string /desktop/gnome/applications/at/visual/exec orca
102 gct -s -t bool /apps/gksu/disable-grab true
103 gct -s -t string /desktop/gnome/applications/window_manager/default /usr/bin/metacity
104 add_sudoers_file
106 if [ -x /root/usr/bin/orca ]
107 then
108 mkdir -p /root/home/${USERNAME}/.orca
109 echo "import orca.settings" >> /root/home/${USERNAME}/.orca/user-settings.py
110 echo "orca.settings.enableSpeech = False" >> /root/home/${USERNAME}/.orca/user-settings.py
111 echo "orca.settings.enableMagnifier = True" >> /root/home/${USERNAME}/.orca/user-settings.py
112 chroot /root chown -R ${USERNAME}:${USERNAME} /home/${USERNAME}/.orca
116 access=v3)
117 # Blindness
118 # Disabled for now, until we know eSpeak works.
119 #gct -s -t bool /desktop/gnome/sound/enable_esd false
120 gct -s -t bool /desktop/gnome/interface/accessibility true
121 gct -s -t bool /desktop/gnome/applications/at/visual/startup true
122 gct -s -t string /desktop/gnome/applications/at/visual/exec orca
123 gct -s -t string /apps/empathy/conversation/theme classic
124 gct -s -t bool /apps/gksu/disable-grab true
125 gct -s -t string /desktop/gnome/applications/window_manager/default /usr/bin/metacity
126 add_sudoers_file
128 remove_applet fast_user_switch
129 if [ -x /root/usr/bin/orca ]
130 then
131 mkdir -p /root/home/$USERNAME/.orca
132 chroot /root chown -R $USERNAME.$USERNAME /home/$USERNAME/.orca
136 braille=ask)
137 # Braille
138 gct -s -t bool /desktop/gnome/interface/accessibility true
139 gct -s -t bool /desktop/gnome/applications/at/visual/startup true
140 gct -s -t string /desktop/gnome/applications/at/visual/exec orca
141 gct -s -t bool /apps/gksu/disable-grab true
142 gct -s -t string /desktop/gnome/applications/window_manager/default /usr/bin/metacity
143 gct -s -t string /apps/empathy/conversation/theme classic
144 add_sudoers_file
146 if [ -x /root/usr/bin/orca ]
147 then
148 mkdir -p /root/home/${USERNAME}/.orca
149 echo "import orca.settings" >> /root/home/${USERNAME}/.orca/user-settings.py
150 echo "orca.settings.enableSpeech = False" >> /root/home/${USERNAME}/.orca/user-settings.py
151 echo "orca.settings.enableBraille = True" >> /root/home/${USERNAME}/.orca/user-settings.py
152 laptop_detect
153 chroot /root chown -R ${USERNAME}:${USERNAME} /home/${USERNAME}/.orca
156 remove_applet fast_user_switch
159 access=m1)
160 # Minor Motor Difficulties
161 gct -s -t bool /desktop/gnome/accessibility/keyboard/enable true
162 gct -s -t bool /desktop/gnome/accessibility/keyboard/mousekeys_enable true
163 gct -s -t bool /desktop/gnome/accessibility/keyboard/stickykeys_enable true
164 gct -s -t bool /desktop/gnome/accessibility/keyboard/stickykeys_modifier_beep true
165 gct -s -t bool /desktop/accessibility/gnome/keyboard/stickykeys_two_key_off false
166 gct -s -t bool /desktop/gnome/peripherals/keyboard/repeat true
167 gct -s -t int /desktop/gnome/peripherals/keyboard/delay 700
168 gct -s -t int /desktop/gnome/peripherals/keyboard/rate 10
169 gct -s -t bool /apps/gksu/disable-grab true
171 if [ -e /root/etc/xdg/xfce4/mcs_settings/keyboard.xml ]
172 then
173 sed -i 's/0/1/' /root/etc/xdg/xfce4/mcs_settings/keyboard.xml
177 access=m2)
178 # Motor Difficulties - pointing devices
179 gct -s -t bool /desktop/gnome/accessibility/keyboard/enable true
180 gct -s -t bool /desktop/gnome/interface/accessibility true
181 gct -s -t bool /desktop/gnome/accessibility/keyboard/stickykeys_enable true
182 gct -s -t bool /desktop/gnome/accessibility/keyboard/stickykeys_modifier_beep false
183 gct -s -t bool /desktop/accessibility/gnome/keyboard/stickykeys_two_key_off false
184 gct -s -t list --list-type=string /desktop/gnome/accessibility/startup/exec_ats [onboard]
186 if [ -e /root/etc/xdg/xfce4/mcs_settings/keyboard.xml ]
187 then
188 sed -i '/Sticky/ s/0/1/' /root/etc/xdg/xfce4/mcs_settings/keyboard.xml
191 esac
193 log_end_msg