pmss (Poor Man's Screenshooter)

VastOne

I never see one so it does appear as if it is something external to the script that is not happening on mine

I just saw it on another boot of VSIDO... let me check something first

VSIDO      VSIDO Change Blog    

    I dev VSIDO

VastOne

VSIDO      VSIDO Change Blog    

    I dev VSIDO

VastOne

I can get it to work if I do not touch anything on the terminal... I want to alt-tab from the terminal to something else to draw the rectangle around OR, as the original thought was, let the terminal minimize as soon as the choice to draw rectangle happens..

Will play with it more
VSIDO      VSIDO Change Blog    

    I dev VSIDO

PackRat

Yes, you can't touch any keys etc .. or the shot is taken immediately.

Yesterday, I set the timer at 30 seconds and had plenty of time to minimize the terminal and set up other windows for the shot. Once the timer is going, the script (or scrot) releases focus/control.

The color of the rectangle is apparently a scrot internal - I cahnged my desktop colors and the rectangle is changed to be visible - some color matching code within scrot.
I am tired of talk that comes to nothing.
-- Chief Joseph

...the sun, the darkness, the winds are all listening to what we have to say.
-- Geronimo

VastOne

#34
By adding the 10 second count down (scrot -s -d10 -c "${NAME}") to the script I lose the function completely ... if the default is there I can use and see the rectangle. The problem is the terminal being in the way

@hakerdefo:

A third option should be available on every image (IMO) :

Would you like to upload the shot to imgur?

Press "Y" to upload the shot to imgur
Press "N" to go back to the main menu
Press "D" to Delete the image and go back to the main menu

Enter Your Choice:


This in effect lets you start over and takes the image out of play completely... right now I have a ton of test images I have to go back to and delete from the scrot directory
VSIDO      VSIDO Change Blog    

    I dev VSIDO

VastOne

Quote from: PackRat on December 13, 2016, 05:15:34 PM
Yes, you can't touch any keys etc .. or the shot is taken immediately.

Yesterday, I set the timer at 30 seconds and had plenty of time to minimize the terminal and set up other windows for the shot. Once the timer is going, the script (or scrot) releases focus/control.

The color of the rectangle is apparently a scrot internal - I cahnged my desktop colors and the rectangle is changed to be visible - some color matching code within scrot.

I set the time for 30 and minimize and I completely lose the function to capture.. I cannot create the rectangle then. I can create it before I minimize the terminal and only if the terminal is in focus
VSIDO      VSIDO Change Blog    

    I dev VSIDO

PackRat

Right. I wasn't detailing that properly. Once your area is selected and the timer starts, the terminal can be minimized.
I am tired of talk that comes to nothing.
-- Chief Joseph

...the sun, the darkness, the winds are all listening to what we have to say.
-- Geronimo

VastOne

So the real key to this is to have something you want to mark with a rectangle already opened and outside and away completely from your terminal

Then the marking is easy... no need for a timer at all



But the hard part is if I wanted to capture part of this screen now, it is way too large to fit away from and/or beside the terminal that I use so in effect I cannot mark anything on this page without also marking terminal as well and ONLY if I click outside of the terminal boundaries first

VSIDO      VSIDO Change Blog    

    I dev VSIDO

hakerdefo

Here it is, as promised, the new and improved pmss-for-vsido  8)


#!/usr/bin/env bash

function bye_bye (){
printf "\033c"
echo -e '\E[1;32;49m'"A Screenshot Is An Image Of The Display On A Computer Screen"
echo -e '\E[1;32;49m'"But You Already Knew That So"
echo -e '\E[1;32;49m'"Bye, Ciao, Adios"
sleep 4
printf "\033c"
tput sgr0
exit 0
}

function purge_shot (){
printf "\033c"
PMSS_RM=$(which rm)
"$PMSS_RM" -f "$NAME"
MenU
}

