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
|
let Mime = List Text
let
-- TODO use library like with shell commands
Executable =
Text
let Arg = < String : Text | Variable : Text >
let CommandTemplate =
λ(templates : Type) → { exe : Executable, args : templates → List Arg }
let Command = CommandTemplate Arg
let Special =
{ open-in-editor : Command
, open-in-browser : Command
, fetch-http-url-mime : Command
, compose-mail-to : Command
, exec-in-terminal-emulator : ∀(args : Command) → Command
, dmenu-list-binaries-and-exec : Command
, notify : ∀(message : Text) → Command
}
let
-- describes the command `cmd` to run for the matched mime type `mime`
MimeMatch =
{ mime : Mime, cmd : Command }
let
-- Handler of an uri glob. Mime maps the uri to a file handler. Transparent is a command which, when run, returns a mimetype of the file.
UriGlobHandler =
< Transparent : Command | Mime : MimeMatch >
let UriMimeGlob =
{ desc : Text
, -- less specific than glob, used by firefox to refer to the schema
schema-prefix : List Text
, -- schema shell glob to check whether a link corresponds to the schema
glob : List Text
, handler : UriGlobHandler
}
in { Mime
, Executable
, Arg
, CommandTemplate
, Command
, Special
, UriGlobHandler
, UriMimeGlob
, MimeMatch
}
|