Debian Codegraph @

Documents/README.Profiles

raw
1 ~~~~~~~~
2 Profiles
3 ~~~~~~~~
4
5 .. include:: prologue.rst
6
7 Description
8 ===========
9
10 A profile is an activatable group of settings which explicitly override the
11 ones that were established via command line options, the configuration file
12 (``brltty.conf``), the preferences file (``brltty.prefs``), etc when BRLTTY
13 was invoked. Profiles must be placed in the ``/etc/brltty/Profiles/``
14 directory (see |README.Customize| for more details).
15
16 A profile must be encoded in UTF-8. Blank lines are ignored. If the first
17 non-whitespace character of a line is ``#`` then that line is a comment and is
18 ignored. The `Standard Directives`_ are supported. All other lines specify the
19 settings that are to be overridden, and must be in the form:
20
21 .. parsed-literal:: *name* *value*
22
23 Each type of profile has the following properties:
24
25 * A specific group of settings that it can override.
26 * Its own file extension.
27 * Its own selector within BRLTTY's Profiles submenu.
28 * Its own SET_*_PROFILE command for direct selection (see
29 `Profile Selection`_).
30
31 Supported Profile Types
32 -----------------------
33
34 Language Profiles
35 ~~~~~~~~~~~~~~~~~
36
37 A language profile must have the ``.lpf`` file extension. It can override the
38 following settings:
39
40 * locale
41 * speech-driver
42 * speech-parameters
43 * text-table
44 * contraction-table
45
46 For example, a profile for the German language might look like this::
47
48 locale de_DE.UTF-8
49 speech-driver es
50 speech-parameters voice=de,maxrate=300
51 text-table de
52 contraction-table de-g2
53
54 All of the speech driver parameters must be specified on a single line, and be
55 separated from one another by a comma (``,``).
56
57 Profile Selection
58 -----------------
59
60 Each type of profile has a selector within BRLTTY's Profiles submenu. The
61 selector for a given profile type allows for setting that type of profile
62 either to ``off`` (which means "no profile") or to any of the files in the
63 ``/etc/brltty/Profiles/`` directory which have the file extension for that type
64 of profile. The file names are sorted alphabetically.
65
66 If you'd like to select a profile directly (rather than use the Profiles
67 submenu) then you can define key bindings for the appropriate ``SET_*_PROFILE``
68 command. For example, if you'd like to directly select your language profile
69 then you'd define bindings for the ``SET_LANGUAGE_PROFILE`` command. You may
70 add your bindings either to the keyboard table that you're using or to the key
71 table for your braille device. Except for a few examples below, exactly how to
72 do this is beyond the scope of this document (see |README.KeyTables| for
73 details).
74
75 One approach is to define a single binding which involves a routing key. For
76 example::
77
78 bind Key1+Key2+RoutingKey SET_LANGUAGE_PROFILE
79
80 Using this paradigm, the leftmost routing key means to use no language profile,
81 and the next few routing keys select each of your language profiles in the same
82 order as they appear within the Language selector of the Profiles submenu.
83
84 Another approach is to define a specific binding for each language profile. For
85 example::
86
87 bind Key1+Key2 SET_LANGUAGE_PROFILE+0
88 bind Key1+Key3 SET_LANGUAGE_PROFILE+1
89 bind Key2+Key3 SET_LANGUAGE_PROFILE+2
90 bind Key1+Key2+Key3 SET_LANGUAGE_PROFILE+3
91
92 Using this paradigm, the binding for ``+0`` (Key1+Key2) means to use no
93 language profile, and the bindings for ``+1`` (Key1+Key3), ``+2`` (Key2+Key3),
94 etc select each of your language profiles in the same order as they appear
95 within the Language selector of the Profiles submenu.
96
97 A practical approach, which would make it easy to remember the bindings, might
98 be to use a keyboard table, and to use a simple key combination plus a
99 meaningful letter for each language name. Let's say that your primary language
100 is English, and that you also use French and German. In this case, your default
101 settings (no profile) would be for English, and you'd create french.lpf for
102 French and german.lpf for German. You could then define a set of bindings which
103 use ``e`` for English, ``f`` for French, and ``g`` for German. For example::
104
105 bind ShiftLeft+ShiftRight+!e SET_LANGUAGE_PROFILE+0
106 bind ShiftLeft+ShiftRight+!f SET_LANGUAGE_PROFILE+1
107 bind ShiftLeft+ShiftRight+!g SET_LANGUAGE_PROFILE+2
108
109 The ``+1`` binding would activate ``french.lpf`` and the ``+2`` binding would
110 activate ``german.lpf`` because that's how the profile name list would be
111 sorted. If, however, you choose to use the native language names then you'd
112 have ``deutsch.lpf`` for German and ``français.lpf`` for French. In this case,
113 you'd need a different set of bindings because ``deutsch.lpf`` (for German)
114 sorts before ``français.lpf`` (for French)::
115
116 bind ShiftLeft+ShiftRight+!e SET_LANGUAGE_PROFILE+0
117 bind ShiftLeft+ShiftRight+!d SET_LANGUAGE_PROFILE+1
118 bind ShiftLeft+ShiftRight+!f SET_LANGUAGE_PROFILE+2
119
120 When adding the bindings to a key table, they should most likely be defined
121 within the default context. The best way to ensure this is to add them at the
122 very end of the appropriate key table or subtable, and to add the ``context
123 default`` statement just before them. For example::
124
125 context default
126 bind Key1+RoutingKey SET_LANGUAGE_PROFILE
127
128 If you'd like your additional binding definitions to survive a BRLTTY reinstall
129 then you should use a customized key table or subtable (see |README.Customize|)
130 that includes the provided one, and then defines your additional bindings.
131 Let's say that you'd like to add your bindings to the ``laptop`` keyboard table
132 (``laptop.ktb``). Create a file with the same name - ``laptop.ktb`` - in the
133 ``/etc/xdg/brltty/`` directory, and, with an editor, make it look like this::
134
135 include laptop.ktb
136 context default
137 bind Key1+Key2+RoutingKey SET_LANGUAGE_PROFILE
138
139 Standard Directives
140 ===================
141
142 .. include:: nesting-directives.rst
143 .. include:: variable-directives.rst
144 .. include:: condition-directives.rst
145