feat: better readme and examples

This commit is contained in:
imgurbot12 2024-04-03 13:47:36 -07:00
parent 1de4531c3a
commit 317fdafe3b
3 changed files with 54 additions and 11 deletions

View File

@ -1,11 +1,5 @@
## RMenu
<!--
TODO: improve documentation:
2. explain exchange format and rmenu-build tool
3. include more examples including fullscreen/transparent app-window
-->
Another customizable Application-Launcher written in Rust
### Features
@ -18,9 +12,19 @@ Another customizable Application-Launcher written in Rust
### Installation
##### Nix
RMenu now has Nix support thanks to
[@LordGrimmauld](https://github.com/LordGrimmauld)!
Try it on nix directly via
```bash
nix run github:imgurbot12/rmenu -- -r drun
```
##### Other Platforms:
Install Dependencies (Ubuntu)
```bash
@ -35,12 +39,14 @@ $ make install
### Usage
View all available options with the builtin help:
View all available options with the built-in help:
```bash
$ rmenu --help
```
##### Plugins
RMenu Comes with a few default plugins.
| Name | Description |
@ -66,11 +72,13 @@ Or even run plugins in combination if you'd like:
$ rmenu -r run -r drun
```
Custom Menus can also be passed much like Dmenu by passing items via an input.
The schema follows a standard as defined in [rmenu-plugin](./rmenu-plugin)
##### Direct Input
Custom Menus can also be passed via `/dev/stdin` or as an input file. The schema
follows a standard as defined in [rmenu-plugin](./rmenu-plugin)
```bash
$ generate-my-menu.sh > input.json
$ ./examples/rmenu-build.sh > input.json
$ rmenu -i input.json
```
@ -78,9 +86,21 @@ When neither a plugin nor an input are specified, rmenu defaults to reading from
stdin.
```bash
$ generate-my-menu.sh | rmenu
$ ./examples/rmenu-build.sh | rmenu
```
##### Supported Formats
RMenu has two supported input formats: dmenu-like and JSON. JSON is the default
provided by rmenu and allows for rich configuration and controls for dynamically
generated menus. You can switch between supported formats with `-f`:
```bash
$ printf 'foo\nbar\nbaz' | rmenu -f dmenu
```
Check the [examples](./examples) folder for more examples.
### Configuration
Customize RMenu Behavior and Appearal in a

10
examples/dmenu.sh Executable file
View File

@ -0,0 +1,10 @@
#!/bin/sh
# basic dmenu-like implementation
eval "`printf 'ls /\ndf -h\nwho\nfoot -e top' | rmenu -f dmenu`"
# supports dmenu
echo "========="
echo try "\"printf 'foo\\\\nbar\\\\nbaz' | rmenu -f dmenu\""
echo try "\"exec \`dmenu_path | rmenu -f dmenu\`\""

13
examples/rmenu-build.sh Executable file
View File

@ -0,0 +1,13 @@
#!/bin/sh
# customize rmenu options directly from stdin
rmenu-build options --placeholder 'placeholder'
# build entries for rmenu using rmenu-build tool to define json
rmenu-build entry -n foo -c 'run ls /' -a "`rmenu-build action ls / -c action-comment-1`"
rmenu-build entry -n foo -c 'run df -h' -a "`rmenu-build action -c baz -- df -h`"
rmenu-build entry -n baz -c 'run who' -a "`rmenu-build action who -c action-comment-3`"
# supports alternate action-modes like `echo` and `terminal`
rmenu-build entry -n hello -c 'echo helloworld' -a "`rmenu-build action --mode echo hello world!`"
rmenu-build entry -n term -c 'runs top in term' -a "`rmenu-build action --mode terminal top`"