Giter Club home page Giter Club logo

Comments (5)

green-green-avk avatar green-green-avk commented on May 26, 2024

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

from anotherterm.

green-green-avk avatar green-green-avk commented on May 26, 2024

#26 (comment)

from anotherterm.

green-green-avk avatar green-green-avk commented on May 26, 2024

Implemented: 9178d9f

from anotherterm.

green-green-avk avatar green-green-avk commented on May 26, 2024

from anotherterm.

green-green-avk avatar green-green-avk commented on May 26, 2024

Done.

Usage of Android international keyboard input and clipboard integration:
https://github.com/green-green-avk/AnotherTerm-scripts/tree/master/Xwayland

from anotherterm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.