diff options
Diffstat (limited to '')
-rw-r--r-- | README.md | 50 |
1 files changed, 31 insertions, 19 deletions
@@ -1,21 +1,24 @@ # lclipd + 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 -* 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(yes a TCP server, not an HTTP server) which you can use to query the db(on localhost:9999 by default) + +- lclipd runs the clipboard contents through `detect-secrets` and then puts the content in a sqlite3 database +- 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(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 sqlite3 installed on your system. -* [detect-secrets](https://github.com/Yelp/detect-secrets) -* `xclip` ot `wl-clipboard` or whatever clipboard command you use + +- 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 sqlite3 installed on your system. +- [detect-secrets](https://github.com/Yelp/detect-secrets) +- `xclip` ot `wl-clipboard` or whatever clipboard command you use ```sh luarocks install --local luaposix @@ -27,6 +30,7 @@ pipx install detect-secrets ## Usage lclipd is technically just the "backend". One way to have a "frontend" is to use something like dmenu:</br> + ```sh #!/usr/bin/env sh @@ -34,6 +38,7 @@ 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 ``` + 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> @@ -41,11 +46,13 @@ 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 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`: + ```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%) @@ -56,10 +63,11 @@ fzf_lclipd() { zle -N fzf_lclipd bindkey '^O' 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.</br> +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.</br> You can run lclipd as a user service. The author uses this for runit:</br> + ```sh #!/bin/sh exec \ @@ -111,14 +119,18 @@ Options: ``` ## Supported OSes + lcilpd uses luaposix so any POSIX-half-compliant OS will do.</br> ## 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) + +- [luaposix](https://github.com/luaposix/luaposix) - pretty much all the "heavy lifting" is done using luaposix +- [cqueue](https://github.com/wahern/cqueues) +- [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. + +- support `in-memory` and `temporary` databases. |