2022-09-02 06:42:26 +00:00
|
|
|
# xdg-sanity
|
|
|
|
|
2022-09-08 02:06:14 +00:00
|
|
|
The `xdg-sanity` script is built to replace your default web browser in your
|
|
|
|
desktop/XDG settings. It intercepts http/s URIs sent to the default browser by
|
|
|
|
`xdg-open` and sends it to the appropriate application. For example, it will
|
2022-09-22 02:03:02 +00:00
|
|
|
send `image/jpeg` MIME type files to your image viewer.
|
2022-09-02 06:42:26 +00:00
|
|
|
|
2022-09-08 02:06:14 +00:00
|
|
|
## Installation
|
|
|
|
|
2022-11-08 06:16:23 +00:00
|
|
|
### Arch Linux
|
2022-09-08 02:06:14 +00:00
|
|
|
|
|
|
|
I maintain a package [on the
|
|
|
|
AUR](https://aur.archlinux.org/packages/xdg-sanity).
|
|
|
|
|
|
|
|
### From Source
|
|
|
|
|
2022-11-08 06:16:23 +00:00
|
|
|
First, make sure you have `curl(1)`, `xdg-utils(1)` (or an alternative like
|
2022-11-08 06:17:06 +00:00
|
|
|
[handlr](https://github.com/chmln/handlr)), and
|
2022-11-08 06:16:23 +00:00
|
|
|
[tomcat](https://git.tebibyte.media/emma/tomcat) installed. Then, clone this
|
|
|
|
repository and move the `xdg-sanity` binary wherever your operating system
|
|
|
|
stores locally-installed binaries. This is usually `/usr/local/bin` or
|
|
|
|
`$HOME/.local/bin` for your user. Make sure the installation location is in your
|
2022-09-22 02:03:02 +00:00
|
|
|
`$PATH`.
|
2022-09-08 02:06:14 +00:00
|
|
|
|
2022-11-08 06:16:23 +00:00
|
|
|
Create an `xdg-sanity.desktop` file either manually or with `gendesk(1)`,
|
2022-09-08 02:06:14 +00:00
|
|
|
placing it, also, where your OS stores locally-installed `.desktop` files,
|
2022-09-22 02:03:02 +00:00
|
|
|
usually `/usr/local/applications`. Set your default web browser to that
|
2022-11-08 06:16:23 +00:00
|
|
|
`.desktop` file with `xdg-settings(1)` or an equivalent.
|
2022-09-08 02:06:14 +00:00
|
|
|
|
2022-11-08 06:16:23 +00:00
|
|
|
Add your default web browser to `$XDG_CONFIG_HOME/xdg-sanity.toml` so the
|
2022-09-22 02:03:02 +00:00
|
|
|
script can forward links to it.
|
|
|
|
|
|
|
|
### Usage
|
|
|
|
|
2022-11-08 06:16:23 +00:00
|
|
|
`xdg-sanity [RESOURCE]`
|
|
|
|
|
2022-09-22 02:03:02 +00:00
|
|
|
Open links from applications outside your web browser as normal. Alternatively,
|
2022-11-08 06:16:23 +00:00
|
|
|
you can call `xdg-sanity` directly with the only argument accepted being a URI.
|