summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile4
-rwxr-xr-xcopy_start_nevermind.sh41
-rwxr-xr-xurnstart6
3 files changed, 34 insertions, 17 deletions
diff --git a/Makefile b/Makefile
index 8a87a74..16d2e7c 100644
--- a/Makefile
+++ b/Makefile
@@ -43,5 +43,5 @@ install: all
install -t $(PREFIX)/bin data_handler
install -t $(PREFIX)/bin unshorten.sh
install -t $(PREFIX)/bin shorten
- chgrp shorten $(PREFIX)/bin/shorten
- chmod g+s $(PREFIX)/bin/shorten
+ install -t $(PREFIX)/bin urnstart
+ chgrp shorten $(PREFIX)/bin/shorten && chmod g+s $(PREFIX)/bin/shorten
diff --git a/copy_start_nevermind.sh b/copy_start_nevermind.sh
index 9c77235..0e4b60f 100755
--- a/copy_start_nevermind.sh
+++ b/copy_start_nevermind.sh
@@ -5,33 +5,46 @@ if [ "${uri}" != "${uri:0:64}" ];then
prompt="${uri:0:64}..."
fi
scheme="$(uricut -s <<< "$uri")"
-selection="$(printf "start\ncopy\nshorten\nverbose\nforget\n%s\n" "$(printf "%s\n" "$uri" | uricut | grep -v '^whole')" \
+selection="$(printf "start with: %s\ncopy\nshorten\nverbose\nforget\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"
-if [ "$selection" = "verbose" ];then
+case "$selection" in
+
+verbose)
x-terminal-emulator -e less -f <(printf "%s" "$uri")
exit 0
-fi
-if [ "$selection" = "copy" ];then
+ ;;
+
+copy)
printf "%s" "$uri" | xclip -i
exit 0
-fi
-if [ "$selection" = "forget" ];then
+ ;;
+
+forget)
cp ~/.cache/uristart.log ~/.cache/uristart.log.tmp
cat ~/.cache/uristart.log.tmp | grep -vFw "${uri}" > ~/.cache/uristart.log
exit 0
-fi
-if [ "$selection" = "start" ];then
+ ;;
+
+start*)
scheme="$(printf "%s\n" "$uri" | uricut -s)"
- exec uristart "$uri" "$(xdotool getwindowfocus getwindowname)"
+ if [ "$(xdotool getwindowfocus)" != 0 ];then
+ refering_window_title="$(xdotool getwindowfocus getwindowname)"
+ else
+ refering_window_title="[root window]"
+ fi
+ exec uristart "$uri" "$refering_window_title"
exit 0
-fi
-if [ "$selection" = "shorten" ];then
+ ;;
+
+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
exit 0
-fi
-if [ "$selection" ];then
+ ;;
+
+*)
exec printf "%s" "$selection" | cut '-d ' -f2- | xclip -i
-fi
+ ;;
+esac
diff --git a/urnstart b/urnstart
index 4883b01..ec610c1 100755
--- a/urnstart
+++ b/urnstart
@@ -20,6 +20,10 @@ fi
if [ "$nid" = "ietf" ];then
if [ "$nss" = "rfc" ];then
- uristart "https://tools.ietf.org/html/rfc""${nss2}"
+ uristart gopher://thebackupbox.net:70/0/rfc/rfc${nss2}.txt
fi
fi
+
+if [ "$nid" = "xkcd" ];then
+ uristart "https://xkcd.com/${nss}"
+fi