function imgur_upload (){
type curl >/dev/null 2>&1
RETVAL=$?
if [[ ! "$RETVAL" == 0 ]]; then
printf "\033c"
echo -e ""
echo -e '\E[1;32;49m'"PMSS Requires \"cURL\" To Upload To imgur"
echo -e '\E[1;32;49m'"Install \"curl\" Via Your Package-manager"
echo -e ""
read -rsp $'Press Any Key To Return To PMSS MENU..\n' -n1
MenU
fi
printf "\033c"
response=$(curl -s --connect-timeout 30 --user-agent "Mozilla/5.0 Gecko/20100101" -H "Authorization: Client-ID $client_id" -H "Expect: " -F "image=@$NAME" https://api.imgur.com/3/image.xml 2>/dev/null)
RETVAL=$?
if [[ ! "$RETVAL" == 0 ]]; then
printf "\033c"
echo -e ""
echo -e '\E[1;32;49m'"PMSS Cannot Connect To \"imgur\""
echo -e '\E[1;32;49m'"Check Your Internet Connection"
echo -e ""
read -rsp $'Press Any Key To Return To PMSS MENU..\n' -n1
MenU
else
URL3="${response##*<link>}"
URL2="${URL3%%</link>*}"
URL=$(echo "$URL2" 2>/dev/null | sed 's/^http:/https:/')
BASE_URL="${URL%.*}"
BASE_EXT="${URL##*.}"
DEL_HASH2="${response##*<deletehash>}"
DEL_HASH="${DEL_HASH2%%</deletehash>*}"
DEL_URL="https://imgur.com/delete/$DEL_HASH"
printf "\033c"
echo -e '\E[1;32;49m'"DIRECT LINK"
echo -e '\E[1;32;49m'"Original  : "'\E[0;32;49m'"$URL"
echo -e '\E[1;32;49m'"Thumbnail : "'\E[0;32;49m'""$BASE_URL"m."$BASE_EXT""
echo -e ""
echo -e '\E[1;32;49m'"BBCODE (FORUMS, MESSAGE BOARDS, ETC.)"
echo -e '\E[1;32;49m'"Original  : "'\E[0;32;49m'"[img]$URL[/img]"
echo -e '\E[1;32;49m'"Thumbnail : "'\E[0;32;49m'"[url=$BASE_URL][img]"$BASE_URL"m."$BASE_EXT"[/img][/url]"
echo -e ""
echo -e '\E[1;32;49m'"MARKDOWN (REDDIT, GITHUB, ETC.)"
echo -e '\E[1;32;49m'"Original  : "'\E[0;32;49m'"[$SHORT_NAME]($URL)"
echo -e '\E[1;32;49m'"Thumbnail : "'\E[0;32;49m'"[$SHORT_NAME]("$BASE_URL"m."$BASE_EXT")"
echo -e ""
echo -e '\E[1;32;49m'"HTML (WEBSITES, BLOGS, ETC.)"
echo -e '\E[1;32;49m'"Original  : "'\E[0;32;49m'"<a href="$BASE_URL"><img src="$URL" title="source: imgur.com" /></a>"
echo -e '\E[1;32;49m'"Thumbnail : "'\E[0;32;49m'"<a href="$BASE_URL"><img src=""$BASE_URL"m."$BASE_EXT"" title="source: imgur.com" /></a>"
echo -e ""
echo -e '\E[1;32;49m'"IMAGE DELETE LINK"
echo -e '\E[1;32;49m'"Delete url: "'\E[0;32;49m'"$DEL_URL"
echo -e ""
read -rsp $'Press Any Key To Return To PMSS MENU..\n' -n1
MenU
fi
}

function area_mouse (){
type xdotool >/dev/null 2>&1
RETVAL=$?
if [[ ! "$RETVAL" == 0 ]]; then
printf "\033c"
echo -e ""
echo -e '\E[1;32;49m'"PMSS Requires \"xdotool\" For This Function"
echo -e '\E[1;32;49m'"Install \"xdotool\" Via The Package-manager"
echo -e ""
read -rsp $'Press Any Key To Return To PMSS MENU..\n' -n1
MenU
fi
printf "\033c"
DATE="$(date +%d%m%y-%H%M%S)"
SHORT_NAME="Shot-${DATE}.png"
NAME="${DIR}/${SHORT_NAME}"
echo -e ""
echo -e '\E[1;32;49m'"Draw A Rectangle On The Screen By Click-Dragging Left Mouse Button"
echo -e '\E[1;32;49m'"And Release The Mouse Button Once You Have Selected The Area To Be"
echo -e '\E[1;32;49m'"Captured. Region Inside The Drawn Rectangle Will Be Shot By Script"
echo -e ""
echo -e '\E[1;32;49m'"Once The Screen Capture Mode Is Activated, Pressing Any Keys Will"
echo -e '\E[1;32;49m'"Abort The Screenshot. So Keep The Keyboard Silent In Capture Mode"
echo -e ""
read -r -s -p $'Press Any Key To Activate Screen Capture Mode\n' -n1
PMSS_PID=$(xdotool getactivewindow)
xdotool windowminimize "$PMSS_PID"
sleep 1
scrot -s "${NAME}"
RETVAL=$?
if [[ "$RETVAL" == 2 ]]; then
sleep 1
printf "\033c"
xdotool windowactivate "$PMSS_PID"
echo -e ""
echo -e '\E[1;32;49m'"Keyboard Key Was Pressed. Screenshot Aborted"
echo -e ""
read -rsp $'Press Any Key To Return To PMSS MENU..\n' -n1
MenU
fi
printf "\033c"
echo -e ""
echo -e '\E[0;32;49m'"$SHORT_NAME"'\E[1;32;49m'" Saved In "'\E[0;32;49m'"$DIR"
echo -e ""
type xdg-open >/dev/null 2>&1
RETVAL=$?
if [[ "$RETVAL" == 0 ]]; then
xdg-open "${NAME}"
else
printf "\033c"
echo -e ""
echo -e '\E[1;32;49m'"PMSS Unable To Open Saved Shot"
echo -e '\E[1;32;49m'"Install \"xdg-utils\" To Do This"
echo -e ""
fi
xdotool windowactivate "$PMSS_PID"
sleep 1
echo -e ""
echo -e '\E[1;32;49m'"Would You Like To Upload The Shot To imgur?"
echo -e ""
echo -e '\E[1;32;49m'"Press \"Y\" To Upload The Shot To imgur"
echo -e '\E[1;32;49m'"Press \"D\" To Purge The Shot & Go Back"
echo -e '\E[1;32;49m'"Press \"N\" To Go Back To The Main Menu"
echo -e ""
echo -e '\E[1;32;49m'"Enter Your Choice: "
echo -e ""
tput sgr0
read -er Choice
case "$Choice" in
"Y" | "y")
imgur_upload
;;
"D" | "d")
purge_shot
;;
"N" | "n")
printf "\033c"
MenU
;;
*)
printf "\033c"
echo -e ""
echo -e '\E[1;32;49m'"\"$Choice\" Is An Invalid Choice!!!"
echo -e ""
echo -e '\E[1;32;49m'"Correct Options To Choose Are From Y-N"
echo -e ""
echo -e '\E[1;32;49m'"To Upload Image To imgur, Press \"Y\""
echo -e '\E[1;32;49m'"To Delete Captured Image, Press \"D\""
echo -e '\E[1;32;49m'"To Go Back The Main Menu, Press \"N\""
echo -e ""
echo -e '\E[1;32;49m'"Got it? It Is Not That Hard You See"
echo -e ""
read -r -s -p $'Press Any Key To Continue...\n' -n1
MenU
;;
esac
}

