thqm
A command line utility to generate and serve a dynamic menu web page.
> `thqm` takes its name from the arabic تحكم, pronounced tahakoom, meaning control.
`thqm` is a nifty little command line utility. It dynamically generates a web page menu based on the provided `stdin` and outputs any selections to `stdout`.
In a sense, it functions similarly to [`dmenu`](https://tools.suckless.org/dmenu/)/[`rofi`](https://github.com/davatorium/rofi) but the menu is a web page served on the local network.
This makes it perfect to control scripts over the network.
**See the [examples](./examples) folder for some example scripts.**
## 📦 Installation
### Manual
To compile and install manually from this repo, you'll need `rust` installed.
To compile the binary:
```console
git clone https://github.com/loiccoyle/thqm-rs
cd thqm-rs
cargo build --release
```
The compiled binary will be located at `./target/release/thqm`.
Just place this binary somewhere in your `$PATH`.
Or to install it straight from `cargo`:
```console
cargo install thqm
```
Make sure you have `cargo`'s bin folder in your `$PATH`.
You'll also need to install the [template styles](https://github.com/loiccoyle/thqm-styles) with:
```console
thqm --install-styles
```
This will install the styles in the user data folder.
### Arch linux (AUR)
Using your favourite AUR helper:
```console
paru -S thqm
```
The installation process will install the styles system wide in the `/usr/share/thqm` folder.
## 📋 Usage
### CLI options
`thqm` has a few command line options, when in doubt see the `--help`.
```console
$ thqm --help
A simple HTTP server to serve a dynamic menu web page.
thqm generates a menu based on the standard input and writes selections to standard output.
See https://github.com/loiccoyle/thqm-rs/tree/main/examples for script examples.
Basic usage:
$ echo 'Option 1\nOption 2' | thqm -u |
while IFS= read -r sel; do
case $sel in
'Option 1') echo 'hello';;
'Option 2') echo 'world';;
*) echo "$sel";;
esac
done
Usage: thqm [OPTIONS]
Options:
-p, --port The port to listen on [default: 8000]
-U, --username The username to authenticate with
-P, --password The password to authenticate with
-S, --separator The entry separator [default: "\n"]
-t, --title The page title [default: thqm]
-s, --style