about summary refs log tree commit diff
path: root/pkgs/profpatsch/xdg-open/types.dhall
blob: 8cc033b41b87b342c9ccb1bf6900505078f84c93 (plain) (blame)
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
    -- Given an executable and args to pass to the executable,
    -- which might be a bash variable or a simple command line string.
    -- Should remove that indirection at some point and just generate execline strings/scripts instead. (?)
    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
      , add-to-calendar : Command
      }

let
    -- describes the command `cmd` to run for the matched mime type `mime`
    MimeMatch =
      { mime : Mime, cmd : Command }

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 : MimeMatch
      }

in  { Mime
    , Executable
    , Arg
    , CommandTemplate
    , Command
    , Special
    , UriMimeGlob
    , MimeMatch
    }