about summary refs log tree commit diff
path: root/pkgs/profpatsch/xdg-open/config.dhall
diff options
context:
space:
mode:
authorProfpatsch <mail@profpatsch.de>2021-05-12 23:15:48 +0200
committerProfpatsch <mail@profpatsch.de>2021-05-12 23:42:13 +0200
commitba600abbfe2a123a5293511a21aec18b9d7d4818 (patch)
treef4e8946fff37f9f0807818db0f00dcbb0235cdf3 /pkgs/profpatsch/xdg-open/config.dhall
parent0d1737778cf81304ec37cea2a1c0e934bb84e601 (diff)
pkgs/profpatsch/xdg-open: use the new matcher list
Removes the duplication of command handlers.
Diffstat (limited to 'pkgs/profpatsch/xdg-open/config.dhall')
-rw-r--r--pkgs/profpatsch/xdg-open/config.dhall79
1 files changed, 3 insertions, 76 deletions
diff --git a/pkgs/profpatsch/xdg-open/config.dhall b/pkgs/profpatsch/xdg-open/config.dhall
index 45ef45d1..2b1fb686 100644
--- a/pkgs/profpatsch/xdg-open/config.dhall
+++ b/pkgs/profpatsch/xdg-open/config.dhall
@@ -113,7 +113,7 @@ in  λ(pkgs : { package : Text, binary : Text } → Executable) →
                   { mime = [ "*" ], cmd = special.dmenu-list-binaries-and-exec }
                 }
 
-      let matchOrder =
+      let orderedMimeMatchers =
             [ mime.text.html
             , mime.text.gemini
             , mime.text.gopher
@@ -175,82 +175,9 @@ in  λ(pkgs : { package : Text, binary : Text } → Executable) →
               }
             ]
 
-      let mimeMatcher =
-            let pkgSame =
-                  λ(packageAndBinaryName : Text) →
-                    pkgs
-                      { package = packageAndBinaryName
-                      , binary = packageAndBinaryName
-                      }
-
-            let wrapCommand =
-                  λ(wrapper : Command) →
-                  λ(cmd : Command) →
-                    { exe = wrapper.exe
-                    , args =
-                        λ(template : Arg) →
-                            wrapper.args template
-                          # [ Arg.String cmd.exe ]
-                          # cmd.args template
-                    }
-
-            let oneArg =
-                  λ(exe : Executable) → { exe, args = λ(file : Arg) → [ file ] }
-
-            let m = λ(match : Mime) → λ(cmd : Command) → { match, cmd }
-
-            in    [ { match = mime.mail-address.mime
-                    , cmd = special.compose-mail-to
-                    }
-                  , { match = mime.text.html.mime
-                    , cmd = special.open-in-browser
-                    }
-                  , { match = mime.text.gemini.mime
-                    , cmd = oneArg (pkgSame "lagrange")
-                    }
-                  , { match = mime.text.gopher.mime
-                    , cmd = oneArg (pkgSame "lagrange")
-                    }
-                  , { match = mime.text.xml.mime
-                    , cmd = special.open-in-browser
-                    }
-                  , { match = mime.text.any.mime, cmd = special.open-in-editor }
-                  , { match = mime.image.gif.mime
-                    , cmd = special.open-in-browser
-                    }
-                  , { match = mime.image.svg.mime
-                    , cmd = oneArg (pkgSame "inkscape")
-                    }
-                  , { match = mime.image.any.mime
-                    , cmd = oneArg (pkgSame "imv")
-                    }
-                  , { match = mime.pdf.mime, cmd = oneArg (pkgSame "zathura") }
-                  , { match = mime.pgp-key.mime
-                    , cmd =
-                      { exe = pkgs { package = "gnupg", binary = "gpg" }
-                      , args =
-                          λ(file : Arg) →
-                            [ Arg.String "--import"
-                            , Arg.String "--import-options"
-                            , Arg.String "show-only"
-                            , file
-                            ]
-                      }
-                    }
-                  , { match = mime.directory.mime
-                    , cmd =
-                        special.exec-in-terminal-emulator
-                          (oneArg (pkgSame "ranger"))
-                    }
-                  , { match = mime.any.mime
-                    , cmd = special.dmenu-list-binaries-and-exec
-                    }
-                  ]
-                : List MimeMatch
-
-      in  { mimeMatcher
-          , uriMimeGlobs
+      in  { uriMimeGlobs
           , UriMimeGlob
+          , orderedMimeMatchers
           , Executable
           , Command
           , UriGlobHandler