repo: uritools
action: commit
revision: 
path_from: 
revision_from: e4581b75d2f157c724f2194002430841cb9dda16:
path_to: 
revision_to: 
git.thebackupbox.net
uritools
git clone git://git.thebackupbox.net/uritools
commit e4581b75d2f157c724f2194002430841cb9dda16
Author: epoch 
Date:   Wed Jan 19 06:47:10 2022 +0000

    made QR choice output uri too. added QR-image choice to output to a file and launch it. made shorten use gemini-handler instead of gemini-get directly

diff --git a/copy_start_nevermind.sh b/copy_start_nevermind.sh
index 1869dff7ecfbc05ce6184307fcee9fde14e9714f..
index ..947d1b0903e754996b31d1d9b53ebd29a81f3bad 100755
--- a/copy_start_nevermind.sh
+++ b/copy_start_nevermind.sh
@@ -22,7 +22,7 @@ if [ "$with" != "$(urigetline -a "$uri" < <(uristart.conf))" ];then
   with="[multiple matches]"
 fi

-selection="$(printf "start with: %s\nremote_csn\ncopy\nshorten\nunshorten\ntitle\nverbose\nforget\nQR\n%s\n" "${with}" "$(printf "%s\n" "$uri" | uricut | grep -v '^whole')" \
+selection="$(printf "start with: %s\nremote_csn\ncopy\nshorten\nunshorten\ntitle\nverbose\nforget\nQR-image\nQR\n%s\n" "${with}" "$(printf "%s\n" "$uri" | uricut | grep -v '^whole')" \
              | choose "${prompt}")"
 #            | choose "$(printf "uri: '%s'\nwill be ran with: %s\n" "$uri" "$(urigetline "$uri")" )" -default start )"
 echo "$selection"
@@ -59,6 +59,7 @@ forget)

 start*)
   scheme="$(printf "%s\n" "$uri" | uricut -s)"
+  ### might make sense to use xwindowURI for this value
   if [ "$(xdotool getwindowfocus)" != 0 ];then
     refering_window_title="$(xdotool getwindowfocus getwindowname)"
   else
@@ -70,7 +71,7 @@ start*)

 shorten)
   escaped="$(uriescape "$uri")"
-  gemini-get "gemini://epo.k.vu/submit?$escaped" | tr -d '\r' | tail -n+2 | head -n2 | tr '\n' '\0' | xargs -n1 -0 copy_start_nevermind.sh
+  gemini-handler "gemini://epo.k.vu/submit?$escaped"
   exit 0
   ;;

@@ -79,8 +80,15 @@ unshorten)
   exit 0
   ;;

+QR-image)
+  escaped="$(uriescape "$uri")"
+  file=~/Pictures/qr-codes/"${escaped}".png
+  qr "$uri" > "$file"
+  copy_start_nevermind.sh "file://$file"
+  ;;
+
 QR)
-  x-terminal-emulator -hold -e qr "$uri"
+  x-terminal-emulator -hold -e bash -c "qr '$uri';echo 'uri: $uri'"
   ;;

 *)

-----END OF PAGE-----