commit 02e188390046640eee9d0a8db83231c1f1768e06
parent 1d3d3cbb1fec6e4a2b8dbcabb6f1d17a15d1acf1
Author: Pollux <pollux@pollux.codes>
Date: Wed, 12 Feb 2025 12:00:36 -0600
docs: Update README and add better default config
Signed-off-by: Pollux <pollux@pollux.codes>
Diffstat:
2 files changed, 44 insertions(+), 5 deletions(-)
diff --git a/README.md b/README.md
@@ -1,5 +1,25 @@
# sopen
-`sopen` is a suckless alternative to `mimeopen` that allows for opening many
-different kinds of files/urls with a single command. It is written in C and is
-configured using a C header file, much like other suckless applications.
+`sopen` is a suckless alternative to `mime-open` and other similar tools that
+allows for opening many different kinds of files/urls with a single command. It
+is written in C and is configured using a C header file, much like other
+suckless applications.
+
+## Requirements
+
+The only non-standard runtime dependency of `sopen` is `libmagic`.
+
+`sopen` is configured at compile time using the `config.h` file. The default
+configuration is located at `config.def.h`.
+
+In order to build, you must have `make`, `pkg-config`, and some C compiler. Then
+build and install using the following commands.
+
+```sh
+make
+make install
+```
+
+## Running
+
+See the man page for details.
diff --git a/config.def.h b/config.def.h
@@ -1,5 +1,24 @@
static const Rule rules[] = {
- { "", "", "application/pdf", "", "zathura" },
- { "", "", "", "(mp3|wav|flac|ogg)$", "mpv" },
+
+ /* Format:
+ * protocol regex, url regex, mime type regex,
+ * file path regex, program */
+
+ /* Documents */
+ {"", "", "application/pdf", "", "zathura"},
+
+ /* Images */
+ {"", "", "^image", "", "imv"},
+
+ /* Audio/Video */
+ {"", "", "^(audio|video)", "", "mpv"},
+ {"^http", "youtube.com", "", "", "mpv"},
+ {"^http", "", "", "\\.mp3$", "mpv"},
+
+ /* Text */
+ {"", "", "^text", "", "nvim"},
+
+ /* Web */
+ {"^http", "", "", "", "firefox"},
};