about summary refs log tree commit diff
path: root/pkgs/profpatsch/xdg-open
diff options
context:
space:
mode:
authorProfpatsch <mail@profpatsch.de>2021-05-13 14:20:01 +0200
committerProfpatsch <mail@profpatsch.de>2021-05-13 14:20:01 +0200
commit24d08e79bb64db79453095af10ab083349991db3 (patch)
tree8e3ea70406752d2fbe0f4a435d6ae24b2e22006e /pkgs/profpatsch/xdg-open
parent853de0c1f0c84bd4231d08cb4f893ffb70b9c294 (diff)
pkgs/profpatsch/xdg-open: Remove UriGlobHandler
The concept of a transparent handler wasn’t actually used anywhere and
now that we want to generate the firefox json as well, it just hinders
us from doing that in an easy way.
Diffstat (limited to 'pkgs/profpatsch/xdg-open')
-rw-r--r--pkgs/profpatsch/xdg-open/config.dhall21
-rw-r--r--pkgs/profpatsch/xdg-open/types.dhall8
-rw-r--r--pkgs/profpatsch/xdg-open/xdg-open.dhall25
3 files changed, 12 insertions, 42 deletions
diff --git a/pkgs/profpatsch/xdg-open/config.dhall b/pkgs/profpatsch/xdg-open/config.dhall
index 13810b3a..e873a06e 100644
--- a/pkgs/profpatsch/xdg-open/config.dhall
+++ b/pkgs/profpatsch/xdg-open/config.dhall
@@ -10,8 +10,6 @@ let Arg = types.Arg
 
 let Mime = types.Mime
 
-let UriGlobHandler = types.UriGlobHandler
-
 let UriMimeGlob = types.UriMimeGlob
 
 let MimeMatch = types.MimeMatch
@@ -137,41 +135,37 @@ in  λ(pkgs : { package : Text, binary : Text } → Executable) →
           = [ { desc = "http link"
               , glob = [ "http://*", "https://*" ]
               , schema-prefix = [ "http", "https" ]
-              , handler =
-                  let TODO =
-                        UriGlobHandler.Transparent special.fetch-http-url-mime
-
-                  in  UriGlobHandler.Mime mime.text.html
+              , handler = mime.text.html
               }
             , { desc = "gemini link"
               , glob = [ "gemini://*" ]
               , schema-prefix = [ "gemini" ]
-              , handler = UriGlobHandler.Mime mime.text.gemini
+              , handler = mime.text.gemini
               }
             , { desc = "gemini link"
               , glob = [ "gopher://*", "gophers://*" ]
               , schema-prefix = [ "gopher", "gophers" ]
-              , handler = UriGlobHandler.Mime mime.text.gopher
+              , handler = mime.text.gopher
               }
             , { glob = [ "mailto:*" ]
               , desc = "mail address"
               , schema-prefix = [ "mailto" ]
-              , handler = UriGlobHandler.Mime mime.mail-address
+              , handler = mime.mail-address
               }
             , { glob = [ "magnet:*" ]
               , desc = "bittorrent magnet link"
               , schema-prefix = [ "magnet" ]
-              , handler = UriGlobHandler.Mime mime.torrent
+              , handler = mime.torrent
               }
             , { desc = "irc channel"
               , glob = [ "irc:*", "ircs:*" ]
               , schema-prefix = [ "irc", "ircs" ]
-              , handler = UriGlobHandler.Mime mime.irc
+              , handler = mime.irc
               }
             , { desc = "local file"
               , glob = [ "file://*" ]
               , schema-prefix = [ "file" ]
-              , handler = UriGlobHandler.Mime mime.file
+              , handler = mime.file
               }
             ]
 
@@ -180,7 +174,6 @@ in  λ(pkgs : { package : Text, binary : Text } → Executable) →
           , orderedMimeMatchers
           , Executable
           , Command
-          , UriGlobHandler
           , MimeMatch
           , Special
           , Mime
diff --git a/pkgs/profpatsch/xdg-open/types.dhall b/pkgs/profpatsch/xdg-open/types.dhall
index b7ae944b..e878ce86 100644
--- a/pkgs/profpatsch/xdg-open/types.dhall
+++ b/pkgs/profpatsch/xdg-open/types.dhall
@@ -27,18 +27,13 @@ let
     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
+      , handler : MimeMatch
       }
 
 in  { Mime
@@ -47,7 +42,6 @@ in  { Mime
     , CommandTemplate
     , Command
     , Special
-    , UriGlobHandler
     , UriMimeGlob
     , MimeMatch
     }
diff --git a/pkgs/profpatsch/xdg-open/xdg-open.dhall b/pkgs/profpatsch/xdg-open/xdg-open.dhall
index 66ab88a3..c4655c6a 100644
--- a/pkgs/profpatsch/xdg-open/xdg-open.dhall
+++ b/pkgs/profpatsch/xdg-open/xdg-open.dhall
@@ -72,27 +72,10 @@ let xdg-open =
                   Text
                   Text
                   ( λ(match : Text) →
-                      merge
-                        { Mime =
-                            λ(mime : types.MimeMatch) →
-                              [ "${match})"
-                              , shellEscapeExecCommand
-                                  shellEscape2
-                                  file2
-                                  mime.cmd
-                              , ";;"
-                              ]
-                        , Transparent =
-                            λ(cmd : types.Command) →
-                              [ "${match})"
-                              , "mime=\"\$(${shellEscapeExecCommand
-                                               shellEscape2
-                                               file2
-                                               cmd})\""
-                              , ";;"
-                              ]
-                        }
-                        g.handler
+                      [ "${match})"
+                      , shellEscapeExecCommand shellEscape2 file2 g.handler.cmd
+                      , ";;"
+                      ]
                   )
                   g.glob
               : List Text