Addd binds for QR and deleting items in buffer.
This commit is contained in:
parent
10a658bd5b
commit
486e5faa64
|
@ -65,7 +65,6 @@ on-select(){
|
|||
if [ -z "$result" ]; then
|
||||
exit 0
|
||||
fi
|
||||
echo 1
|
||||
wl-paste
|
||||
local file
|
||||
file="$(parse-file "${result}")"
|
||||
|
@ -74,12 +73,11 @@ on-select(){
|
|||
}
|
||||
|
||||
menu(){
|
||||
#--bind "del:execute-silent($0 delete '{}')+abort" \
|
||||
list | fzf --read0 +s \
|
||||
--info=hidden \
|
||||
--reverse \
|
||||
-d "${delim}" --nth ..2 --with-nth 2 \
|
||||
--bind="del:execute()" \
|
||||
--bind="del:execute-silent($0 delete {})+reload($0 list),f1:execute($0 qr {})" \
|
||||
--prompt='clip:: ' \
|
||||
--pointer='➜' \
|
||||
--color="gutter:0,prompt:4" \
|
||||
|
@ -101,9 +99,28 @@ Hello, this is the usuage menu. $0 supports the following arguments.
|
|||
- lock :: prevents daemon/on-clip from saving value. Use for passwords, etc.
|
||||
- unlock :: like lock, but in reverse.
|
||||
- preview :: the preview used by fzf. Requires clip file.
|
||||
- delete :: deletes the file, requires file.
|
||||
- qr :: bind to f1. Displays a qr code of the value.
|
||||
EOF
|
||||
}
|
||||
|
||||
qr(){
|
||||
local file
|
||||
file="$(parse-file "$1")"
|
||||
cat $file |
|
||||
qrencode -o - \
|
||||
--size=25 \
|
||||
--background=161720 \
|
||||
--foreground=AAB5C6 |
|
||||
feh -
|
||||
}
|
||||
|
||||
delete(){
|
||||
local file
|
||||
file="$(parse-file "$1")"
|
||||
rm $file
|
||||
}
|
||||
|
||||
preview(){
|
||||
local file
|
||||
file="$(parse-file "$1")"
|
||||
|
@ -118,16 +135,14 @@ preview(){
|
|||
|
||||
case "$1" in
|
||||
daemon|on-copy|menu|list)
|
||||
$1
|
||||
echo 3
|
||||
wl-paste
|
||||
;;
|
||||
$1;;
|
||||
lock)
|
||||
touch "$workdir/.lock" ; echo "locked";;
|
||||
unlock)
|
||||
rm -f "$workdir/.lock" ; echo "unlocked";;
|
||||
preview)
|
||||
shift ; preview "$*";;
|
||||
preview|delete|qr)
|
||||
var=$1
|
||||
shift ; $var $*;;
|
||||
*)
|
||||
usage;;
|
||||
esac
|
||||
|
|
Loading…
Reference in New Issue
Block a user