function window_focus (){
printf "\033c"
DATE="$(date +%d%m%y-%H%M%S)"
SHORT_NAME="Shot-${DATE}.png"
NAME="${DIR}/${SHORT_NAME}"
echo -e ""
echo -e '\E[1;32;49m'"Minimize Terminal And Bring The Window To Be Captured In Focus.."
echo -e ""
scrot -u -d10 -b -c "${NAME}"
printf "\033c"
echo -e ""
echo -e '\E[0;32;49m'"$SHORT_NAME"'\E[1;32;49m'" Saved In "'\E[0;32;49m'"$DIR"
echo -e ""
type xdg-open >/dev/null 2>&1
RETVAL=$?
if [[ "$RETVAL" == 0 ]]; then
xdg-open "${NAME}"
else
printf "\033c"
echo -e ""
echo -e '\E[1;32;49m'"PMSS Unable To Open Saved Shot"
echo -e '\E[1;32;49m'"Install \"xdg-utils\" To Do This"
echo -e ""
fi
echo -e ""
echo -e '\E[1;32;49m'"Would You Like To Upload The Shot To imgur?"
echo -e ""
echo -e '\E[1;32;49m'"Press \"Y\" To Upload The Shot To imgur"
echo -e '\E[1;32;49m'"Press \"D\" To Purge The Shot & Go Back"
echo -e '\E[1;32;49m'"Press \"N\" To Go Back To The Main Menu"
echo -e ""
echo -e '\E[1;32;49m'"Enter Your Choice: "
echo -e ""
tput sgr0
read -er Choice
case "$Choice" in
"Y" | "y")
imgur_upload
;;
"D" | "d")
purge_shot
;;
"N" | "n")
printf "\033c"
MenU
;;
*)
printf "\033c"
echo -e ""
echo -e '\E[1;32;49m'"\"$Choice\" Is An Invalid Choice!!!"
echo -e ""
echo -e '\E[1;32;49m'"Correct Options To Choose Are From Y-N"
echo -e ""
echo -e '\E[1;32;49m'"To Upload Image To imgur, Press \"Y\""
echo -e '\E[1;32;49m'"To Delete Captured Image, Press \"D\""
echo -e '\E[1;32;49m'"To Go Back The Main Menu, Press \"N\""
echo -e ""
echo -e '\E[1;32;49m'"Got it? It Is Not That Hard You See"
echo -e ""
read -r -s -p $'Press Any Key To Continue...\n' -n1
MenU
;;
esac
}

