Closed green-green-avk closed 2 years ago
Workaround:
~/content-base.sh
:
#!/bin/bash
DOWNLOADS=~/Downloads/
XCLIPBOARD=~/Xclipboard
mkdir -p "$DOWNLOADS"
msg_err() {
echo -en '\e[1;37;41m\e[2K\n\e[2K'
echo " [ $1 ]"
echo -en '\e[2K\n\e[0m\e[2K'
}
msg_ok() {
echo -en '\e[1;37;40m\e[2K\n\e[2K [ \e[32m'
echo -n "$1"
echo -en '\e[37m ]\n\e[2K\n\e[0m\e[2K'
}
msg_wait() {
echo -en '\e[?1004h'
read -n 1 -rs -p ' *** Press any key ***'
echo -en '\e[?1004l'
}
save_uri() {
URI="$1"
if R="$(termsh copy -fu "$URI" -tp "$DOWNLOADS" 2>&1)"
then
msg_ok "[$URI] saved to [$DOWNLOADS]"
else
msg_err "Failed to save [$URI] to [$DOWNLOADS]: $R"
fi
}
send_as_text() {
URI="$1"
if R="$(termsh cat "$URI" | termsh send --text-stdin 2>&1)"
then
msg_ok "Sending [$URI]..."
else
msg_err "Failed to send [$URI]: $R"
fi
}
convert_by() {
CMD=($1)
URI="$2"
EXT="$3"
TYPE="$4"
FN="$(termsh name "$URI")"
if R="$(termsh cat "$URI" | "${CMD[@]}" | termsh send -n "${FN%.*}.$EXT" -m "$TYPE" 2>&1)"
then
msg_ok "Sending [$URI]..."
else
msg_err "Failed to convert or send [$URI]: $R"
fi
}
convert_file_by() {
CMD=($1)
CMD=("${CMD[0]}" "${CMD[@]}")
URI="$2"
EXT="$3"
TYPE="$4"
FN="$(termsh name "$URI")"
if R="$(termsh with-uris "${CMD[@]}" "$URI" | termsh send -n "${FN%.*}.$EXT" -m "$TYPE" 2>&1)"
then
msg_ok "Sending [$URI]..."
else
msg_err "Failed to convert or send [$URI]: $R"
fi
}
save_uri_to_xclipboard() {
URI="$1"
if R="$(termsh copy -fu "$URI" -tp "$XCLIPBOARD" 2>&1)"
then
msg_ok "[$URI] saved to X clipboard"
else
msg_err "Failed to save [$URI] to X clipboard: $R"
fi
}
save_text_to_xclipboard() {
TEXT="$1"
if R="$(echo -n "$TEXT" 2>&1 1>"$XCLIPBOARD")"
then
msg_ok "'$TEXT' saved to X clipboard"
else
msg_err "Failed to save '$TEXT' to X clipboard: $R"
fi
}
~/content-to-X-clipboard.sh
:
#!/bin/bash
. ./content-base.sh
TEXT="$INPUT_TEXT"
TEXT="${TEXT:-$INPUT_SPANNED}"
TEXT="${TEXT:=$INPUT_HTML}"
if [[ -n $TEXT ]]
then
save_text_to_xclipboard "$TEXT"
DONE=1
elif [[ -n $INPUT_URI ]]
then
save_uri_to_xclipboard "$INPUT_URI"
DONE=1
elif [[ -n $INPUT_URIS ]]
then
for URI in $INPUT_URIS
do
save_uri_to_xclipboard "$URI"
DONE=1
break
done
fi
[[ -z $DONE ]] && msg_err 'Nothing to save'
msg_wait
Profile settings: Share in "share with" / "open in" dialog: ☑ Execute:
"$DATA_DIR/proots/linuxcontainers-debian-buster/run" '' '~/content-to-X-clipboard.sh'
Another Term settings quick link:
local-terminal:/opts?perm_favmgmt=false&shareable=true&charset=UTF-8&screen_cols=0&screen_rows=0&keymap=&wakelock.acquire_on_connect=true&terminal_string=xterm&perm_pluginexec=true&font_size_auto=false&wakelock.release_on_disconnect=true&execute=%22%24DATA_DIR%2Fproots%2Flinuxcontainers-debian-buster%2Frun%22%20''%20'~%2Fcontent-to-X-clipboard.sh'&name=Copy%20to%20X%20clipboard&term_compliance=ansi&terminate.on_disconnect=true
Done.
Usage of Android international keyboard input and clipboard integration: https://github.com/green-green-avk/AnotherTerm-scripts/tree/master/Xwayland
That is it.