~ubuntu-branches/ubuntu/lucid/casper/lucid

145 by Tollef Fog Heen
Add initial accessibility support framework
1
#!/bin/sh
458 by Evan Dandrea
Put in a warning to modify both 30acessibility files.
2
# If you change this, please also change the copy in ubiquity-hooks/30accessibility.
145 by Tollef Fog Heen
Add initial accessibility support framework
3
4
PREREQ=""
223 by Tollef Fog Heen
Add ... to the end of all usplash messages. Malone #43856
5
DESCRIPTION="Configuring accessibility options..."
145 by Tollef Fog Heen
Add initial accessibility support framework
6
7
prereqs()
8
{
9
       echo "$PREREQ"
10
}
11
12
case $1 in
13
# get pre-requisites
14
prereqs)
15
       prereqs
16
       exit 0
17
       ;;
18
esac
19
825 by Colin Watson, Scott James Remnant, Colin Watson
[ Scott James Remnant ]
20
. /scripts/casper-functions
21
145 by Tollef Fog Heen
Add initial accessibility support framework
22
log_begin_msg "$DESCRIPTION"
146.2.1 by Luke Yelavich
Added settings for Accessibility profiles.
23
324 by Colin Watson
* Fix check for presence of gconf2 (closes: Malone #58836).
24
gconf_version=$(chroot /root /usr/bin/dpkg-query -W --showformat='${Version}' gconf2 2>/dev/null) || gconf_version=""
293 by Tollef Fog Heen
Only run gconftool-2 if gconf-2 is actually installed
25
149 by Tollef Fog Heen
get rid of "write-script-then-run-it hack in 30accessibility
26
gct() {
293 by Tollef Fog Heen
Only run gconftool-2 if gconf-2 is actually installed
27
    if [ "$gconf_version" ]; then
28
        chroot /root sudo -u "$USERNAME" gconftool-2 "$@"
29
    fi
149 by Tollef Fog Heen
get rid of "write-script-then-run-it hack in 30accessibility
30
}
146.2.1 by Luke Yelavich
Added settings for Accessibility profiles.
31
292 by Tollef Fog Heen
Use functions to avoid ever-long lines as well as looking at /root/etc/kderc, not /etc/kderc in the initramfs
32
kderc_addtoprefixes() {
559 by Jonathan Riddell
Use kde4rc now for accessibility profiles
33
    if [ -e "/root/etc/kde4rc" ]; then
34
        sed -i "s|\\(prefixes=/usr/share/kubuntu-default-settings/kde-profile/default/\\)|\\1,$1|" /root/etc/kde4rc
292 by Tollef Fog Heen
Use functions to avoid ever-long lines as well as looking at /root/etc/kderc, not /etc/kderc in the initramfs
35
    fi
36
}
579 by Luke Yelavich
* scripts/casper-bottom/30accessibility && ubiquity-hooks/30accessibility:
37
38
# Code to remove an applet from the default panel setup
39
# This is rather hacky, but I can't think of a one or two line regular
40
# expression to do this any more efficiently. Patches welcome.
41
# In addition, setting these via gconf also doesn't work for some reason.
42
remove_applet()
43
{
44
	local line_no prior_line next_line
45
46
	line_no=$(grep -n "<string>$1</string>" /root/usr/share/gconf/defaults/05_panel-default-setup.entries | cut -f 1 -d :)
676 by Colin Watson
Don't produce an invalid sed program when trying to remove an applet
47
	[ "$line_no" ] || return
579 by Luke Yelavich
* scripts/casper-bottom/30accessibility && ubiquity-hooks/30accessibility:
48
	prior_line=$((line_no-1))
49
	next_line=$((line_no+1))
50
	sed -i -n "${prior_line},${next_line}!p" /root/usr/share/gconf/defaults/05_panel-default-setup.entries
51
	chroot /root update-gconf-defaults
52
}
53
146.2.1 by Luke Yelavich
Added settings for Accessibility profiles.
54
for x in $(cat /proc/cmdline); do
55
                case $x in
56
                        # Lesser Visual Impairment
57
                        access=v1)
210.2.1 by themuso at ubuntu
* Fixed some typos, and added missing settings to some accessibility
58
                        gct -s -t string /desktop/gnome/interface/gtk_theme HighContrastLargePrint
59
                        gct -s -t string /desktop/gnome/interface/icon_theme HighContrast
