~unity-team/unity-scopes-api/rtm-14.09

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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
This document outlines how the scopes run time is configured.
In general, if a recognized key is not set in a configuration
file, a default value applies as detailed below.

The following configuration files are used by the scopes run time:


Runtime.ini
-----------

If no specific file is provided to the scopes run time, the default path is
"/usr/lib/<arch>/unity-scopes/Runtime.ini".

If that file does not exist, the default values apply.

The only recognized group in this file is [Runtime].

The following keys are recognized:

- Registry.Identity (string)

  The identity of the local registry. If not set, the default value is "Registry".
  To run a scope without a registry, for example, using the scoperunner for testing, the identity
  can be the empty string.

- Registry.ConfigFile (string)

  The path to the registry configuration file. The default value is
  "/usr/lib/<arch>/unity-scopes/Registry.ini".

- Smartscopes.Registry.Identity (string)

  The identity of the remote registry. If not set, the default value is "SSRegistry".
  Setting this value explicitly to the empty string disables use of the remote registry.

- Smartscopes.ConfigFile (string)

  The path to the smartscopes configuration file. The default value is
  "/usr/lib/<arch>/unity-scopes/Smartscopes.ini".

- Default.Middleware (string)

  The middleware to be used by default. The default value is "Zmq".

- <middleware>.ConfigFile

  The path to the configuration file for the middleware, with the value of
  Default.Middleware substituted for <middleware>, For example,

  Zmq.ConfigFile = <path>

  The default value is "/usr/lib/<arch>/unity-scopes/Zmq.ini".

- Reap.Expiry

  A ReplyBase instance receives push() invocations from a scope in
  response to a query.
  If a scope becomes non-responsive and stops pushing, eventually,
  the scopes run time calls the finished() method with an error indicating
  that there was no activity for some time and then deallocates the
  ReplyBase instance.

  Reap.Expiry sets the inactivity time (in seconds) for a query to be
  considered "dead". If no push() or finished() message arrives for
  this amount of time, the scopes run time reaps the ReplyBase.

  The default value is 45 seconds.

- Reap.Interval

  The run time maintains a reaper thread that checks for "dead"
  queries (at most) every Reap.Interval seconds. For a Reap.Expiry
  time of 45 seconds and a Reap.Interval of 10 seconds, the actual
  time for a dead query to be reaped is at least 45 seconds and
  at most 55 seconds.

  The default value is 10 seconds.

- Process.Timeout

  This parameter determines how the registry will wait for a scope
  to start and stop. The registry waits for at most Process.Timeout
  milliseconds before it concludes that a scope failed to initialize
  or terminate correctly. If a scope does not respond
  within the allotted time, it is killed with SIGKILL.

  Only values in the range 10 to 15000 milliseconds are accepted.

  The default value is 4000 milliseconds.

  Note that this value must be less than Locate.Timeout in the [<Middleware>]
  config group, otherwise the middleware can prematurely conclude that
  a locate() request failed to start a scope.

- DataDir

  The parent directory under which the run time writes scope-specific data files
  (such as caches).

  The default value is $HOME/.local/share/unity-scopes.

  Note that the actual files are written into subdirectories of
  this directory, for example:

  $HOME/.local/share/unity-scopes/leaf-net/<scope_id>/some_file (for confined scopes)
  and $HOME/.local/share/unity-scopes/unconfined/<scope_id>/some_file (for unconfined scopes).

- ConfigDir

  The parent directory under which the runtime writes the scope configration files.

  The default value is $HOME/.config/unity-scopes.

  Note that the actual configuration is written into subdirectories of this
  directory. Specifically:

  $HOME/.config/unity-scopes/<scope_id>/settings.ini

Zmq.ini
-------

If no specific file is provided to the scopes run time, the default path is
"/usr/lib/<arch>/unity-scopes/Zmq.ini".

If that file does not exist, the default values for keys apply.

The only recognized group in this file is [Zmq].

The following keys are recognized:

- EndpointDir (string)

  The directory in which the public endpoint of a scope (or the registry) is created.
  This endpoint must be accessible to any process.

  The default value is "$XDG_RUNTIME_DIR/zmq". If XDG_RUNTIME_DIR is not
  set, or $XDG_RUNTIME_DIR does not exist or is not writable, initialization fails.

  Otherwise, the public directory is created if it does not exist, with mode rwxr-xr-xt.

  Private endpoints are created in "<EndpointDir>/priv". The priv
  directory is created if it does not exist, with mode rwx------t.

- Registry.EndpointDir

  The directory in which the public endpoints of the registry are created.
  If set to a non-empty string, this directory overrides the setting
  of EndpointDir for the registry only. (This is provided for testing,
  so a separate registry can run beside the system-wide registry.)

  The directory is created if it does not exist, with mode rwxr-xr-xt.

- Default.Twoway.Timeout

  The default timeout value to be used for twoway invocations in milliseconds.
  If a twoway invocation (such as list() or search()) does not complete
  within the specified time, the invocation throws a TimeoutException, possibly
  after asking the registry to start the target process first (see Locate.Timeout).

  The default value is 500 milliseconds.

- Smartscopes.Registry.EndpointDir

  The directory in which the public endpoints of the registry are created.
  If set to a non-empty string, this directory overrides the setting
  of EndpointDir for the registry only. (This is provided for testing,
  so a separate registry can run beside the system-wide registry,
  while still using the system-wide smartscopes registry.)

