aboutsummaryrefslogtreecommitdiffstats
path: root/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'README.md')
-rw-r--r--README.md32
1 files changed, 22 insertions, 10 deletions
diff --git a/README.md b/README.md
index ef5b957..c69b798 100644
--- a/README.md
+++ b/README.md
@@ -1,9 +1,8 @@
# lclipd
-A minimal clipboard manager in lua.</br>
+A small clipboard manager in lua.</br>
# How it works
* lclipd runs the clipboard contents through `detect-secrets` and then puts the content in a sqlite3 database
-* lclipd keeps the clipboard content database in the `tmp` directory
* Both X11 and wayland 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
@@ -14,7 +13,7 @@ A minimal clipboard manager in lua.</br>
* 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 include 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 that installed on your system.
* [detect-secrets](https://github.com/Yelp/detect-secrets)
* xclip
* wl-clipboard
@@ -28,7 +27,7 @@ pip install detect-secrets
## Usage
-lclipd is technically just the "backend". One way to have a frontend is to use dmenu:</br>
+lclipd is technically just the "backend". One way to have a "frontend" is to use dmenu:</br>
```sh
#!/usr/bin/env sh
@@ -36,15 +35,28 @@ SQL_DB="$(cat /tmp/lclipd/lclipd_db_name)"
content=$(sqlite3 "${SQL_DB}" "select replace(content,char(10),' '),id from lclipd;" | dmenu -D "|" -l 20 -p "lclipd:")
sqlite3 "${SQL_DB}" "select content from lclipd where id = ${content}" | xsel -ib
```
-For the above to work you have to have added the dynamic patch to dmenu.</br>
+You can swap `xclip` with `wl-paste` for wayland.</br>
+For the above to work you have to have added the `dynamic` patch to dmenu.</br>
-One way to query the db through the TCP socket is like this:
+You could also query the db through the TCP server.</br>
+The TCP server will return a JSON array as a response.</br>
+You can use something like `jq` for further processing of the returned JSON object on the shell.</br>
+An example of a terminal-oriented "frontend":
```sh
-echo 'select * from lclipd;' > ./cmd.sql
-nc -v 127.0.0.1:9999 < ./cmd.sql
+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)
+```
+
+The author has this setup in their `.zshrc`:
+```sh
+fzf_lclipd() {
+ local clipboard_content=$(echo 'select * from lclipd;' | nc 127.0.0.1 9999 | jq '.[1]' | awk '{print substr($0, 2, length($0) - 2)}' | fzf-tmux -p 80%,80%)
+ if [[ -n ${clipboard_content} ]]; then
+ tmux set-buffer ${clipboard_content}
+ fi
+}
+zle -N fzf_lclipd
+bindkey '' fzf_lclipd
```
-The TCP server will return a JSON array as a response.</br>
-You can use `jq` or `jaq` for further processing of the returned JSON object on the shell.</br>
## Options