237.1.1 by themuso at ubuntu
* Set large print fonts for the v1 accessibility profile. Closes Malone #45376.
60
                        gct -s -t string /desktop/gnome/interface/monospace_font_name "monospace 18"
61
                        gct -s -t string /desktop/gnome/interface/font_name "sans 18"
210.2.1 by themuso at ubuntu
* Fixed some typos, and added missing settings to some accessibility
62
                        gct -s -t string /apps/metacity/general/theme Atlanta
63
                        gct -s -t string /desktop/gnome/background/picture_filename ""
64
                        gct -s -t string /desktop/gnome/background/picture_options none
328 by Colin Watson
* Remove spurious quoting from accessibility script.
65
                        gct -s -t string /desktop/gnome/background/primary_color \#666666
66
                        gct -s -t string /desktop/gnome/background/secondary_color \#7F7F7F
210.2.1 by themuso at ubuntu
* Fixed some typos, and added missing settings to some accessibility
67
                        gct -s -t string /desktop/gnome/background/color_shading_type solid
68
                        gct -s -t int /desktop/gnome/peripherals/mouse/cursor_size 48
69
                        gct -s -t string /desktop/gnome/peripherals/mouse/cursor_theme whiteglass
292 by Tollef Fog Heen
Use functions to avoid ever-long lines as well as looking at /root/etc/kderc, not /etc/kderc in the initramfs
70
294 by Tollef Fog Heen
s/imparement/impairment/
71
                        kderc_addtoprefixes /usr/share/kubuntu-default-settings/kde-profile/lesser-visual-impairment/
339 by Jani Monoses
make v2 start orca in magnifier mode. Add all xubuntu options
72
                        if [ -d /root/usr/share/xubuntu-default-settings/accessibility ]; then