- Locate.Timeout

  The timeout to be used when asking the registry to start a scope. If the registry
  does not respond within the specified amount of time, the scope is assumed
  to be unavailable, and twoway invocations fail with a TimeoutException.

  Note that this value must be somewhat larger than the value of Process.Timeout
  in Registry.ini, otherwise invocations on a scope that needs to be activated
  first can fail, even though the activation succeeded.

  Only values in the range 10 to 15000 milliseconds are accepted. (Values outside
  this range would either cause locate() to falsely conclude that a scope
  could not be started, or cause an unacceptably long wait time.)

  Only values in the range 10 to 15000 milliseconds are accepted.

  The default value is 5000 milliseconds.

- Registry.Timeout

  The timeout to be used when invoking a twoway operation on the registry other
  than locate().

  Only values in the range 10 to 15000 milliseconds are accepted.

  The default value is 5000 milliseconds.


Registry.ini
------------

If no specific file is provided to the scopes run time, the default path is
"/usr/lib/<arch>/unity-scopes/Registry.ini".

If that file does not exist, the default values for keys apply.

The only recognized group in this file is [Registry].

The following keys are recognized:

- Middleware

  The middleware used by the registry, such as "Zmq". The default value is "Zmq".

- <Middleware>.ConfigFile

  <Middleware> must match the value of the Middleware key, for example:

      Zmq.Middleware = path/to/SomeFile.ini

- Scoperunner.Path

  The path to the scoperunner executable. The path must be an absolute path.
  The default value is "/usr/lib/<arch>/unity-scopes/scoperunner".

- Scope.InstallDir

  The directory in which to look for subdirectories containing scope .so and .ini files.

  The default value is "/usr/lib/<arch>/unity-scopes".

- OEM.InstallDir

  The directory in which to look for subdirectories containing scope .so and .ini files added
  by OEMs. The default value is "/custom/usr/lib/<arch>/unity-scopes".

- Click.InstallDir

  The directory in which to look for subdirectories containing scopes installed from click packages.

  The default value is "$HOME/.local/share/unity-scopes".


Smartscopes.ini
--------------

If no specific file is provided to the scopes run time, the default path is
"/usr/lib/<arch>/unity-scopes/Smartscopes.ini".

If that file does not exist, the default values for keys apply.

The only recognized group in this file is [Smartscopes].

The following keys are recognized:

- Http.Reply.Timeout

  The amount of time (in seconds) to wait for a reply from the smartscopes server.
  The value must be in the range 1 - 60.

  The default value is 20 seconds.

- Registry.Refresh.Rate

  The amount of time (in seconds) between metadata refreshes from the smartscopes server.
  The value must be >= 60.

  The default value is 24 hours.

- Registry.Refresh.Fail.Timeout

  The amount of time (in seconds) in between retry attempts if a metadata refresh from
  the smartscopes server fails.
  The value must be >= 1.

  The default value is 10 seconds.

- Scope.Identity

  The identity for proxy scope provided by smartscopesproxy.

  The default value is "SmartScope".


<scope_id>.ini
--------------

The recognized groups in this file are:

- ScopeConfig
- Appearance

The following keys are recognized in the ScopeConfig group:

- Override

  Determines whether an OEM scope is allowed to override a Canonical scope. This key is used only by Canonical
  scopes. If true, the Canonical scope can be replaced by an OEM scope with the same ID. The default value
  is false.

  For OEM scopes and click scopes, the setting of this key is ignored.

- DisplayName

  The display name of a scope (mandatory, localizable).

- Description

  The description of a scope (mandatory, localizable).

- Author

  The author of the scope (mandatory).

- Art

  Artwork to be shown for the scope. The default value is the empty string.

- Icon

  The icon to be shown for the scope. The default value is the empty string.

- SearchHint

  A search hint for on-screen display (localizable). The default value is the empty string.

- HotKey

  The hot key for the scope. The default value is the empty string.

- ChildScopes

  The list of ids of scopes aggregated by this scope (if any). The values in this list
  must be separated by semicolons. This list is translated to the names of
  children scopes when in the scopes overview page of the Unity Dash.

  Note: make sure there are no trailing spaces following
  the ids, as they will be preserved.

- Invisible

  Whether the scope is hidden in the UI. The default value is false.

- ScopeRunner

  A custom scoperunner command-line to be executed when the scope is invoked.
  The following placeholders can be used to substitute config paths where required:

  - %R - absolute path to the runtime .ini config file
  - %S - absolute path to the scope's .ini config file

  E.g. "ScopeRunner = /usr/bin/gdb --ex run --args /usr/lib/x86_64-linux-gnu/unity-scopes/scoperunner %R %S"
  
  If not set, the default scoperunner is used.

- IdleTimeout

  The amount of time (in seconds) a running scope can be inactive before it will automatically shut down.
  If not set, a default value of 40 is used.

- ResultsTtlType

  If set, the results for this scope will be set to expire, and be refreshed. Valid values are:

  - None

  - Small - in the order of a minute

  - Medium - in the order of a few minutes

  - Large - in the order of an hour

- LocationDataNeeded

  Whether the scope wants to have location data delivered to it. Note that this does not mean that the scope
  will actually receive location data at run time. (The user may deny access, or may only provide approximate
  location data.)

  If not set, the default value is false.


The following keys are recognized in the Appearance group:

- TODO: document this