function entire_area (){
printf "\033c"
DATE="$(date +%d%m%y-%H%M%S)"
SHORT_NAME="Shot-${DATE}.png"
NAME="${DIR}/${SHORT_NAME}"
echo -e ""
echo -e '\E[1;32;49m'"Minimize Terminal To Avoid It From Being Captured.."
echo -e ""
scrot -d10 -c "${NAME}"
printf "\033c"
echo -e ""
echo -e '\E[0;32;49m'"$SHORT_NAME"'\E[1;32;49m'" Saved In "'\E[0;32;49m'"$DIR"
echo -e ""
type xdg-open >/dev/null 2>&1
RETVAL=$?
if [[ "$RETVAL" == 0 ]]; then
xdg-open "${NAME}"
else
printf "\033c"
echo -e ""
echo -e '\E[1;32;49m'"PMSS Unable To Open Saved Shot"
echo -e '\E[1;32;49m'"Install \"xdg-utils\" To Do This"
echo -e ""
fi
echo -e ""
echo -e '\E[1;32;49m'"Would You Like To Upload The Shot To imgur?"
echo -e ""
echo -e '\E[1;32;49m'"Press \"Y\" To Upload The Shot To imgur"
echo -e '\E[1;32;49m'"Press \"D\" To Purge The Shot & Go Back"
echo -e '\E[1;32;49m'"Press \"N\" To Go Back To The Main Menu"
echo -e ""
echo -e '\E[1;32;49m'"Enter Your Choice: "
echo -e ""
tput sgr0
read -er Choice
case "$Choice" in
"Y" | "y")
imgur_upload
;;
"D" | "d")
purge_shot
;;
"N" | "n")
printf "\033c"
MenU
;;
*)
printf "\033c"
echo -e ""
echo -e '\E[1;32;49m'"\"$Choice\" Is An Invalid Choice!!!"
echo -e ""
echo -e '\E[1;32;49m'"Correct Options To Choose Are From Y-N"
echo -e ""
echo -e '\E[1;32;49m'"To Upload Image To imgur, Press \"Y\""
echo -e '\E[1;32;49m'"To Delete Captured Image, Press \"D\""
echo -e '\E[1;32;49m'"To Go Back The Main Menu, Press \"N\""
echo -e ""
echo -e '\E[1;32;49m'"Got it? It Is Not That Hard You See"
echo -e ""
read -r -s -p $'Press Any Key To Continue...\n' -n1
MenU
;;
esac
}

