From 80050281a53813021abe6ee7f6d12535d1337774 Mon Sep 17 00:00:00 2001 From: epoch Date: Wed, 20 Oct 2021 22:51:31 +0000 Subject: prompt was empty if URL was short enough. --- copy_start_nevermind.sh | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/copy_start_nevermind.sh b/copy_start_nevermind.sh index 3f7f7af..66bf922 100755 --- a/copy_start_nevermind.sh +++ b/copy_start_nevermind.sh @@ -1,16 +1,35 @@ #!/bin/bash [ "$1" ] || exit 1 uri="$1" + +queryfiltereduri="$(uriqueryfilter "$uri")" +if [ "$uri" != "$queryfiltereduri" ];then + trackeruri="$uri" + uri="$queryfiltereduri" +fi + +### this clipping should be part of choose probably if [ "${uri}" != "${uri:0:64}" ];then prompt="${uri:0:64}..." +else + prompt="${uri}" fi + scheme="$(uricut -s <<< "$uri")" -selection="$(printf "start with: %s\ncopy\nshorten\nverbose\nforget\nQR\n%s\n" "$(urigetline "$uri")" "$(printf "%s\n" "$uri" | uricut | grep -v '^whole')" \ +selection="$(printf "start with: %s\nremote_csn\ncopy\nshorten\nunshorten\ntitle\nverbose\nforget\nQR\n%s\n" "$(urigetline "$uri")" "$(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" case "$selection" in +remote_csn) + remote_host="$(choose "remote host to run URI on> " < ~/.config/urirhosts.conf)" + ### TODO: include in the list our own display either to use -X or use our IP and display number? + display="$(ssh "${remote_host}" myXdisplays | choose "which display?")" + uristart "ssh://${remote_host}/copy_start_nevermind.sh%20${uri}?DISPLAY=$display" + exit 0 + ;; + verbose) x-terminal-emulator -e less -f <(printf "%s" "$uri") exit 0 @@ -21,6 +40,11 @@ copy) exit 0 ;; +title) + copy_start_nevermind.sh "$(urititle "$uri")" + exit 0 + ;; + forget) cp ~/.cache/uristart.log ~/.cache/uristart.log.tmp cat ~/.cache/uristart.log.tmp | grep -vFw "${uri}" > ~/.cache/uristart.log @@ -44,11 +68,18 @@ shorten) exit 0 ;; +unshorten) + copy_start_nevermind.sh "$(unshorten.sh "$uri")" + exit 0 + ;; + QR) x-terminal-emulator -hold -e qr "$uri" ;; *) - exec printf "%s" "$selection" | cut '-d ' -f2- | xclip -i + if [ "$selection" ];then + exec printf "%s" "$selection" | cut '-d ' -f2- | xclip -i + fi ;; esac -- cgit v1.2.3