73
                            cp -a /root/usr/share/xubuntu-default-settings/accessibility/* /root/etc/xdg/
74
                        fi
149 by Tollef Fog Heen
get rid of "write-script-then-run-it hack in 30accessibility
75
                        ;;
146.2.1 by Luke Yelavich
Added settings for Accessibility profiles.
76
                        # Moderate Visual Impairment
77
                        access=v2)
210.2.1 by themuso at ubuntu
* Fixed some typos, and added missing settings to some accessibility
78
                        gct -s -t bool /desktop/gnome/interface/accessibility true
551 by Luke Yelavich
* scripts/casper-bottom/30accessibility &
79
                        gct -s -t bool /desktop/gnome/applications/at/visual/startup true
80
                        gct -s -t string /desktop/gnome/applications/at/visual/exec orca
532 by Luke Yelavich
* scripts/casper-bottom/30accessibility &
81
			if [ -x /root/usr/bin/orca ]; then
462 by Evan Dandrea
* Fix setting orca options in 30accessibility.
82
				mkdir -p /root/home/$USERNAME/.orca
489 by Luke Yelavich
* scripts/casper-bottom/30accessibility &
83
				echo "import orca.settings" >> /root/home/$USERNAME/.orca/user-settings.py
84
				echo "orca.settings.enableSpeech = False" >> /root/home/$USERNAME/.orca/user-settings.py
85
				echo "orca.settings.enableMagnifier = True" >> /root/home/$USERNAME/.orca/user-settings.py
86
				chroot /root chown -R $USERNAME.$USERNAME /home/$USERNAME/.orca
462 by Evan Dandrea
* Fix setting orca options in 30accessibility.
87
			fi
378.1.1 by Luke Yelavich
* scripts/casper-bottom/30accessibility &
88
                        gct -s -t bool /apps/gksu/disable-grab true
541 by Luke Yelavich
* scripts/casper-bottom/30accessibility &
89
                        gct -s -t string /desktop/gnome/applications/window_manager/default /usr/bin/metacity
585 by Luke Yelavich
* scripts/casper-bottom/30accessibility && ubiquity-hooks/30accessibility:
90
                        sed -i -e 's/# Host alias specification/Defaults\tenv_keep = "ORBIT_SOCKETDIR XDG_SESSION_COOKIE GTK_MODULES"\n\n# Host alias specification/g' /root/etc/sudoers
294 by Tollef Fog Heen
s/imparement/impairment/
91
                        kderc_addtoprefixes /usr/share/kubuntu-default-settings/kde-profile/lesser-visual-impairment/,/usr/share/kubuntu-default-settings/kde-profile/moderate-visual-impairment/
149 by Tollef Fog Heen
get rid of "write-script-then-run-it hack in 30accessibility
92
                        ;;
146.2.1 by Luke Yelavich
Added settings for Accessibility profiles.
93
                        # Blindness
94
                        access=v3)
210.2.1 by themuso at ubuntu
* Fixed some typos, and added missing settings to some accessibility
95
                        gct -s -t bool /desktop/gnome/interface/accessibility true
378.1.1 by Luke Yelavich
* scripts/casper-bottom/30accessibility &
96
                        gct -s -t bool /apps/gksu/disable-grab true
469 by Luke Yelavich
* scripts/casper-bottom/30accessibility &
97
                        gct -s -t string /desktop/gnome/applications/window_manager/default /usr/bin/metacity
551 by Luke Yelavich
* scripts/casper-bottom/30accessibility &
98
                        gct -s -t bool /desktop/gnome/applications/at/visual/startup true
99
                        gct -s -t string /desktop/gnome/applications/at/visual/exec orca
831 by Colin Watson, Luke Yelavich, Jamie Bennett
[ Luke Yelavich ]
100
                        gct -s -t string /apps/empathy/conversation/theme classic                        
579 by Luke Yelavich
* scripts/casper-bottom/30accessibility && ubiquity-hooks/30accessibility:
101
                        remove_applet fast_user_switch
585 by Luke Yelavich
* scripts/casper-bottom/30accessibility && ubiquity-hooks/30accessibility:
102
                        sed -i -e 's/# Host alias specification/Defaults\tenv_keep = "ORBIT_SOCKETDIR XDG_SESSION_COOKIE GTK_MODULES"\n\n# Host alias specification/g' /root/etc/sudoers
603 by Luke Yelavich
Only set pulseaudio settings and create the .orca directory if sed
103
			if [ -x /root/usr/bin/orca ]; then
104
				mkdir -p /root/home/$USERNAME/.orca
105
				chroot /root chown -R $USERNAME.$USERNAME /home/$USERNAME/.orca
106
			fi
149 by Tollef Fog Heen
get rid of "write-script-then-run-it hack in 30accessibility
107
                        ;;
378.1.3 by Luke Yelavich
* Start Orca when a Braille device is configured from choosing the
108
                        # Braille
109
                        braille=ask)
110
                        gct -s -t bool /desktop/gnome/interface/accessibility true
551 by Luke Yelavich
* scripts/casper-bottom/30accessibility &
111
                        gct -s -t bool /desktop/gnome/applications/at/visual/startup true
112
                        gct -s -t string /desktop/gnome/applications/at/visual/exec orca
532 by Luke Yelavich
* scripts/casper-bottom/30accessibility &
113
			if [ -x /root/usr/bin/orca ]; then
462 by Evan Dandrea
* Fix setting orca options in 30accessibility.
114
				mkdir -p /root/home/$USERNAME/.orca
489 by Luke Yelavich
* scripts/casper-bottom/30accessibility &
115
				echo "import orca.settings" >> /root/home/$USERNAME/.orca/user-settings.py
116
				echo "orca.settings.enableSpeech = False" >> /root/home/$USERNAME/.orca/user-settings.py
117
				echo "orca.settings.enableBraille = True" >> /root/home/$USERNAME/.orca/user-settings.py
118
				chroot /root chown -R $USERNAME.$USERNAME /home/$USERNAME/.orca
462 by Evan Dandrea
* Fix setting orca options in 30accessibility.
119
			fi
378.1.3 by Luke Yelavich
* Start Orca when a Braille device is configured from choosing the
120
                        gct -s -t bool /apps/gksu/disable-grab true
469 by Luke Yelavich
* scripts/casper-bottom/30accessibility &
121
                        gct -s -t string /desktop/gnome/applications/window_manager/default /usr/bin/metacity
831 by Colin Watson, Luke Yelavich, Jamie Bennett
[ Luke Yelavich ]
122
                        gct -s -t string /apps/empathy/conversation/theme classic                        
579 by Luke Yelavich
* scripts/casper-bottom/30accessibility && ubiquity-hooks/30accessibility:
123
                        remove_applet fast_user_switch
585 by Luke Yelavich
* scripts/casper-bottom/30accessibility && ubiquity-hooks/30accessibility:
124
                        sed -i -e 's/# Host alias specification/Defaults\tenv_keep = "ORBIT_SOCKETDIR XDG_SESSION_COOKIE GTK_MODULES"\n\n# Host alias specification/g' /root/etc/sudoers
378.1.3 by Luke Yelavich
* Start Orca when a Braille device is configured from choosing the
125
                        ;;
146.2.1 by Luke Yelavich
Added settings for Accessibility profiles.
126
                        # Minor Motor Difficulties
127
                        access=m1)
210.2.1 by themuso at ubuntu
* Fixed some typos, and added missing settings to some accessibility
128
                        gct -s -t bool /desktop/gnome/accessibility/keyboard/enable true
129
                        gct -s -t bool /desktop/gnome/accessibility/keyboard/mousekeys_enable true
130
                        gct -s -t bool /desktop/gnome/accessibility/keyboard/stickykeys_enable true
131
                        gct -s -t bool /desktop/gnome/accessibility/keyboard/stickykeys_modifier_beep true
132
                        gct -s -t bool /desktop/accessibility/gnome/keyboard/stickykeys_two_key_off false
133
                        gct -s -t bool /desktop/gnome/peripherals/keyboard/repeat true
134
                        gct -s -t int /desktop/gnome/peripherals/keyboard/delay 700
135
                        gct -s -t int /desktop/gnome/peripherals/keyboard/rate 10
378.1.1 by Luke Yelavich
* scripts/casper-bottom/30accessibility &
136
                        gct -s -t bool /apps/gksu/disable-grab true
292 by Tollef Fog Heen
Use functions to avoid ever-long lines as well as looking at /root/etc/kderc, not /etc/kderc in the initramfs
137
                        kderc_addtoprefixes /usr/share/kubuntu-default-settings/kde-profile/minor-motor-difficulties/
339 by Jani Monoses
make v2 start orca in magnifier mode. Add all xubuntu options
138
                        if [ -e /root/etc/xdg/xfce4/mcs_settings/keyboard.xml ]; then
139
                            sed -i 's/0/1/' /root/etc/xdg/xfce4/mcs_settings/keyboard.xml
140
                        fi 
149 by Tollef Fog Heen
get rid of "write-script-then-run-it hack in 30accessibility
141
                        ;;
146.2.1 by Luke Yelavich
Added settings for Accessibility profiles.
142
                        # Motor Difficulties - pointing devices
143
                        access=m2)
210.2.1 by themuso at ubuntu
* Fixed some typos, and added missing settings to some accessibility
144
                        gct -s -t bool /desktop/gnome/accessibility/keyboard/enable true
326 by Tollef Fog Heen
Turn on accessibility in "Motor Difficulties - pointing devices" which
145
			gct -s -t bool /desktop/gnome/interface/accessibility true
210.2.1 by themuso at ubuntu
* Fixed some typos, and added missing settings to some accessibility
146
                        gct -s -t bool /desktop/gnome/accessibility/keyboard/stickykeys_enable true
147
                        gct -s -t bool /desktop/gnome/accessibility/keyboard/stickykeys_modifier_beep false
148
                        gct -s -t bool /desktop/accessibility/gnome/keyboard/stickykeys_two_key_off false
489 by Luke Yelavich
* scripts/casper-bottom/30accessibility &
149
                        gct -s -t bool /desktop/gnome/applications/at/mobility/startup true
150
                        gct -s -t string /desktop/gnome/applications/at/mobility/exec onboard
292 by Tollef Fog Heen
Use functions to avoid ever-long lines as well as looking at /root/etc/kderc, not /etc/kderc in the initramfs
151
152
                        kderc_addtoprefixes /usr/share/kubuntu-default-settings/kde-profile/minor-motor-difficulties/,/usr/share/kubuntu-default-settings/kde-profile/motor-difficulties-pointing-devices/
339 by Jani Monoses
make v2 start orca in magnifier mode. Add all xubuntu options
153
                        if [ -e /root/etc/xdg/xfce4/mcs_settings/keyboard.xml ]; then
154
                            sed -i '/Sticky/ s/0/1/' /root/etc/xdg/xfce4/mcs_settings/keyboard.xml
155
                        fi 
149 by Tollef Fog Heen
get rid of "write-script-then-run-it hack in 30accessibility
156
                        ;;
146.2.1 by Luke Yelavich
Added settings for Accessibility profiles.
157
		esac
158
done
145 by Tollef Fog Heen
Add initial accessibility support framework
159
log_end_msg