syndicated-open/README.md

22 lines
1.5 KiB
Markdown
Raw Normal View History

2022-03-18 07:48:04 +00:00
# xdg-open-ng
2022-02-26 23:39:22 +00:00
An `xdg-open` replacement that uses Syndicate and PCRE pattern matching to open URIs.
2022-04-26 03:11:26 +00:00
There are two utilites, `xdg-open` and `uri_runner`. The former connects to a shared Syndicate dataspace via a UNIX socket at `$SYNDICATE_SOCK` otherwise `$XDG_RUNTIME_DIR/dataspace` and as has no other configuration. The `uri_runner` component is intended to be managed by the [Syndicate server](https://git.syndicate-lang.org/syndicate-lang/syndicate-rs) thru which it receives configuration, see [uri_runner.pr](./uri_runner.pr) as an example.
2022-02-26 23:39:22 +00:00
The [protocol.nim](./src/protocol.nim) file is generated from the [protocol.prs](./protocol.prs) schema, a [Tupfile](https://gittup.org/tup/) file is provided to do this.
2022-02-26 23:39:22 +00:00
## TODO
- Fallback commands?
2022-05-26 22:12:44 +00:00
## Examples
| Type | Rule |
|-|-|
| Bittorrent | <code><action-handler "magnet:?.*xt=urn:btih.*" ["transmission-remote-gtk" 0]></code> |
| Gemini | <code><action-handler "gemini://.*|file:///.*.gmi" ["/run/current-system/sw/bin/lagrange" 0]></code> |
| PDF | <code><action-handler "file://(.*.pdf)" ["mupdf" 1]></code> |
| Tox | <code><action-handler "tox:.*|uri:tox:.*", ["/nix/store/hix5jibhdzx0a2qbq5cqihac060zz10b-qtox-1.17.6/bin/qtox" 0]></code> |
| Twatter | <code><action-handler "https://twitter.com/(.*)" ["firefox" "--new-tab" "https://nitter.net/$1"]></code> |
| Video | <code><action-handler ".*\\.avi|.*\\.mkv|.*mp4|.*ogg|.*youtu.*|.*\\.m3u8|.*webm" ["mpv" "--no-terminal" "--force-window=immediate" "--loop-playlist" "--ytdl-format=best" 0]></code> |