From 0fcac5f717a501691993f6682f67d3e9be3ae75b Mon Sep 17 00:00:00 2001 From: Profpatsch Date: Mon, 11 May 2020 10:59:31 +0200 Subject: pkgs/profpatsch/xdg-open: make possible to parse protocols MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is now on par with the original script in https://github.com/Profpatsch/dotfiles/blob/a25c6c419525bef7ef5985f664b058dc9eb919e9/scripts/scripts/xdg-open Eventually it should probably migrate away from a generated bash script, but for now it’s fine. --- pkgs/profpatsch/xdg-open/config.dhall | 44 ++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 21 deletions(-) (limited to 'pkgs/profpatsch/xdg-open/config.dhall') diff --git a/pkgs/profpatsch/xdg-open/config.dhall b/pkgs/profpatsch/xdg-open/config.dhall index 0550c94a..40a791af 100644 --- a/pkgs/profpatsch/xdg-open/config.dhall +++ b/pkgs/profpatsch/xdg-open/config.dhall @@ -35,8 +35,11 @@ let mime = let renderMime = λ(m : Mime) → 32 -let uriMimeGlobs = - [ { desc = "http link" +let UriMimeGlob = { desc : Text, glob : List Text, mime : Mime } + +let uriMimeGlobs + : List UriMimeGlob + = [ { desc = "http link" , glob = [ "http://*", "https://*" ] , mime = mime.text.html } @@ -63,21 +66,19 @@ let Special = } let mimeMatcher = - λ(pkgs : { package : Text, binary : Text } → Executable) - → λ(special : Special) - → let pkgSame = - λ(packageAndBinaryName : Text) - → pkgs + λ(pkgs : { package : Text, binary : Text } → Executable) → + λ(special : Special) → + let pkgSame = + λ(packageAndBinaryName : Text) → + pkgs { package = packageAndBinaryName , binary = packageAndBinaryName } let oneArg = - λ(exe : Executable) - → { exe = exe, args = λ(file : Arg) → [ file ] } + λ(exe : Executable) → { exe, args = λ(file : Arg) → [ file ] } - let m = - λ(match : Mime) → λ(cmd : Command) → { match = match, cmd = cmd } + let m = λ(match : Mime) → λ(cmd : Command) → { match, cmd } in [ { match = mime.mail-address, cmd = special.compose-mail-to } , { match = mime.text.html, cmd = special.open-in-browser } @@ -91,8 +92,8 @@ let mimeMatcher = , cmd = { exe = pkgs { package = "gnupg", binary = "gpg" } , args = - λ(file : Arg) - → [ Arg.String "--import" + λ(file : Arg) → + [ Arg.String "--import" , Arg.String "--import-options" , Arg.String "show-only" , file @@ -108,12 +109,13 @@ let mimeMatcher = ] : List MimeMatch -in { mimeMatcher = mimeMatcher - , uriMimeGlobs = uriMimeGlobs - , Executable = Executable - , Command = Command - , MimeMatch = MimeMatch - , Special = Special - , Mime = Mime - , Arg = Arg +in { mimeMatcher + , uriMimeGlobs + , UriMimeGlob + , Executable + , Command + , MimeMatch + , Special + , Mime + , Arg } -- cgit 1.4.1