about summary refs log tree commit diff
path: root/pkgs/profpatsch/xdg-open/types.dhall
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/profpatsch/xdg-open/types.dhall')
-rw-r--r--pkgs/profpatsch/xdg-open/types.dhall50
1 files changed, 50 insertions, 0 deletions
diff --git a/pkgs/profpatsch/xdg-open/types.dhall b/pkgs/profpatsch/xdg-open/types.dhall
new file mode 100644
index 00000000..74e55d32
--- /dev/null
+++ b/pkgs/profpatsch/xdg-open/types.dhall
@@ -0,0 +1,50 @@
+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
+    -- 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 : Mime >
+
+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
+      }
+
+let MimeMatch = { match : Mime, cmd : Command }
+
+in  { Mime
+    , Executable
+    , Arg
+    , CommandTemplate
+    , Command
+    , Special
+    , UriGlobHandler
+    , UriMimeGlob
+    , MimeMatch
+    }