function MenU (){
printf "\033c"
type scrot >/dev/null 2>&1 || { printf "\033c"; echo -e ""; echo -e '\E[1;32;49m'"A required pmss dependency \"Scrot\" is not present."; echo -e '\e[1;32;49m'"\"Scrot\" is available for almost all linux distros."; echo -e '\e[1;32;49m'"Please install \"scrot\" using your package manager."; echo -e ""; tput sgr0; exit 1; }
DIR="${HOME}/images/scrots"
if [ ! -d "${DIR}" ]; then mkdir --parents "${DIR}"; fi
client_id="af2f809b77dea2c"
echo -e '\E[1;32;49m'"** PMSS<>MENU *************************************************"
echo -e ""
echo -e ""
echo -e '\E[1;32;49m'"** Select One Of The Following Options"
echo -e ""
echo -e '\E[1;32;49m'"** Enter \"E\" To Take The Screenshot Of The Entire Screen"
echo -e '\E[1;32;49m'"** Enter \"W\" To Take The Screenshot Of Window In Focus"
echo -e '\E[1;32;49m'"** Enter \"A\" To Take The Screenshot Of Area Selected By Mouse"
echo -e '\E[1;32;49m'"** Enter \"Q\" To Exit"
echo -e ""
echo -e '\E[1;32;49m'"***************************************************************"
echo -e ""
tput sgr0
read -er Options
case "$Options" in
"E" | "e")
entire_area
;;
"W" | "w")
window_focus
;;
"A" | "a")
area_mouse
;;
"Q" | "q")
bye_bye
;;
*)
printf "\033c"
echo -e ""
echo -e '\E[1;32;49m'"\"$Options\" Is An Invalid Option!!!"
echo -e ""
echo -e '\E[1;32;49m'"Correct Options To Choose Are From E-W-A-Q"
echo -e ""
echo -e '\E[1;32;49m'"To Take The Screenshot Of The Entire Screen, Press \"E\" & Hit \"Enter\" Key"
echo -e '\E[1;32;49m'"To Take The Screenshot Of Window In Focus, Press \"W\" & Hit \"Enter\" Key"
echo -e '\E[1;32;49m'"To Take The Screenshot Of Area Selected By Mouse, Press \"A\" & Hit \"Enter\" Key"
echo -e '\E[1;32;49m'"To Exit From PMSS, Press \"Q\" & Hit \"Enter\" Key"
echo -e ""
read -rsp $'Press Any Key To Return To PMSS MENU..\n' -n1
MenU
;;
esac
}
while :
do
MenU
done

You Can't Always Git What You Want

VastOne

YOU. ARE. AWESOME!!!



Tested it all already and everything I asked for is there...

Brilliant tool!
VSIDO      VSIDO Change Blog    

    I dev VSIDO

VastOne

Building the ISO's now with the new pmss and new kernels
VSIDO      VSIDO Change Blog    

    I dev VSIDO

PackRat

Quote from: VastOne on December 13, 2016, 09:53:26 PM
YOU. ARE. AWESOME!!!

Tested it all already and everything I asked for is there...

Brilliant tool!

+100
I am tired of talk that comes to nothing.
-- Chief Joseph

...the sun, the darkness, the winds are all listening to what we have to say.
-- Geronimo

Snap

Just for the record & OT

Been trying maim in Void (didn't bothered about escrotum after reading the readme and the man page). I miss the scrot's -e waaaay more than the missing -u (which led me to maim). Also maim is quite slow rendering the image files compared with the instant scrot. Plus, for some reason when shooting a focused urxvt window with transparency it doesn't grab the background. scrot is WYSIWIG. So back to good ol' scrot besides it can be glitchy sometimes when selecting areas. I don't use to shoot focused windows. I typically do selected areas of full screen. Homework done. ;)

hakerdefo

Version 3 ready in my head  8)
Need sometime to put it all together on MEdit  ;)
May be this weekend!
Some new ways to capture them scrots coming your way :D
Stay Tuned ;D

Cheers!!!
You Can't Always Git What You Want