From b41d912d0144d801e35817ba58004da82b8c6ae9 Mon Sep 17 00:00:00 2001 From: terminaldweller Date: Fri, 12 May 2023 12:19:21 +0330 Subject: added some new options, updated the readme accordingly --- README.md | 47 +++++++++++++++++++++++++++++++++++++---------- 1 file changed, 37 insertions(+), 10 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index c69b798..a330c58 100644 --- a/README.md +++ b/README.md @@ -3,31 +3,30 @@ A small clipboard manager in lua.
# How it works * lclipd runs the clipboard contents through `detect-secrets` and then puts the content in a sqlite3 database -* Both X11 and wayland are supported +* X11, Wayland, Tmux and custom clipboard commands are supported * it is meant to be run as a user service. It can also be simply run by just running the script directly * the logs are put in the system log * lclipd does not require elevated privileges to run nor does it need to have extra capabilities -* exposes a TCP server which you can use to query the db(on localhost:9999 by default) +* exposes a TCP server(yes a TCP server, not an HTTP server) which you can use to query the db(on localhost:9999 by default) ## Requirements * lua5.3 * [luaposix](https://github.com/luaposix/luaposix) * [argparse](https://github.com/mpeterv/argparse) -* [luasqlite3](http://lua.sqlite.org/index.cgi/home): luasqlite3 comes in two flavours. One includes sqlite3 in the lua rock itself and one does not. If you choose to install the rock without sqlite3 you need to have that installed on your system. +* [luasqlite3](http://lua.sqlite.org/index.cgi/home): luasqlite3 comes in two flavours. One includes sqlite3 in the lua rock itself and one does not. If you choose to install the rock without sqlite3 you need to have sqlite3 installed on your system. * [detect-secrets](https://github.com/Yelp/detect-secrets) -* xclip -* wl-clipboard +* `xclip` ot `wl-clipboard` or whatever clipboard command you use ```sh luarocks install --local luaposix luarocks install --local argparse luarocks install --local lsqlite3 -pip install detect-secrets +pipx install detect-secrets ``` ## Usage -lclipd is technically just the "backend". One way to have a "frontend" is to use dmenu:
+lclipd is technically just the "backend". One way to have a "frontend" is to use something like dmenu:
```sh #!/usr/bin/env sh @@ -43,7 +42,7 @@ The TCP server will return a JSON array as a response.
You can use something like `jq` for further processing of the returned JSON object on the shell.
An example of a terminal-oriented "frontend": ```sh -tmux set-buffer $(echo 'select * from lclipd;' | nc 127.0.0.1 9999 | jq '.[1]' | awk '{print substr($0, 2, length($0) - 2)}' | fzf-tmux) +tmux set-buffer $(echo 'select * from lclipd;' | nc 127.0.0.1 9999 | jq '.[1]' | awk '{print substr($0, 2, length($0) - 2)}' | fzf) ``` The author has this setup in their `.zshrc`: @@ -57,18 +56,25 @@ fzf_lclipd() { zle -N fzf_lclipd bindkey '' fzf_lclipd ``` +You can also put the db on a network share and then have different instanecs on different hosts use the same common db, effectively sharing your clipboard between different devices on the same subnet.
## Options ``` -Usage: ./lclipd.lua [-h] [-s ] [-d ] - [-a
] [-p ] +Usage: ./lclipd.lua [-h] [-s ] [-e ] + [-d ] [-a
] [-p ] + [-c ] [--x_clip_cmd ] + [--wayland_clip_cmd ] + [--tmux_clip_cmd ] [--db_path ] Options: -h, --help Show this help message and exit. -s , --hist_size number of distinct entries for clipboard history + -e , + --detect_secrets_exe + the command used to call detect-secrets (default: detect-secrets) -d , --detect_secrets_args options that will be passed to detect secrets (default: ) @@ -76,7 +82,28 @@ Options: --address
-p , port to bind to --port + -c , + --custom_clip_command + custom clipboard read command (default: ) + --x_clip_cmd + the command used to get the X clipboard content (default: xsel -ob) + --wayland_clip_cmd + the command used to get the wayland clipboard content (default: wl-paste) + --tmux_clip_cmd + the command used to get the tmux paste-buffer content (default: tmux show-buffer) + --db_path path to the db location,currently :memory: and ''(empty) is not supported (default: /dev/shm/lclipd) ``` ## Supported OSes lcilpd uses luaposix so any POSIX-half-compliant OS will do.
+ +## Acknowledgements +* [luaposix](https://github.com/luaposix/luaposix) - pretty much all the "heavy lifting" is done using luaposix +* [detect-secrets](https://github.com/Yelp/detect-secrets) +* [luasqlite3](http://lua.sqlite.org/index.cgi/home) +* [json.lua](https://github.com/rxi/json.lua) - used as a vendored dependency +* [argparse](https://github.com/mpeterv/argparse) + +## TODO +* support `in-memory` and `temporary` databases. +* add IPv6 support -- cgit v1.2.3