From 100188843ecc2c9f6597fd7893603fcb5aefd07b Mon Sep 17 00:00:00 2001 From: Victorhck Date: Thu, 2 Apr 2020 18:29:56 +0200 Subject: [PATCH 1/6] fix error added "s" to http utr to fits with the pattern and fix the error that shows at the end --- script/susepaste-screenshot | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/script/susepaste-screenshot b/script/susepaste-screenshot index cb75337..e848519 100755 --- a/script/susepaste-screenshot +++ b/script/susepaste-screenshot @@ -102,13 +102,13 @@ rm -f "$TMP" # Check the results and inform the user -if expr "$URL" : "^http://susepaste.org/[0-9a-f]\+" > /dev/null; then - ID="`echo "$URL" | sed 's|^http://susepaste.org/\([0-9a-f]\+\)[^0-9a-f]*|\1|'`" +if expr "$URL" : "^https://susepaste.org/[0-9a-f]\+" > /dev/null; then + ID="`echo "$URL" | sed 's|^https://susepaste.org/\([0-9a-f]\+\)[^0-9a-f]*|\1|'`" TEXT="Pasted as: - http://susepaste.org/$ID - http://paste.opensuse.org/$ID" + https://susepaste.org/$ID + https://paste.opensuse.org/$ID" if [ -x /usr/bin/xclip ]; then - echo "http://susepaste.org/$ID" | xclip -selection XA_CLIPBOARD + echo "https://susepaste.org/$ID" | xclip -selection XA_CLIPBOARD TEXT="$TEXT Link is also in your clipboard." fi From dc8edb4dd7dd8960c48526ef06328edec02a15da Mon Sep 17 00:00:00 2001 From: Victorhck Date: Thu, 2 Apr 2020 18:33:02 +0200 Subject: [PATCH 2/6] include PR #9 by DimStar --- script/susepaste-screenshot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/susepaste-screenshot b/script/susepaste-screenshot index e848519..3c869dd 100755 --- a/script/susepaste-screenshot +++ b/script/susepaste-screenshot @@ -96,7 +96,7 @@ URL="` curl -v -F "file=@$TMP" -F "title=$TITLE" -F "expire=$EXPIRE" \ -F "name=$NICK" -F "submit=submit" -F "lang=image" \ $API_KEY \ - http://susepaste.org 2>&1 | sed -n 's|<\ Location:\ ||p' `" + https://susepaste.org 2>&1 | sed -n 's|<\ [lL]ocation:\ ||p' `" rm -f "$TMP" From 1e319089497c6d5cefc61866b48e2f489fde4ef7 Mon Sep 17 00:00:00 2001 From: Victorhck Date: Thu, 2 Apr 2020 18:43:00 +0200 Subject: [PATCH 3/6] show help usage with -h option before that * was used to show how to use the command. I think that -h it's most common --- script/susepaste-screenshot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/susepaste-screenshot b/script/susepaste-screenshot index 3c869dd..0505ff5 100755 --- a/script/susepaste-screenshot +++ b/script/susepaste-screenshot @@ -52,7 +52,7 @@ while [ "$1" ]; do EXPIRE="$2" shift 2 ;; - *) + "x-h") echo "openSUSE Paste screenshot script" echo "" echo " usage:" From 4fd6392af6ed4fd1ceac9347c852a3ffbf5bbfa8 Mon Sep 17 00:00:00 2001 From: Victorhck Date: Thu, 2 Apr 2020 18:43:58 +0200 Subject: [PATCH 4/6] show help usage with -h option --- script/susepaste | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/script/susepaste b/script/susepaste index f2fceec..5fca7e4 100755 --- a/script/susepaste +++ b/script/susepaste @@ -58,7 +58,7 @@ while [ "$2" ]; do "x-s" ) SCHEMA="$2" shift 2 ;; - * ) + "x-h" ) echo "openSUSE Paste script" echo "" echo " usage:" @@ -121,7 +121,7 @@ URL="` curl -v -F "$TYPE=$INPUT" -F "title=$TITLE" -F "expire=$EXPIRE" \ -F "name=$NICK" -F "submit=submit" -F "lang=$SYNTAX" \ $API_KEY \ - ${SCHEMA}://susepaste.org 2>&1 | sed -n 's|<\ Location:\ ||p' `" + ${SCHEMA}://susepaste.org 2>&1 | sed -n 's|<\ [lL]ocation:\ ||p' `" # Check the results and inform the user From 19af837d2935c28257393eab3f52047ffc6a0555 Mon Sep 17 00:00:00 2001 From: Victorhck Date: Thu, 2 Apr 2020 18:52:06 +0200 Subject: [PATCH 5/6] add delay option added delay option to get the screenshot (maybe the screen to get it's in another virtual desktop or window, etc...) --- script/susepaste-screenshot | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/script/susepaste-screenshot b/script/susepaste-screenshot index 0505ff5..0068739 100755 --- a/script/susepaste-screenshot +++ b/script/susepaste-screenshot @@ -52,11 +52,15 @@ while [ "$1" ]; do EXPIRE="$2" shift 2 ;; + "x-d") + DELAY="$2" + shift 2 + ;; "x-h") echo "openSUSE Paste screenshot script" echo "" echo " usage:" - echo " susepaste-screenshot [--all] [-n nick] [-t title] [-e expire] [file]" + echo " susepaste-screenshot [--all] [-n nick] [-t title] [-e expire] [-d delay (sec)] [file]" echo "" exit 0 ;; @@ -82,6 +86,8 @@ fi # Real pasting and getting back the URL of the paste +sleep $DELAY + if [ "xselect" = "x$WINDOW" ]; then WINDOW="`LANG=C wmctrl -v -a :SELECT: 2>&1 | sed -n 's|Using\ window:[[:blank:]]*0x\([0-9]*\)|0x\1|p'`" [ "$TITLE" ] || TITLE="`wmctrl -l | sed -n "s|$WINDOW[[:blank:]]\+[^[:blank:]]\+[[:blank:]]\+[^[:blank:]]\+[[:blank:]]\+\(.*\)|\1|p"`" From d9fa4d532da22720b0d3b27e02d3448baf0fe050 Mon Sep 17 00:00:00 2001 From: Victorhck Date: Thu, 2 Apr 2020 20:32:09 +0200 Subject: [PATCH 6/6] setup DELAY variable in the begining --- script/susepaste-screenshot | 1 + 1 file changed, 1 insertion(+) diff --git a/script/susepaste-screenshot b/script/susepaste-screenshot index 0068739..cf28dae 100755 --- a/script/susepaste-screenshot +++ b/script/susepaste-screenshot @@ -23,6 +23,7 @@ WINDOW=select API_KEY="" +DELAY=0 # Read configuration file