No description
Find a file
2021-11-10 15:30:03 -08:00
.gitignore Initial commit 2021-11-10 13:05:34 -08:00
LICENSE Initial commit 2021-11-10 13:05:34 -08:00
README.md Add README 2021-11-10 15:29:15 -08:00
snippets_example.toml Add example snippets file 2021-11-10 15:30:03 -08:00

Snipmenu

A Dmenu/Rofi/Bemenu snippet manager compatible with the Pet TOML snippet file format.

I wanted something similar to keepmenu or bitwarden-menu that can type snippets equally into a terminal or graphical window with necessarily relying on copy/paste.

Differences from Pet:

  • Uses graphical launcher instead of terminal (unless you use bemenu in ncurses mode).
  • There's no exec option. The command or snippet is typed into the focused window using xdotool or ydotool and can either be edited in place or executed.
  • Copy/paste using xsel or xclip is available if desired.
  • No Github/Gitlab sync.

Installation

go get github.com/firecat53/snipmenu.go OR download binary

Ensure $GOPATH/bin is in your $PATH.

Requirements

  • Dmenu, Rofi or Bemenu
  • xdotool
  • xsel or xclip
  • (optional) ydotool if using a wlroots window manager like Sway

Features

  • Add/edit/delete information snippets:
    • Command line invocations
    • Addresses, email addresses
  • Compatible with Pet snippet format
  • Snippets can contain:
    • Description
    • The snippet
    • Tags
    • Example command output
  • Variable substitution when executing commands using <variable>

License

MIT

Usage

snipmenu

Menu options should be self explanatory. To use variables:

[[snippets]]
  command = "ssh <host>:<port=22>"
  description = "SSH to hostname"

When selected, the user will be prompted for host and port prior to typing the command. Note that defaults can be defined using <param=value>.

Snippet file format

[[snippets]]
  description = "ping"
  command = "ping <ip=8.8.8.8>"
  tag = ["network", "google"]
  output = ""

[[snippets]]
  command = "echo | openssl s_client -connect example.com:443 2>/dev/null |openssl x509 -dates -noout"
  description = "Show expiration date of SSL certificate"
  tag = ["network", "ssl"]
  output = """
notBefore=Nov  3 00:00:00 2015 GMT
notAfter=Nov 28 12:00:00 2018 GMT"""