26 lines
468 B
Bash
Executable File
26 lines
468 B
Bash
Executable File
# shellcheck shell=bash
|
|
|
|
list() {
|
|
echo -en "\0keep-selection\x1ftrue\n"
|
|
jq -r 'keys[]' "$BOOKMARKS"
|
|
}
|
|
|
|
handle() {
|
|
key="$1"
|
|
data=$(jq -r --arg key "$key" '.[$key]' "$BOOKMARKS")
|
|
|
|
type=$(echo "$data" | jq -r '.type')
|
|
content=$(echo "$data" | jq -r '.content')
|
|
|
|
if [[ "$type" == "file" ]]; then
|
|
wl-copy < "$content"
|
|
elif [[ "$type" == "text" ]]; then
|
|
echo -n "$content" | wl-copy
|
|
fi
|
|
}
|
|
|
|
case ${ROFI_RETV} in
|
|
0) list ;;
|
|
1) handle "$@" ;;
|
|
esac
|