From 0d1737778cf81304ec37cea2a1c0e934bb84e601 Mon Sep 17 00:00:00 2001 From: Profpatsch Date: Wed, 12 May 2021 23:05:28 +0200 Subject: pkgs/profpatsch/xdg-open: prepare for adding firefox handler support This diff is a bit bad cause of whitespace changes, but effectively this copies all handlers into the mime handler definitions and duplicates them for now. We want to use the same config to generate a firefox mime handler file. --- pkgs/profpatsch/xdg-open/types.dhall | 50 ++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 pkgs/profpatsch/xdg-open/types.dhall (limited to 'pkgs/profpatsch/xdg-open/types.dhall') 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 + } -- cgit 1.4.1