23
hosts/common/configs/user/gui/clipbook/copy.sh
Executable file
23
hosts/common/configs/user/gui/clipbook/copy.sh
Executable file
@@ -0,0 +1,23 @@
|
||||
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
|
Reference in New Issue
Block a user