VSIDO Community

VSIDO Support => Scripts and How To's => Scripts => Topic started by: hakerdefo on December 11, 2016, 09:15:24 PM

Title: pmss (Poor Man's Screenshooter)
Post by: hakerdefo on December 11, 2016, 09:15:24 PM

20-03-2017 UPDATE BEGINS

V4 at your service. Grab it from here,

pmss V4 (http://vsido.org/index.php?topic=1237.msg14686#msg14686)

Cheers!!!

20-03-2017 UPDATE ENDS



CHRISTMAS UPDATE BEGINS

Version 3 of pmss is here,

http://vsido.org/index.php?topic=1237.msg14041#msg14041

Cheers & Merry Christmas To You All  :)

CHRISTMAS UPDATE ENDS



UPDATE BEGINS

A new and improved version of pmss can be found here,

http://vsido.org/index.php?topic=1237.msg13959#msg13959

Cheers!!!

UPDATE ENDS


It is what the title says  :D
I'm in a bit of a hurry so description & detail will follow a bit later  ;)
Try it! It has a very good upload function that can make sharing scrrenshots easy-peasy  8)

Code: [Select]
#!/usr/bin/env bash

function bye_bye (){
printf "\033c"
echo -e ""
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."
echo -e ""
sleep 4
printf "\033c"
tput sgr0
exit 0
}

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 ""
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 ""
tput sgr0
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 ""
tput sgr0
read -rsp $'Press Any Key To Return To PMSS MENU..\n' -n1
MenU
fi
}

function area_mouse (){
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 And Area Inside It Will Be Captured.."
echo -e ""
scrot -s "${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 \"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
;;
"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 go back the main menu, press \"N\""
echo -e '\E[1;32;49m'"Got it? It is not that hard you see"
echo -e ""
tput sgr0
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 \"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
;;
"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 go back the main menu, press \"N\""
echo -e '\E[1;32;49m'"Got it? It is not that hard you see"
echo -e ""
tput sgr0
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 \"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
;;
"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 go back the main menu, press \"N\""
echo -e '\E[1;32;49m'"Got it? It is not that hard you see"
echo -e ""
tput sgr0
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}/Pictures/Screenshots"
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 ""
tput sgr0
read -rsp $'Press Any Key To Return To PMSS MENU..\n' -n1
MenU
;;
esac
}
while :
do
MenU
done


Cheers!!!
Title: Re: pmss (Poor Man's Screenshooter)
Post by: VastOne on December 12, 2016, 02:48:50 AM
I love it!

Awesome work!

Just one question, why have Firefox open the finished scrot after it is done?

I see the xdg-open "${NAME}" command so perhaps it is a setting issue on my end
Title: Re: pmss (Poor Man's Screenshooter)
Post by: VastOne on December 12, 2016, 02:49:18 AM
It will also be included as yet another epic tool on VSIDO ISO's
Title: Re: pmss (Poor Man's Screenshooter)
Post by: Snap on December 12, 2016, 06:09:29 AM
Great stuff as usual. Thanks, buddy.
Title: Re: pmss (Poor Man's Screenshooter)
Post by: hakerdefo on December 12, 2016, 07:17:18 AM
I love it!

Awesome work!

Just one question, why have Firefox open the finished scrot after it is done?

I see the xdg-open "${NAME}" command so perhaps it is a setting issue on my end

Hi there VastOne,
Running these commands in terminal will open two of the most common image types in Mirage instead of Firefox,

Code: [Select]
xdg-mime default mirage.desktop image/png
Code: [Select]
xdg-mime default mirage.desktop image/jpeg
You can use 'xdg-mime' command to determine file type,

Code: [Select]
xdg-mime query filetype example.pdf
Will get you,

Code: [Select]
application/pdf
And then you can change the xdg-open association for pdf like this,

Code: [Select]
xdg-mime default evince.desktop application/pdf
You can view the current default xdg-open application for a file type like this,

Code: [Select]
xdg-mime query default text/plain
Will print something like this,

Code: [Select]
medit.desktop
Cheers!!!
Title: Re: pmss (Poor Man's Screenshooter)
Post by: hakerdefo on December 12, 2016, 07:19:15 AM
Great stuff as usual. Thanks, buddy.
Cheers Snap!!!
Title: Re: pmss (Poor Man's Screenshooter)
Post by: hakerdefo on December 12, 2016, 07:19:32 AM
It will also be included as yet another epic tool on VSIDO ISO's

An honour!!!
Cheers!!!
Title: Re: pmss (Poor Man's Screenshooter)
Post by: PackRat on December 12, 2016, 12:56:01 PM
I tried all the options.

Capturing the desktop and selected area work. When I tried the "window in focus" option, there is an error -

Code: [Select]
scrot: invalid option -- 'u'
and the script finishes by taking a screenshot of the entire desktop. Taking a screenshot of the window in focus only isn't listed in the scrot man page. That an option with another app like feh?

the upload to imagur appears to work; need to remember to copy the link before returning to main menu.

(https://i.imgur.com/UQztaw9m.png) (https://i.imgur.com/UQztaw9)

Well done!!
Title: Re: pmss (Poor Man's Screenshooter)
Post by: VastOne on December 12, 2016, 04:04:44 PM
I love it!

Awesome work!

Just one question, why have Firefox open the finished scrot after it is done?

I see the xdg-open "${NAME}" command so perhaps it is a setting issue on my end

Hi there VastOne,
Running these commands in terminal will open two of the most common image types in Mirage instead of Firefox,

Code: [Select]
xdg-mime default mirage.desktop image/png
Code: [Select]
xdg-mime default mirage.desktop image/jpeg
You can use 'xdg-mime' command to determine file type,

Code: [Select]
xdg-mime query filetype example.pdf
Will get you,

Code: [Select]
application/pdf
And then you can change the xdg-open association for pdf like this,

Code: [Select]
xdg-mime default evince.desktop application/pdf
You can view the current default xdg-open application for a file type like this,

Code: [Select]
xdg-mime query default text/plain
Will print something like this,

Code: [Select]
medit.desktop
Cheers!!!

Great explanation and how to for anyone needing this.. I had already made the changes but wondered if there was a reason why Firefox was used

Now that it is changed, everything is functioning to my liking, and I will make the following changes to the default ISO:

Code: [Select]
xdg-mime default mirage.desktop image/png

xdg-mime default mirage.desktop image/jpeg
Title: Re: pmss (Poor Man's Screenshooter)
Post by: VastOne on December 12, 2016, 04:06:35 PM
I tried all the options.

Capturing the desktop and selected area work. When I tried the "window in focus" option, there is an error -

Code: [Select]
scrot: invalid option -- 'u'
and the script finishes by taking a screenshot of the entire desktop. Taking a screenshot of the window in focus only isn't listed in the scrot man page. That an option with another app like feh?


This is working fine for me here on VSIDO PackRat.. is it possible an app may be missing? wmctrl mayhap?
Title: Re: pmss (Poor Man's Screenshooter)
Post by: PackRat on December 12, 2016, 04:53:48 PM
No, xdotool and wmctrl are like the first two apps I add to any and all distros (why are they not default?)

It may be a difference in the way scrot is compiled for Void. If you try:

Code: [Select]
scrot -u
in a terminal, what is the result?

The maintainer at Void may not have enabled an option the Debian maintainer did - (better example, java is not enabled for LibreOffice in Void). There is also no "u" option listed in the manpage for scrot on my Void systems.
Title: Re: pmss (Poor Man's Screenshooter)
Post by: VastOne on December 12, 2016, 06:27:24 PM
No, xdotool and wmctrl are like the first two apps I add to any and all distros (why are they not default?)

It may be a difference in the way scrot is compiled for Void. If you try:

Code: [Select]
scrot -u
in a terminal, what is the result?

The maintainer at Void may not have enabled an option the Debian maintainer did - (better example, java is not enabled for LibreOffice in Void). There is also no "u" option listed in the manpage for scrot on my Void systems.

xdotool and wmctrl  are defaults in a certain VSIDO distro..  :P  8)

scrot -u does do the focused window as it should for me and drops it in the directory with a filedate name
Title: Re: pmss (Poor Man's Screenshooter)
Post by: hakerdefo on December 12, 2016, 07:27:35 PM
...
Now that it is changed, everything is functioning to my liking, and I will make the following changes to the default ISO:

Code: [Select]
xdg-mime default mirage.desktop image/png
xdg-mime default mirage.desktop image/jpeg
...

Edited Post

Hi VastOne,

Here is a better way to implement this in VSIDO ISO,

Make the following directory structure in user's home directory

Code: [Select]
~/.local/share/applications

And create 'mimeapps.list' file there,

Code: [Select]
~/.local/share/applications/mimeapps.list

And in the 'mimeapps.list' file we can add associations and we can also set default applications.

Here is an example 'mimeapps.list' file,

Code: [Select]
[Default Applications]
image/jpeg=mirage.desktop
image/png=mirage.desktop
application/pdf=evince.desktop

[Added Associations]
image/jpeg=mirage.desktop;
image/png=mirage.desktop;
application/pdf=evince.desktop;

We can add as many filetype associations we want and/or associate as many default applications as we want  in the 'mimeapps.list' file.

I think this can be easily implemented via "/etc/skel" in VSIDO ISO.

Cheers!!!
Title: Re: pmss (Poor Man's Screenshooter)
Post by: hakerdefo on December 12, 2016, 07:39:42 PM
...
I tried all the options.

Capturing the desktop and selected area work. When I tried the "window in focus" option, there is an error -

Code: [Select]
scrot: invalid option -- 'u'
and the script finishes by taking a screenshot of the entire desktop. Taking a screenshot of the window in focus only isn't listed in the scrot man page. That an option with another app like feh?
...

Hi there PackRat,
The original version of Scrot doesn't have the "-u, --focused" option to capture currently focused window. I haven't used Void Linux so I can't say about its Scrot implementation but Slackware for sure doesn't have the "-u, --focused" option. Debian uses the patched version of the Scrot that has the "-u, --focused" option. I think Arch Linux also patches its implementation of Scrot with Debian's modifications. Here are the patches implemented by Debian if you are interested,

Debian-Scrot-Patches (http://http.debian.net/debian/pool/main/s/scrot/scrot_0.8-18.debian.tar.xz)

Cheers!!!
Title: Re: pmss (Poor Man's Screenshooter)
Post by: PackRat on December 12, 2016, 11:50:42 PM
Thanks; patch failed and I didn't want to mess with it.

Scrot is a simple binary so I downloaded the deb file from the Debian Sid packages. Extracted the files and copied scrot to /usr/local/bin/debscrot

Edited your script to use debscrot; script is hitting on all cylanders now.
Title: Re: pmss (Poor Man's Screenshooter)
Post by: VastOne on December 12, 2016, 11:52:13 PM
^ hakerdefo can script... :D
Title: Re: pmss (Poor Man's Screenshooter)
Post by: PackRat on December 12, 2016, 11:53:48 PM
xdotool and wmctrl  are defaults in a certain VSIDO distro..  :P  8)

And I took a cue from a certain Sid-based distro and made sure to include them in my Void fluxbox spin.  ;D
Title: Re: pmss (Poor Man's Screenshooter)
Post by: PackRat on December 12, 2016, 11:55:53 PM
^ hakerdefo can script... :D

Understatement of the week award -

(http://en.zimagez.com/miniature/stanley-cup-trophy.jpg) (http://en.zimagez.com/zimage/stanley-cup-trophy.php)
Title: Re: pmss (Poor Man's Screenshooter)
Post by: VastOne on December 13, 2016, 12:00:41 AM
I am curios if it is possible to have the terminal minimize when selecting A Take the Screenshot of area selected by mouse

If I try to alt tab to another window after selecting A that makes the choice. If I try to minimize it, that also makes the choice and each one of these leave the terminal in the scrot .. which I do not want

So a better approach may be to automatically minimize the terminal until mouse function is complete

What do you think?
Title: Re: pmss (Poor Man's Screenshooter)
Post by: VastOne on December 13, 2016, 12:16:38 AM
A housekeeping request

Could the default location of scrots be changed in the script from

Code: [Select]
DIR="${HOME}/Pictures/Screenshots"

to

Code: [Select]
DIR="${HOME}/images/scrots"
I know that I can change it (and did change it)

The defaults in VSIDO is /images/scrot and /Pictures/scrot is not even a setup
Title: Re: pmss (Poor Man's Screenshooter)
Post by: PackRat on December 13, 2016, 12:28:33 AM
I am curios if it is possible to have the terminal minimize when selecting A Take the Screenshot of area selected by mouse

If I try to alt tab to another window after selecting A that makes the choice. If I try to minimize it, that also makes the choice and each one of these leave the terminal in the scrot .. which I do not want

So a better approach may be to automatically minimize the terminal until mouse function is complete

What do you think?

Yes, I looked at the script and the timer options present in the other options are missing from the select a window function.

in the " function area_mouse (){ " section, you can change:

Code: [Select]
scrot -s "${NAME}"
to

Code: [Select]
scrot -s -d10 -c "${NAME}"
to add 10 seconds delay to the screenshot. Close the terminal and any other apps while the timer is counting down.

I made the change and saved to a new script to confirm.



Title: Re: pmss (Poor Man's Screenshooter)
Post by: VastOne on December 13, 2016, 12:51:19 AM
^ xdg-open is not liking that option... It works to get to a point where you should be able to select a rectangle but there is nothing you can do

This is the error it spits out and it makes sense because nothing was selected for an image to be created

Code: [Select]
Shot-121216-184812.png Saved in /home/vastone/images/scrots

xdg-open: file '/home/vastone/images/scrots/Shot-121216-184812.png' does not exist

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

Enter Your Choice:

I am thinking there will be additional code to handle the capture
Title: Re: pmss (Poor Man's Screenshooter)
Post by: PackRat on December 13, 2016, 02:43:08 AM
Might be another difference between Void and Debian then. When running the script, I can:

1. Select area when prompted to do so
2. Minimize terminal as the timer counts down
3. Screnshot taken, ristretto opens with image
4. Un-minimize terminal and post to imagur.
Title: Re: pmss (Poor Man's Screenshooter)
Post by: VastOne on December 13, 2016, 02:55:41 AM
What appears to be missing for me is the ability to select an area

Nothing I do presents any type of or THE capture tool
Title: Re: pmss (Poor Man's Screenshooter)
Post by: PackRat on December 13, 2016, 03:25:26 AM
My mouse cursor doesn't change - it doesn't become a "+" like it does for xfce4-screenshooter. A the "Draw A Rectangle On The Screen And Area Inside It Will Be Captured.."
message, I just grab an area by holding down Mouse1 and dragging a rectagle. The countdown starts when I release Mouse1.
Title: Re: pmss (Poor Man's Screenshooter)
Post by: Snap on December 13, 2016, 04:04:37 AM
+1 for xdotool and wmctrl. They always go in along with xorg and fluxbox on my systems. It should be a metapackage LOL.

@ PackRat: might be a good moment to try maim and/or escrotum in Void. They both are in the repos. They are supposedly improved shooters to overcome the scrot usual glitches and limitations. Never bothered to try them so far. I guess pmss would be easily adapted for those needing a bit more than what the good old unpatched scrot gives.
Title: Re: pmss (Poor Man's Screenshooter)
Post by: hakerdefo on December 13, 2016, 05:52:27 AM
version 2 with a few VSIDO specific changes coming later today.
Stay tuned ;)
Cheers!!!
Title: Re: pmss (Poor Man's Screenshooter)
Post by: VastOne on December 13, 2016, 05:59:08 AM
^ Thanks for posting this.. I am tired and need sleep and the ISO's I wanted to test and upload can now be redone tomorrow after you update this

Thanks for all you do hakerdefo!
Title: Re: pmss (Poor Man's Screenshooter)
Post by: VastOne on December 13, 2016, 03:44:04 PM
My mouse cursor doesn't change - it doesn't become a "+" like it does for xfce4-screenshooter. A the "Draw A Rectangle On The Screen And Area Inside It Will Be Captured.."
message, I just grab an area by holding down Mouse1 and dragging a rectagle. The countdown starts when I release Mouse1.

Do you see a rectangle as you drag and draw?
Title: Re: pmss (Poor Man's Screenshooter)
Post by: PackRat on December 13, 2016, 05:02:35 PM
Yes.

A 1-2 pixel wide, solid line, rectangle.

It's black - so on your (vsido) default wallpaer you may not see it; maybe try a lighter background. Might be worth it to change the color to red; not sure what line defines the rectangle in the function or I'd give it a try myself.
Title: Re: pmss (Poor Man's Screenshooter)
Post by: VastOne on December 13, 2016, 05:04:24 PM
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

Title: Re: pmss (Poor Man's Screenshooter)
Post by: VastOne on December 13, 2016, 05:05:57 PM
@PacKrat - See my edit above
Title: Re: pmss (Poor Man's Screenshooter)
Post by: VastOne on December 13, 2016, 05:08:24 PM
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
Title: Re: pmss (Poor Man's Screenshooter)
Post by: 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.
Title: Re: pmss (Poor Man's Screenshooter)
Post by: VastOne on December 13, 2016, 05:17:02 PM
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) :

Code: [Select]
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
Title: Re: pmss (Poor Man's Screenshooter)
Post by: VastOne on December 13, 2016, 05:22: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
Title: Re: pmss (Poor Man's Screenshooter)
Post by: PackRat on December 13, 2016, 07:11:57 PM
Right. I wasn't detailing that properly. Once your area is selected and the timer starts, the terminal can be minimized.
Title: Re: pmss (Poor Man's Screenshooter)
Post by: VastOne on December 13, 2016, 09:43:47 PM
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

(https://i.imgur.com/JClCCQrm.png) (https://i.imgur.com/JClCCQr)

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

(https://i.imgur.com/g8zBNpVm.png) (https://i.imgur.com/g8zBNpV)
Title: Re: pmss (Poor Man's Screenshooter)
Post by: hakerdefo on December 13, 2016, 09:46:38 PM
Here it is, as promised, the new and improved pmss-for-vsido  8)

Code: [Select]
#!/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

Title: Re: pmss (Poor Man's Screenshooter)
Post by: VastOne on December 13, 2016, 09:53:26 PM
YOU. ARE. AWESOME!!!

(https://i.imgur.com/zJ9GNU7m.png) (https://i.imgur.com/zJ9GNU7)

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

Brilliant tool!
Title: Re: pmss (Poor Man's Screenshooter)
Post by: VastOne on December 13, 2016, 09:55:03 PM
Building the ISO's now with the new pmss and new kernels
Title: Re: pmss (Poor Man's Screenshooter)
Post by: PackRat on December 13, 2016, 11:45:35 PM
YOU. ARE. AWESOME!!!

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

Brilliant tool!

+100
Title: Re: pmss (Poor Man's Screenshooter)
Post by: Snap on December 15, 2016, 09:29:57 PM
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. ;)
Title: Re: pmss (Poor Man's Screenshooter)
Post by: hakerdefo on December 20, 2016, 03:59:20 PM
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!!!
Title: Re: pmss (Poor Man's Screenshooter)
Post by: Snap on December 21, 2016, 03:40:19 AM
That'll be great.
Title: Re: pmss (Poor Man's Screenshooter)
Post by: VastOne on December 21, 2016, 04:08:58 AM
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!!!

Looking forward to it... How do you improve perfection?

One item I would not mind seeing... a clean all scrots option, as in delete.. I like it just for housekeeping. The scrots directory IMO is temporary for most and anyone wanting to keep the scrots should never use the proposed clean all option
Title: Re: pmss (Poor Man's Screenshooter)
Post by: PackRat on December 21, 2016, 04:01:17 PM
Looking forward to it... How do you improve perfection?

One item I would not mind seeing... a clean all scrots option, as in delete.. I like it just for housekeeping. The scrots directory IMO is temporary for most and anyone wanting to keep the scrots should never use the proposed clean all option

+1 looking forward to the new script.

One other item would be to port the script to yad/zenity - no need to open a terminal. I did a quick hack of the yad script for ceni and the scrot commands work just fine. Pretty much the limit of my scripting capabilities.

Goal would be to have a gui VSIDO screenshooter app to replace xfce4-screenshooter (still installed by default isn't it?). Decrease in overhead on the iso is probably minimal, but it would be cool VSIDO tool.
Title: Re: pmss (Poor Man's Screenshooter)
Post by: Snap on December 22, 2016, 05:20:53 AM
^ I agree. That will be a great GUI tool for Vsido.

...though I have to say that it will put me away  from pmss  ::)

Code: [Select]
depends yad
yad
  Depends: libatk1.0-0
  Depends: libc6
  Depends: libcairo-gobject2
  Depends: libcairo2
  Depends: libgdk-pixbuf2.0-0
  Depends: libglib2.0-0
  Depends: libgtk-3-0
  Depends: libpango-1.0-0
  Depends: libpangocairo-1.0-

libgtk-3. Nope. I'm more than fine with dmenu and/or rofi for scripts GUI.
Title: Re: pmss (Poor Man's Screenshooter)
Post by: hakerdefo on December 25, 2016, 08:11:58 PM
As Promised.
A present on a Christmas day  ;)
V3 of pmss (Poor Man's Screenshooter) is here  8)

Code: [Select]
#!/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 2
printf "\033c"
tput sgr0
exit 0
}

function empty_dir (){
printf "\033c"
if [ "$(ls -A "$DIR")" ]; then
printf "\033c"
echo -e ""
echo -e '\E[1;32;49m'"This Will Remove All Saved Screenshots! Are You Sure?"
echo -e ""
echo -e '\E[1;32;49m'"Press \"Y\" To Empty Screenshots Directory"
echo -e '\E[1;32;49m'"Press \"N\" To Move Back To Main PMSS Menu"
echo -e ""
echo -e '\E[1;32;49m'"Enter Your Choice: "
echo -e ""
tput sgr0
read -er Choice
case "$Choice" in
"Y" | "y")
printf "\033c"
PMSS_RM=$(which rm)
"$PMSS_RM" -rf "$DIR"/*.png
printf "\033c"
echo -e ""
echo -e '\E[1;32;49m'"Screenshots Directory Has Been Emptied"
echo -e ""
read -rsp $'Press Any Key To Return To PMSS MENU..\n' -n1
MenU
;;
"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 Empty Screenshots Directory, Press \"Y\""
echo -e '\E[1;32;49m'"To Move Back To Main PMSS 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
empty_dir
;;
esac
else
printf "\033c"
echo -e ""
echo -e '\E[1;32;49m'"Screenshots Directory Is Empty"
echo -e '\E[1;32;49m'"Nothing To Delete. Say Cheese!"
echo -e ""
read -rsp $'Press Any Key To Return To PMSS MENU..\n' -n1
MenU
fi
}

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 '\E[1;32;49m'""
read -rsp $'Press Any Key To Return To PMSS MENU..\n' -n1
MenU
fi
}

function upload_check (){
type xdg-open >/dev/null 2>&1
RETVAL=$?
if [[ "$RETVAL" == 0 ]]; then
xdg-open "${NAME}"
else
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-D-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 Move Back To The 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 area_mouse (){
DATE="$(date +%d%m%y-%H%M%S)"
SHORT_NAME="Shot-${DATE}.png"
NAME="${DIR}/${SHORT_NAME}"
printf "\033c"
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
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
else
printf "\033c"
xdotool windowactivate "$PMSS_PID"
echo -e ""
echo -e '\E[0;32;49m'"$SHORT_NAME"'\E[1;32;49m'" Saved In "'\E[0;32;49m'"$DIR"
echo -e ""
upload_check
fi
}

function window_focus (){
DATE="$(date +%d%m%y-%H%M%S)"
SHORT_NAME="Shot-${DATE}.png"
NAME="${DIR}/${SHORT_NAME}"
printf "\033c"
echo -e ""
echo -e '\E[1;32;49m'"Select The Screenshot Mode"
echo -e ""
echo -e '\E[1;32;49m'"Press \"B\" To Capture The Window Open Below PMSS Window"
echo -e '\E[1;32;49m'"Press \"C\" To Capture The Window Under The Mouse Cursor"
echo -e '\E[1;32;49m'"Press \"M\" To Manually Select The Window To Be Captured"
echo -e ""
echo -e '\E[1;32;49m'"Enter Your Choice: "
echo -e ""
tput sgr0
read -er Choice
case "$Choice" in
"B" | "b")
printf "\033c"
PMSS_PID=$(xdotool getactivewindow)
xdotool windowminimize "$PMSS_PID"
sleep 1
scrot -u -b -c "${NAME}"
RETVAL=$?
if [[ "$RETVAL" == 2 ]]; then
printf "\033c"
xdotool windowactivate "$PMSS_PID"
echo -e ""
echo -e '\E[1;32;49m'"No Open Window Found Below PMSS"
echo -e '\E[1;32;49m'"Hence No Screenshot Is Captured"
echo -e ""
read -r -s -p $'Press Any Key To Continue..\n' -n1
window_focus
else
printf "\033c"
xdotool windowactivate "$PMSS_PID"
echo -e ""
echo -e '\E[0;32;49m'"$SHORT_NAME"'\E[1;32;49m'" Saved In "'\E[0;32;49m'"$DIR"
echo -e ""
upload_check
fi
;;
"C" | "c")
printf "\033c"
echo -e ""
echo -e '\E[1;32;49m'"Position The Mouse Cursor Over The Window To Capture"
echo -e '\E[1;32;49m'"Don't Click Just Position The Cursor Over The Window"
echo -e ""
read -r -s -p $'Press Any Key When You Are Ready..\n' -n1
PMSS_PID=$(xdotool getactivewindow)
MAGIC_SED='s/.*=\(.*\)/\1/'
WIN_BLW=$(xdotool getmouselocation --shell 2>/dev/null | grep WINDOW | sed "$MAGIC_SED")
xdotool windowactivate "$WIN_BLW"
sleep 1
scrot -u -b -c "${NAME}"
printf "\033c"
xdotool windowactivate "$PMSS_PID"
echo -e ""
echo -e '\E[0;32;49m'"$SHORT_NAME"'\E[1;32;49m'" Saved In "'\E[0;32;49m'"$DIR"
echo -e ""
upload_check
;;
"M" | "m")
PMSS_PID=$(xdotool getactivewindow)
printf "\033c"
echo -e ""
echo -e '\E[1;32;49m'"Minimize Terminal And Bring The Window To Be Captured In Focus.."
echo -e ""
scrot -u -d12 -b -c "${NAME}"
RETVAL=$?
if [[ "$RETVAL" == 2 ]]; then
printf "\033c"
xdotool windowactivate "$PMSS_PID"
echo -e ""
echo -e '\E[1;32;49m'"No Open Window Found Below PMSS"
echo -e '\E[1;32;49m'"Hence No Screenshot Is Captured"
echo -e ""
read -r -s -p $'Press Any Key To Continue..\n' -n1
window_focus
else
printf "\033c"
xdotool windowactivate "$PMSS_PID"
echo -e ""
echo -e '\E[0;32;49m'"$SHORT_NAME"'\E[1;32;49m'" Saved In "'\E[0;32;49m'"$DIR"
echo -e ""
upload_check
fi
;;
*)
printf "\033c"
echo -e ""
echo -e '\E[1;32;49m'"\"$Choice\" Is An Invalid Option!!!"
echo -e ""
echo -e '\E[1;32;49m'"Correct Options To Choose Are From B-C-M"
echo -e ""
echo -e '\E[1;32;49m'"To Capture The Window Open Below PMSS Window, Press \"B\""
echo -e '\E[1;32;49m'"To Capture The Window Under The Mouse Cursor, Press \"C\""
echo -e '\E[1;32;49m'"To Manually Select The Window To Be Captured, Press \"M\""
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
window_focus
;;
esac
}

function entire_area (){
DATE="$(date +%d%m%y-%H%M%S)"
SHORT_NAME="Shot-${DATE}.png"
NAME="${DIR}/${SHORT_NAME}"
printf "\033c"
echo -e ""
echo -e '\E[1;32;49m'"Select The Screenshot Mode"
echo -e ""
echo -e '\E[1;32;49m'"Press \"C\" For Clean Mode"
echo -e '\E[1;32;49m'"Press \"D\" For Dirty Mode"
echo -e ""
echo -e '\E[1;32;49m'"Enter Your Choice: "
echo -e ""
tput sgr0
read -er Choice
case "$Choice" in
"C" | "c")
PMSS_PID=$(xdotool getactivewindow)
for i in $(xdotool search ".*");do xdotool windowminimize $i;done
sleep 1
scrot -c "${NAME}"
printf "\033c"
xdotool windowactivate "$PMSS_PID"
echo -e ""
echo -e '\E[0;32;49m'"$SHORT_NAME"'\E[1;32;49m'" Saved In "'\E[0;32;49m'"$DIR"
echo -e ""
upload_check
;;
"D" | "d")
PMSS_PID=$(xdotool getactivewindow)
printf "\033c"
echo -e ""
echo -e '\E[1;32;49m'"Minimize Terminal & Any Open Window You Don't Wish To Capture.."
echo -e ""
scrot -d12 -c "${NAME}"
printf "\033c"
xdotool windowactivate "$PMSS_PID"
echo -e ""
echo -e '\E[0;32;49m'"$SHORT_NAME"'\E[1;32;49m'" Saved In "'\E[0;32;49m'"$DIR"
echo -e ""
upload_check
;;
*)
printf "\033c"
echo -e ""
echo -e '\E[1;32;49m'"\"$Choice\" Is An Invalid Option!!!"
echo -e ""
echo -e '\E[1;32;49m'"Correct Options To Choose Are From C-D"
echo -e ""
echo -e '\E[1;32;49m'"To Capture The Desktop Without Any Open Window, Press \"C\""
echo -e '\E[1;32;49m'"To Capture The Desktop With Open-Active Window, Press \"D\""
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
entire_area
;;
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; }
type xdotool >/dev/null 2>&1 || { printf "\033c"; echo -e ""; echo -e '\E[1;32;49m'"A required pmss dependency \"xdotool\" is not present."; echo -e '\e[1;32;49m'"\"xdotool\" is available for almost all linux distros."; echo -e '\e[1;32;49m'"Please install \"xdotool\" 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 '\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 \"D\" To Empty Screenshots Directory"
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
;;
"D" | "d")
empty_dir
;;
"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-D-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 Empty Screenshots Directory, Press \"D\" & 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

Title: Re: pmss (Poor Man's Screenshooter)
Post by: VastOne on December 25, 2016, 08:31:32 PM
Very nice..

I ran the script and everything worked perfectly except for the following:

Questions though.. What exactly is going on during

** Enter "E" To Take The Screenshot Of The Entire Screen

Press "C" For Clean Mode
Press "D" For Dirty Mode

C pretty much shutdown fluxbox and took a blank background screenshot. I had to log out and back in to get anything going again

D ran as expected by taking a normal screenshot after 12 seconds
Title: Re: pmss (Poor Man's Screenshooter)
Post by: PackRat on December 26, 2016, 03:03:52 AM
Clean worked for me - all open windows were iconified and I got a screenshot of the desktop.

Only difference that comes to mind is that VSIDO has compton running by default - not sure if / how that would matter. 
Title: Re: pmss (Poor Man's Screenshooter)
Post by: hakerdefo on December 26, 2016, 05:40:09 AM
Hi VastOne,
Clean mode minimizes all open windows and takes the screenshot.
Can you run following commands and see what happens,

Code: [Select]
for i in $(xdotool search ".*");do xdotool windowminimize $i;done
Code: [Select]
for i in $(xdotool search --onlyvisible ".*");do xdotool windowminimize $i;done
Code: [Select]
wmctrl -k on
Cheers!!!
Title: Re: pmss (Poor Man's Screenshooter)
Post by: Snap on December 26, 2016, 11:33:05 AM
@Packrat: How do you set your background?  I use hsetroot and the background is captured too. Maybe nitrogen is treated as a window by wmctrl.
Title: Re: pmss (Poor Man's Screenshooter)
Post by: hakerdefo on December 26, 2016, 11:44:39 AM
@Packrat: How do you set your background?  I use hsetroot and the background is captured too. Maybe nitrogen is treated as a window by wmctrl.
Hi Snap,
So does the 'clean mode' in the 'capture entire desktop' option work for you? It should minimize all open windows and capture the 'clean' desktop.

Cheers!!!
Title: Re: pmss (Poor Man's Screenshooter)
Post by: PackRat on December 26, 2016, 02:17:52 PM
@Packrat: How do you set your background?  I use hsetroot and the background is captured too. Maybe nitrogen is treated as a window by wmctrl.

I actually use the fluxbox internal application to set the desktop background:

Code: [Select]
fbsetbg -c -r ~/wallpaper
It's a wrapper that needs another wallpaper setter like hsetroot - which is the one I install, so indirectly hsetroot. It will also use feh, or nitrogen if available, Works best with hsetroot and feh. I think the heirarchy when more than one is installed is  1. hsetroot  2. feh  3. nitrogen.

Title: Re: pmss (Poor Man's Screenshooter)
Post by: PackRat on December 26, 2016, 02:36:55 PM
@snap - assumig you (anyone) is using them, did your tint2 and conky disappear from your Clean screenshot?

That is most likely because fluxbox is unique in that Desktop is actually a named layer. From the fluxbox man page:

Code: [Select]
   Layers
       fluxbox manages the following layers (from highest to lowest):

           •Above Dock

           •Dock

           •Top

           •Normal

           •Bottom

           •Desktop

       Windows on a higher layer will always appear above those on a lower
       one. These layers can be used on application windows, the slit or the
       toolbar. You can assign applications to a certain layer by specifying
       it in the ‘apps’ file or through the WindowMenu. We discuss the ‘apps’
       file in fluxbox-apps(5). We discuss the WindowMenu in the MENUS
       section. We discuss layers in more detail in the LAYERS section.

The wallpaer is set on the Desktop layer in fluxbox, conky and tint2 (any 3rd party panel) windows are not - although the xfce4-panel may be an exception. So when a "show desktop" command is invoked, the conky and tint2 windows also get iconified. Middle click on the desktop and you can find them in the Icons list and de-iconify them.

Best way to get around that is to use the ~/.fluxbox/apps file and set the layer for conky and tint2 to Desktop. In conky you can set:

Code: [Select]
own_window_class = 'ConkyFB',
own_window_title = 'ConkyFB',

to give conky a unique class and title to use in the apps file. Use the xprop tool to get name and class for tint2.

To illustrate -

Dirty -
 (https://i.imgur.com/PxOtlLBm.jpg) (https://i.imgur.com/PxOtlLB)

Clean -
(https://i.imgur.com/Pie6vRgm.jpg) (https://i.imgur.com/Pie6vRg)

The Tao and Weather conky iconified, the system conky does not because it is set to "own_window_type = dock" and resides in the fluxbox slit.

And since each conky is set to "own_window = yes", they show as iconified windows - setting "own_window = no" will output conky to the desktop so it will not be iconified.

(http://en.zimagez.com/miniature/december14827635211600x900.jpg) (http://en.zimagez.com/zimage/december14827635211600x900.php)
Title: Re: pmss (Poor Man's Screenshooter)
Post by: hakerdefo on December 26, 2016, 03:23:50 PM
@PackRat's knowledge of everything related to window managers is AMAZING!
So setting the layer for conky and tint2 to Desktop in .~/.fluxbox/apps file will fix this problem?

Cheers!!!
Title: Re: pmss (Poor Man's Screenshooter)
Post by: VastOne on December 26, 2016, 03:31:32 PM
^ +1000

the RatMan never ceases to amaze me...

... just like you and your coding skills!
Title: Re: pmss (Poor Man's Screenshooter)
Post by: PackRat on December 26, 2016, 03:41:23 PM
@PackRat's knowledge of everything related to window managers is AMAZING!
So setting the layer for conky and tint2 to Desktop in .~/.fluxbox/apps file will fix this problem?

Cheers!!!

I thought it would, but it doesn't seem to be working - for the weather conky anyway. I have done it in the past, but that was in conjuction with the fluxbox internal macros -

# key binding to toggle show desktop.
Code: [Select]
Mod1 F12 :ToggleCmd {ShowDesktop} {DeIconify all originquiet}
fluxbox apps file - layer 12 is desktop (layers are numbered 2, 4, 6, 8, 10, 12 top to bottom in that man page list)

Code: [Select]
[app] (name=conkyweather) (class=conkyweather)
  [Shaded] {no}
  [Layer] {12}
[end]

that binding works and the weather conky is still visible

wmctrl commands may have super powers and overrride fluxbox internals.

Needs more testing.

Edit - the conky-kryptonite for wmctrl super powers is to set:

Code: [Select]
own_window_type = 'override'
as well as something like -

Code: [Select]
own_window_class = 'Conkyfull',
own_window_title = 'Conkyfull',

in the ~/.fluxbox/apps file -
[app] (name=Conkyfull) (class=Conkyfull)
  [Layer]   {12}
[end]

The apps file does use wild cards (although the syntax escpaes me right now) so something along the lines of: (in the fluxbox-apps man file) -

[app] (name=Conky.*) (class=Conky.*)
  [Layer]   {12}
[end]

Would put all conkyrc with class and name begining with "Conky" on the desktop and keep them de-iconified for screenshots.

Screenshot or it didn't happen -

(https://i.imgur.com/0ym2BWKm.jpg) (https://i.imgur.com/0ym2BWK)

system conky docked in slit, tao and weather set to override and placed on Desktop layer.

Title: Re: pmss (Poor Man's Screenshooter)
Post by: PackRat on December 26, 2016, 04:26:45 PM
For tint2 -

Code: [Select]
[app] (name=tint2) (class=Tint2)
  [Layer] {12}
[end]

in the ~/.fluxbox/apps file works with the Showdesktop keybinding above, but wmctrl still iconifies the tint2 panel. Most likely need to mess with the tint2 strut_policy settings to discover the tint2-kryptonite
Title: Re: pmss (Poor Man's Screenshooter)
Post by: PackRat on December 26, 2016, 05:47:50 PM
tint2 doesn't appear to be capable to override wmctrl.

The Xfce4 desktop is also wiped out by the Clean option (like wiping it with a cloth or something!). Keybindings still work so you can bring up a terminal or the session-logout screen and exit gracefully.

in a terminal -

Code: [Select]
wmctrl -l
lists the names as xfce4-panel and tint2. Is it possible to exclude those window names from a wmctrl iconify command?

Title: Re: pmss (Poor Man's Screenshooter)
Post by: VastOne on December 26, 2016, 05:53:44 PM
Hi VastOne,
Clean mode minimizes all open windows and takes the screenshot.
Can you run following commands and see what happens,

Code: [Select]
for i in $(xdotool search ".*");do xdotool windowminimize $i;done
Code: [Select]
for i in $(xdotool search --onlyvisible ".*");do xdotool windowminimize $i;done
Code: [Select]
wmctrl -k on
Cheers!!!

All ran without errors.. cleared the desktop in the exact same way the C option does in the script, like PackRat says 'wiping it with a cloth'

Here is the output from terminal if it means anything

Code: [Select]
vastone@vsido:~$ for i in $(xdotool search ".*");do xdotool windowminimize $i;done
Defaulting to search window name, class, and classname
vastone@vsido:~$ for i in $(xdotool search --onlyvisible ".*");do xdotool windowminimize $i;done
Defaulting to search window name, class, and classname
vastone@vsido:~$ wmctrl -k on

I had to restart everything to get tint2 back.. alt tab allowed me to go between open apps to write this and then to close everything cleany
Title: Re: pmss (Poor Man's Screenshooter)
Post by: hakerdefo on December 26, 2016, 08:36:54 PM
Version 3.1 of pmss to address a Fluxbox related issue.
This should, hopefully, fix the The "Entire Screen -> Clean" option problem under VSIDO.
This version is specifically designed for VSIDO. If you want to use pmss under any other Distro/DE/WM please use Version 3.

Code: [Select]
#!/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 2
printf "\033c"
tput sgr0
exit 0
}

function empty_dir (){
if [ "$(ls -A "$DIR")" ]; then
printf "\033c"
echo -e ""
echo -e '\E[1;32;49m'"This Will Remove All Saved Screenshots! Are You Sure?"
echo -e ""
echo -e '\E[1;32;49m'"Press \"Y\" To Empty Screenshots Directory"
echo -e '\E[1;32;49m'"Press \"N\" To Move Back To Main PMSS Menu"
echo -e ""
echo -e '\E[1;32;49m'"Enter Your Choice: "
echo -e ""
tput sgr0
read -er Choice
case "$Choice" in
"Y" | "y")
printf "\033c"
PMSS_RM=$(which rm)
"$PMSS_RM" -rf "$DIR"/*.png
printf "\033c"
echo -e ""
echo -e '\E[1;32;49m'"Screenshots Directory Has Been Emptied"
echo -e ""
read -rsp $'Press Any Key To Return To PMSS MENU..\n' -n1
MenU
;;
"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 Empty Screenshots Directory, Press \"Y\""
echo -e '\E[1;32;49m'"To Move Back To Main PMSS 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
empty_dir
;;
esac
else
printf "\033c"
echo -e ""
echo -e '\E[1;32;49m'"Screenshots Directory Is Empty"
echo -e '\E[1;32;49m'"Nothing To Delete. Say Cheese!"
echo -e ""
read -rsp $'Press Any Key To Return To PMSS MENU..\n' -n1
MenU
fi
}

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 '\E[1;32;49m'""
read -rsp $'Press Any Key To Return To PMSS MENU..\n' -n1
MenU
fi
}

function upload_check (){
type xdg-open >/dev/null 2>&1
RETVAL=$?
if [[ "$RETVAL" == 0 ]]; then
xdg-open "${NAME}"
else
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-D-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 Move Back To The 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 area_mouse (){
DATE="$(date +%d%m%y-%H%M%S)"
SHORT_NAME="Shot-${DATE}.png"
NAME="${DIR}/${SHORT_NAME}"
printf "\033c"
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
xdotool windowactivate "$PMSS_PID"
printf "\033c"
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
else
xdotool windowactivate "$PMSS_PID"
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 ""
upload_check
fi
}

function window_focus (){
DATE="$(date +%d%m%y-%H%M%S)"
SHORT_NAME="Shot-${DATE}.png"
NAME="${DIR}/${SHORT_NAME}"
printf "\033c"
echo -e ""
echo -e '\E[1;32;49m'"Select The Screenshot Mode"
echo -e ""
echo -e '\E[1;32;49m'"Press \"B\" To Capture The Window Open Below PMSS Window"
echo -e '\E[1;32;49m'"Press \"C\" To Capture The Window Under The Mouse Cursor"
echo -e '\E[1;32;49m'"Press \"M\" To Manually Select The Window To Be Captured"
echo -e ""
echo -e '\E[1;32;49m'"Enter Your Choice: "
echo -e ""
tput sgr0
read -er Choice
case "$Choice" in
"B" | "b")
PMSS_PID=$(xdotool getactivewindow)
xdotool windowminimize "$PMSS_PID"
sleep 1
scrot -u -b -c "${NAME}"
RETVAL=$?
if [[ "$RETVAL" == 2 ]]; then
xdotool windowactivate "$PMSS_PID"
printf "\033c"
echo -e ""
echo -e '\E[1;32;49m'"No Open Window Found Below PMSS"
echo -e '\E[1;32;49m'"Hence No Screenshot Is Captured"
echo -e ""
read -r -s -p $'Press Any Key To Continue..\n' -n1
window_focus
else
WIN_BLW=$(xdotool getactivewindow)
xdotool windowminimize "$WIN_BLW"
xdotool windowactivate "$PMSS_PID"
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 ""
upload_check
fi
;;
"C" | "c")
printf "\033c"
echo -e ""
echo -e '\E[1;32;49m'"Position The Mouse Cursor Over The Window To Capture"
echo -e '\E[1;32;49m'"Don't Click Just Position The Cursor Over The Window"
echo -e ""
read -r -s -p $'Press Any Key When You Are Ready..\n' -n1
PMSS_PID=$(xdotool getactivewindow)
MAGIC_SED='s/.*=\(.*\)/\1/'
WIN_BLW=$(xdotool getmouselocation --shell 2>/dev/null | grep WINDOW | sed "$MAGIC_SED")
xdotool windowactivate "$WIN_BLW"
sleep 1
scrot -u -b -c "${NAME}"
xdotool windowminimize "$WIN_BLW"
xdotool windowactivate "$PMSS_PID"
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 ""
upload_check
;;
"M" | "m")
PMSS_PID=$(xdotool getactivewindow)
printf "\033c"
echo -e ""
echo -e '\E[1;32;49m'"Minimize Terminal And Bring The Window To Be Captured In Focus.."
echo -e ""
scrot -u -d12 -b -c "${NAME}"
RETVAL=$?
if [[ "$RETVAL" == 2 ]]; then
xdotool windowactivate "$PMSS_PID"
printf "\033c"
echo -e ""
echo -e '\E[1;32;49m'"No Open Window Found Below PMSS"
echo -e '\E[1;32;49m'"Hence No Screenshot Is Captured"
echo -e ""
read -r -s -p $'Press Any Key To Continue..\n' -n1
window_focus
else
WIN_BLW=$(xdotool getactivewindow)
xdotool windowminimize "$WIN_BLW"
xdotool windowactivate "$PMSS_PID"
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 ""
upload_check
fi
;;
*)
printf "\033c"
echo -e ""
echo -e '\E[1;32;49m'"\"$Choice\" Is An Invalid Option!!!"
echo -e ""
echo -e '\E[1;32;49m'"Correct Options To Choose Are From B-C-M"
echo -e ""
echo -e '\E[1;32;49m'"To Capture The Window Open Below PMSS Window, Press \"B\""
echo -e '\E[1;32;49m'"To Capture The Window Under The Mouse Cursor, Press \"C\""
echo -e '\E[1;32;49m'"To Manually Select The Window To Be Captured, Press \"M\""
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
window_focus
;;
esac
}

function entire_area (){
DATE="$(date +%d%m%y-%H%M%S)"
SHORT_NAME="Shot-${DATE}.png"
NAME="${DIR}/${SHORT_NAME}"
printf "\033c"
echo -e ""
echo -e '\E[1;32;49m'"Select The Screenshot Mode"
echo -e ""
echo -e '\E[1;32;49m'"Press \"C\" For Clean Mode"
echo -e '\E[1;32;49m'"Press \"D\" For Dirty Mode"
echo -e ""
echo -e '\E[1;32;49m'"Enter Your Choice: "
echo -e ""
tput sgr0
read -er Choice
case "$Choice" in
"C" | "c")
printf "\033c"
DESK_TOP=$(xdotool get_desktop)
PMSS_PID=$(xdotool getactivewindow)
for i in $(xdotool search --onlyvisible --desktop "$DESK_TOP" ".*");do xdotool windowminimize $i;done
xdotool search --onlyvisible --desktop "$DESK_TOP" --class "tint2"
RETVAL=$?
if [[ "$RETVAL" == 0 ]]; then
for i in $(xdotool search --desktop "$DESK_TOP" --class "tint2");do xdotool windowactivate $i;done
fi
xdotool search --onlyvisible --desktop "$DESK_TOP" --class "conky"
RETVAL=$?
if [[ "$RETVAL" == 0 ]]; then
for i in $(xdotool search --desktop "$DESK_TOP" --class "conky");do xdotool windowactivate $i;done
fi
sleep 1
scrot -c "${NAME}"
xdotool windowactivate "$PMSS_PID"
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 ""
upload_check
;;
"D" | "d")
PMSS_PID=$(xdotool getactivewindow)
printf "\033c"
echo -e ""
echo -e '\E[1;32;49m'"Minimize Terminal & Any Open Window You Don't Wish To Capture.."
echo -e ""
scrot -d12 -c "${NAME}"
xdotool windowactivate "$PMSS_PID"
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 ""
upload_check
;;
*)
printf "\033c"
echo -e ""
echo -e '\E[1;32;49m'"\"$Choice\" Is An Invalid Option!!!"
echo -e ""
echo -e '\E[1;32;49m'"Correct Options To Choose Are From C-D"
echo -e ""
echo -e '\E[1;32;49m'"To Capture The Desktop Without Any Open Window, Press \"C\""
echo -e '\E[1;32;49m'"To Capture The Desktop With Open-Active Window, Press \"D\""
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
entire_area
;;
esac
}

function MenU (){
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; }
type xdotool >/dev/null 2>&1 || { printf "\033c"; echo -e ""; echo -e '\E[1;32;49m'"A required pmss dependency \"xdotool\" is not present."; echo -e '\e[1;32;49m'"\"xdotool\" is available for almost all linux distros."; echo -e '\e[1;32;49m'"Please install \"xdotool\" 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"
printf "\033c"
echo -e '\E[1;32;49m'"** PMSS<>MENU *************************************************"
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 \"D\" To Empty Screenshots Directory"
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
;;
"D" | "d")
empty_dir
;;
"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-D-Q"
echo -e ""
echo -e '\E[1;32;49m'"For Screenshot Of The Entire Screen, Press \"E\" & Hit \"Enter\" Key"
echo -e '\E[1;32;49m'"For Screenshot Of The Window In Focus, Press \"W\" & Hit \"Enter\" Key"
echo -e '\E[1;32;49m'"For Screenshot Of Area Selected By Mouse, Press \"A\" & Hit \"Enter\" Key"
echo -e '\E[1;32;49m'"To Empty Screenshots Directory, Press \"D\" & 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


Cheers!!!
Title: Re: pmss (Poor Man's Screenshooter)
Post by: VastOne on December 26, 2016, 09:20:39 PM
After a long power outage I am back online  .. nasty storms still all around in the Midwest

Version 3.1 is a winner!  Every part of it works as expected....

Well done hakerdefo, I will make sure this version is the default in VSIDO on next ISO

Thank you mate

Cheers!
Title: Re: pmss (Poor Man's Screenshooter)
Post by: PackRat on December 26, 2016, 09:44:06 PM
Quote
Well done hakerdefo

+100

Works as is in Void linux - just have to make sure the $DIR exists (or change that variable in the script).

(https://i.imgur.com/WztA2Hwm.png) (https://i.imgur.com/WztA2Hw)

(https://i.imgur.com/NzztgQUm.jpg) (https://i.imgur.com/NzztgQU)

Awesome piece of work.
Title: Re: pmss (Poor Man's Screenshooter)
Post by: VastOne on December 29, 2016, 06:05:06 PM
I am telling you this script is fecking awesome...

I had to do a lot of meticulous screenshots to correct some problems on an update to this forum..

Once I figured out the keystrokes and patterns (burned them to memory) it was a spectacular easy thing to do...

What was once cumbersome is now a joy to do

Thank you hakerdefo for this incredible gift
Title: Re: pmss (Poor Man's Screenshooter)
Post by: PackRat on December 29, 2016, 08:21:12 PM
Once I figured out the keystrokes and patterns (burned them to memory) it was a spectacular easy thing to do...

Thank you hakerdefo for this incredible gift

Indeed.

I just created a key binding for the script, easy peasy with a couple key strokes to get from shot to post.
Title: Re: pmss (Poor Man's Screenshooter)
Post by: VastOne on December 29, 2016, 08:40:54 PM
Share it please.. or at least a step by step...  ;)
Title: Re: pmss (Poor Man's Screenshooter)
Post by: PackRat on December 29, 2016, 09:44:43 PM
In your favorite text editor add this line to the $HOME/.fluxbox/keys file -

Code: [Select]
Mod4 Shift Print :Exec urxvt -title screenshot -e pmsshot
The key binding "Mod4 Shift Print" is optional, whatever is avaaiable to you - Alt p will work just as well.

The command

Code: [Select]
urxvt -title screenshot -e pmsshot
will launch urxvt with the title screenshot and execute pmsshot - as long as pmsshot (or whatever you have named the script) is on your path; otherwise use the full path name.

You can use your terminal of choice.

Code: [Select]
xterm -title screenshot -e pmsshot
Code: [Select]
xfce4-terminal --title screenshot -x pmsshot
note that xfce4-terminal uses --title not -title. Also, I believe it is recommended to use "-x" but the "-e" is still supported.

The title for the terminal is optional, just a way to keep track of which terminal is running the script - the screenshot terminal is identifiable in the fluxbox (any) iconbar:

(http://en.zimagez.com/miniature/december14830477901600x900.jpg) (http://en.zimagez.com/zimage/december14830477901600x900.php)

It really didn't dawn on me until this morning that this utility is mouse free - all the more reason to like it; will be a nice addition to tiling window managers. More key bindings to create  ;D
Title: Re: pmss (Poor Man's Screenshooter)
Post by: VastOne on December 29, 2016, 10:40:09 PM
Thanks RatMan!

I ended up using

Code: [Select]
# take a screenshot with hakerdefo script pmss
Mod4 p :Exec launch xfce4-terminal --title pmss-screenshot -x pmss

I have an old piece of code in the keys file:

Code: [Select]
118 :Exec xfce4-screenshooter
This used to work using the print screen button to engage the screenshooter but that no longer works because ?!?!.. is there a code somewhere that discusses the numerical sequence of keys you know of?

I used the tool xev to get the new value of the key

launch is attached to this... make sure it is executable and in /usr/local/bin  .. one of the best pieces of script I have had the pleasure of using and being a part of
Title: Re: pmss (Poor Man's Screenshooter)
Post by: VastOne on December 29, 2016, 10:52:37 PM
^ I remembered the xev tool to identify keys on the keyboad
Title: Re: pmss (Poor Man's Screenshooter)
Post by: PackRat on December 30, 2016, 12:15:46 AM
You can't just use "Print" for that binding - or is the numeric value required for launch to work?

If Print or 107 (that's my keycode for Print as well) do not work, try the keysym 0xff61 - or whatever yours is. I have to use that keysym in some tiling window managers that don't recognize the multimedia keys, and won't include the  /X11/XF86keysym.h file.
Title: Re: pmss (Poor Man's Screenshooter)
Post by: VastOne on December 30, 2016, 12:19:22 AM
^ Yes... it is what I did use the numeric value from xev

It had changed on this newer keyboard that I have now and I did not realize it was different

xev solved it all

launch did not matter at all.. I just included it because I used it in the example
Title: Re: pmss (Poor Man's Screenshooter)
Post by: PackRat on December 30, 2016, 03:14:49 PM
Code: [Select]
# take a screenshot with hakerdefo script pmss
Mod4 p :Exec launch xfce4-terminal --title pmss-screenshot -x pmss

That command will/can cause some trouble if you already have an instance of xfce4-terminal open won't it. The open terminal will be focused - and not run the command, correct? And if xfce4-terminal already has focus it will get iconified.

Guess it depends on how you want to compose a screenhot.
Title: Re: pmss (Poor Man's Screenshooter)
Post by: VastOne on December 30, 2016, 05:02:56 PM
It is designed to open the current instance, so if xfce-terminal is already open it will open that

The reverse is if you keep hitting alt p pmss will open as many times as you open it..

launch is a choice, not a requirement. I use it on every command from tint2 and any other panel and also on everything from fluxbox menus so you do not open multiple instances of anything
Title: Re: pmss (Poor Man's Screenshooter)
Post by: jedi on January 01, 2017, 06:45:59 AM
It is designed to open the current instance, so if xfce-terminal is already open it will open that

The reverse is if you keep hitting alt p pmss will open as many times as you open it..

launch is a choice, not a requirement. I use it on every command from tint2 and any other panel and also on everything from fluxbox menus so you do not open multiple instances of anything

Nice little tidbit to know about Launch.  Thanks for the explanation!
Title: Re: pmss (Poor Man's Screenshooter)
Post by: hakerdefo on March 19, 2017, 09:40:59 PM
V4 is here  8)


Feedback welcome  8)

Code: [Select]
#!/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 2
    printf "\033c"
    tput sgr0
    exit 0
}

function view_log (){
    test -f "${PMSS_LOG}" || { printf "\033c"; echo -e ""; echo -e '\E[1;32;49m'"PMSS Upload Log File Not Found"; echo -e '\E[1;32;49m'"Upload A Few Screenshots First"; echo -e ""; read -rsp $'Press Any Key To Return To PMSS MENU..\n' -n1; MenU; }
    test -s "${PMSS_LOG}" || { printf "\033c"; echo -e ""; echo -e '\E[1;32;49m'"PMSS Upload Log File Is Empty"; echo -e '\E[1;32;49m'"Upload Some Screenshots First"; echo -e ""; read -rsp $'Press Any Key To Return To PMSS MENU..\n' -n1; MenU; }
    printf "\033c"
    echo -e ""
    echo -e '\E[1;32;49m'"Press \"V\" To View The Upload Log File"
    echo -e '\E[1;32;49m'"Press \"W\" To Wipe The Upload Log File"
    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
"V" | "v")
    if ! type less >/dev/null 2>&1; then
printf "\033c"
echo -e ""
echo -e '\E[1;32;49m'"PMSS Requires File Pager \"less\" To Display Upload Log"
echo -e '\E[1;32;49m'"Please Install Package \"less\" Via The Package Manager"
echo -e '\E[1;32;49m'"For Extra Information On \"less\" Please Visit Homepage"
echo -e '\E[1;32;49m'"http://www.greenwoodsoftware.com/less/"
echo -e ""
read -rsp $'Press Any Key To Return To PMSS MENU..\n' -n1
MenU
    else
printf "\033c"
echo -e ""
echo -e '\E[1;32;49m'"Once You Are Done Viewing, Press \"Q\" To Close The File"
echo -e ""
read -r -s -p $'Press Any Key To View The File...\n' -n1
tput sgr0
less -RM "$PMSS_LOG"
MenU
    fi
    ;;
"W" | "w")
    printf "\033c"
    echo -e ""
    echo -e '\E[1;32;49m'"This Will Clear Entire Upload Log! Are You Sure?"
    echo -e ""
    echo -e '\E[1;32;49m'"Press \"Y\" To Wipe The Upload Log File"
    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")
    if type truncate >/dev/null 2>&1; then
truncate --size 0 "$PMSS_LOG"
    else
: > "$PMSS_LOG"
    fi
    printf "\033c"
    echo -e ""
    echo -e '\E[1;32;49m'"The Upload Log File Has Been Cleared"
    echo -e ""
    read -rsp $'Press Any Key To Return To PMSS MENU..\n' -n1
    MenU
    ;;
"N" | "n")
    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 Wipe The Upload Log File, Press \"Y\""
    echo -e '\E[1;32;49m'"To Go Back To 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
    view_log
    ;;
    esac
    ;;
"N" | "n")
    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 V-W-N"
    echo -e ""
    echo -e '\E[1;32;49m'"To View The Upload Log File, Press \"V\""
    echo -e '\E[1;32;49m'"To Wipe The Upload Log File, Press \"W\""
    echo -e '\E[1;32;49m'"To Go Back To 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
    view_log
    ;;
    esac
}

function empty_dir (){
    printf "\033c"
    echo -e ""
    echo -e '\E[1;32;49m'"This Will Remove All Saved Screenshots! Are You Sure?"
    echo -e ""
    echo -e '\E[1;32;49m'"Press \"Y\" To Empty Screenshots Directory"
    echo -e '\E[1;32;49m'"Press \"N\" To Move Back To Main PMSS Menu"
    echo -e ""
    echo -e '\E[1;32;49m'"Enter Your Choice: "
    echo -e ""
    tput sgr0
    read -er Choice
    case "$Choice" in
"Y" | "y")
    if test -z "$(find "${DIR}" -maxdepth 1 -name '*.png' -print -quit)"; then
printf "\033c"
echo -e ""
echo -e '\E[1;32;49m'"Screenshots Directory Is Empty"
echo -e '\E[1;32;49m'"Nothing To Delete. Say Cheese!"
echo -e ""
read -rsp $'Press Any Key To Return To PMSS MENU..\n' -n1
MenU
    else
PMSS_RM=$(which rm)
"$PMSS_RM" -f "${DIR}"/*.png
printf "\033c"
echo -e ""
echo -e '\E[1;32;49m'"Screenshots Directory Has Been Emptied"
echo -e ""
read -rsp $'Press Any Key To Return To PMSS MENU..\n' -n1
MenU
    fi
    ;;
"N" | "n")
    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 Empty Screenshots Directory, Press \"Y\""
    echo -e '\E[1;32;49m'"To Move Back To Main PMSS 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
    empty_dir
    ;;
    esac
}

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

function imgur_upload_personal (){
    printf "\033c"
    while IFS=: read -r k v; do
codes_map["$k"]="$v"
    done < "${PMSS_CONFIG}"
    if ! wget --spider --user-agent="Mozilla/5.0 Gecko/20100101" --timeout=30 -q "https://api.imgur.com" -O /dev/null; 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
    fi
    RESPONSE=$(curl -s --connect-timeout 30 --user-agent "Mozilla/5.0 Gecko/20100101" -X POST -H "Authorization: Bearer ${codes_map[access_token]}" -F "image=@$NAME" "https://api.imgur.com/3/image.xml" 2>/dev/null)
    if grep -q 'success="0"' <<<"$RESPONSE"; then
ERR_MSG2="${RESPONSE##*<error>}"
ERR_MSG="${ERR_MSG2%%</error>*}"
printf "\033c"
echo -e ""
echo -e '\E[1;32;49m'"Something Went Wrong! Upload To imgur Failed!"
echo -e '\E[1;32;49m'"The Following Error Message Was Sent By imgur"
echo -e ""
echo -e '\E[1;32;49m'"\"$ERR_MSG\""
echo -e ""
read -rsp $'Press Any Key To Return To PMSS MENU..\n' -n1
MenU
    fi
    URL3="${RESPONSE##*<link>}"
    URL2="${URL3%%</link>*}"
    URL="${URL2//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 LINK (FORUMS, MESSAGE BOARDS)"
    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 LINK (REDDIT, GITHUB)"
    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 LINK (WEBSITES, BLOGS)"
    echo -e '\E[1;32;49m'"Original  : "'\E[0;32;49m'"<a href=${BASE_URL}><img src=${URL} title=${SHORT_NAME} /></a>"
    echo -e '\E[1;32;49m'"Thumbnail : "'\E[0;32;49m'"<a href=${BASE_URL}><img src=${BASE_URL}m.${BASE_EXT} title=${SHORT_NAME} /></a>"
    echo -e ""
    echo -e '\E[1;32;49m'"DELETE LINK"
    echo -e '\E[1;32;49m'"Delete url: "'\E[0;32;49m'"${DEL_URL}"
    echo -e '\E[1;32;49m'""
    read -rsp $'Press Any Key To Return To PMSS MENU..\n' -n1
    MenU
}

function imgur_token_test (){
    if ! type curl >/dev/null 2>&1; 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 '\E[1;32;49m'"For extra info go to website of \"cURL\","
echo -e '\E[1;32;49m'"https://curl.haxx.se/"
echo -e ""
read -rsp $'Press Any Key To Return To PMSS MENU..\n' -n1
MenU
    fi
    PERMS_CONFIG=$(stat -c "%a" "${PMSS_CONFIG}")
    printf "\033c"
    if ! [[ "${PERMS_CONFIG}" == 600 ]]; then
chmod 600 "${PMSS_CONFIG}"
    fi
    while IFS=: read -r k v; do
codes_map["$k"]="$v"
    done < "${PMSS_CONFIG}"
    TOKEN_TIME=$(find "${PMSS_CONFIG}" -mmin +40319)
    if test "$TOKEN_TIME"; then
if ! wget --spider --user-agent="Mozilla/5.0 Gecko/20100101" --timeout=30 -q "https://api.imgur.com" -O /dev/null; 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
fi
RESPONSE=$(curl -s --connect-timeout 30 --user-agent "Mozilla/5.0 Gecko/20100101" -X POST -H "Authorization: Bearer ${codes_map[access_token]}" -F "refresh_token=${codes_map[refresh_token]}" -F "client_id=${codes_map[client_id]}" -F "client_secret=${codes_map[client_secret]}" -F "grant_type=refresh_token" "https://api.imgur.com/oauth2/token" 2>/dev/null)
if grep -q 'success:false' <<<"$RESPONSE"; then
    printf "\033c"
    echo -e ""
    echo -e '\E[1;32;49m'"PMSS Failed To Refresh The Access Token"
    echo -e '\E[1;32;49m'"Please Retry The Process Sometime Later"
    echo -e ""
    read -rsp $'Press Any Key To Return To PMSS MENU..\n' -n1
    MenU
fi
while IFS=\" read -rd \, _ k _ v; do
    if [[ "$k" = @(access_token|refresh_token) ]]; then
codes_map["$k"]="$v"
    fi
done <<< "$RESPONSE"
printf '%s:%s\n' access_token "${codes_map[access_token]}" refresh_token "${codes_map[refresh_token]}" client_id "${codes_map[client_id]}" client_secret "${codes_map[client_secret]}" > "${PMSS_CONFIG}"
imgur_upload_personal
    else
imgur_upload_personal
    fi
}

function setup_stage2 (){
    printf "\033c"
    echo -e ""
    echo -e '\E[1;32;49m'"Enter The \"Access Token\" Acquired During The Setup Process"
    echo -e ""
    read -er access_token
    if [[ -z "$access_token" ]]; then
printf "\033c"
echo -e ""
echo -e '\E[1;32;49m'"Nothing Was Entered!!!"
echo -e ""
sleep 2
setup_stage2
    fi
    printf "\033c"
    echo -e ""
    echo -e '\E[1;32;49m'"Enter The \"Refresh Token\" Acquired During The Setup Process"
    echo -e ""
    read -er refresh_token
    if [[ -z "$refresh_token" ]]; then
printf "\033c"
echo -e ""
echo -e '\E[1;32;49m'"Nothing Was Entered!!!"
echo -e ""
sleep 2
setup_stage2
    fi
    printf "\033c"
    echo -e ""
    echo -e '\E[1;32;49m'"Enter The \"Client ID\" Acquired During The Setup Process"
    echo -e ""
    read -er client_id
    if [[ -z "$client_id" ]]; then
printf "\033c"
echo -e ""
echo -e '\E[1;32;49m'"Nothing Was Entered!!!"
echo -e ""
sleep 2
setup_stage2
    fi
    printf "\033c"
    echo -e ""
    echo -e '\E[1;32;49m'"Enter The \"Client Secret\" Acquired During The Setup Process"
    echo -e ""
    read -er client_secret
    if [[ -z "$client_secret" ]]; then
printf "\033c"
echo -e ""
echo -e '\E[1;32;49m'"Nothing Was Entered!!!"
echo -e ""
sleep 2
setup_stage2
    fi
    codes_map[access_token]="$access_token"
    codes_map[refresh_token]="$refresh_token"
    codes_map[client_id]="$client_id"
    codes_map[client_secret]="$client_secret"
    printf '%s:%s\n' access_token "${codes_map[access_token]}" refresh_token "${codes_map[refresh_token]}" client_id "${codes_map[client_id]}" client_secret "${codes_map[client_secret]}" > "$PMSS_CONFIG"
    printf "\033c"
    echo -e ""
    echo -e '\E[1;32;49m'"imgur \"OAuth 2\" Setup Is Now Complete"
    echo -e '\E[1;32;49m'"Enjoy Uploading To Your imgur Account"
    echo -e ""
    read -r -s -p $'Press Any Key To Continue..\n' -n1
    imgur_token_test
}

function setup_stage1 (){
    if test -f "${PMSS_CONFIG}"; then
imgur_token_test
    fi
    echo -e ""
    echo -e '\E[1;32;49m'"To Upload To Your imgur Account, \"OAuth 2\" Setup Needs To Be Completed"
    echo -e '\E[1;32;49m'"Start The \"OAuth 2\" Setup Process Now?"
    echo -e ""
    echo -e '\E[1;32;49m'"Enter \"Y\" To Start The Setup"
    echo -e '\E[1;32;49m'"Enter \"N\" To Go Back To Menu"
    echo -e ""
    echo -e '\E[1;32;49m'"Enter Your Choice: "
    echo -e ""
    tput sgr0
    read -er Choice
    case "$Choice" in
"Y" | "y")
    printf "\033c"
    echo -e ""
    echo -e '\E[1;32;49m'"First You Need To Register A New Application At imgur"
    echo -e '\E[1;32;49m'"While Registering At imgur Do Select Following Option"
    echo -e ""
    echo -e '\E[0;32;49m'"\"OAuth 2 authorization without a callback URL\""
    echo -e ""
    echo -e ""
    echo -e '\E[1;32;49m'"Open Following Link In A Browser To Register At imgur"
    echo -e ""
    echo -e '\E[0;32;49m'"https://api.imgur.com/oauth2/addclient"
    echo -e ""
    echo -e ""
    echo -e '\E[1;32;49m'"You Would Now Have Your \"Client ID\" & \"Client Secret\""
    echo -e '\E[1;32;49m'"Save Them In A Text File As They'll Be Required Later"
    echo -e ""
    read -rsp $'Press Any Key To Continue The Setup Process..\n' -n1
    printf "\033c"
    echo -e ""
    echo -e '\E[1;32;49m'"Next In The Following Link, Replace \"CLIENT_ID\" With,"
    echo -e '\E[1;32;49m'"Your \"Client ID\" Received After registration At imgur"
    echo -e '\E[1;32;49m'"And Open The URL In A Browser To Receive Personal \"PIN\""
    echo -e ""
    echo -e '\E[0;32;49m'"https://api.imgur.com/oauth2/authorize?client_id=CLIENT_ID&response_type=pin"
    echo -e ""
    echo -e ""
    echo -e '\E[1;32;49m'"imgur webpage will display you the following message,"
    echo -e ""
    echo -e '\E[0;32;49m'"\"An application would like to connect to your account\""
    echo -e ""
    echo -e ""
    echo -e '\E[1;32;49m'"On this imgur page simply click on the \"allow\" button"
    echo -e '\E[1;32;49m'"You Will Now Have \"Client ID\" \"Client Secret\" & \"PIN\""
    echo -e '\E[1;32;49m'"Save Them In A Text File As They'll Be Required Later"
    echo -e ""
    read -rsp $'Press Any Key To Continue The Setup Process..\n' -n1
    printf "\033c"
    echo -e ""
    echo -e '\E[1;32;49m'"Replace \"CLIENT_ID\" \"CLIENT_SECRET\" & \"PIN\" With The,"
    echo -e '\E[1;32;49m'"\"Client ID\" \"Client Secret\" & \"PIN\" That You Have Got"
    echo -e '\E[1;32;49m'"From imgur And Run The Following Command In A Terminal"
    echo -e ""
    echo -e '\E[0;32;49m'"curl -X POST -F \"client_id=CLIENT_ID\" -F \"client_secret=CLIENT_SECRET\" -F \"pin=PIN\" -F \"grant_type=pin\" \"https://api.imgur.com/oauth2/token\""
    echo -e ""
    echo -e ""
    echo -e '\E[1;32;49m'"You Will Now Have \"Access Token\" And \"Refresh Token\""
    echo -e '\E[1;32;49m'"Save Them In A Text File As They'll Be Required Later"
    echo -e ""
    read -rsp $'Press Any Key To Continue The Setup Process..\n' -n1
    setup_stage2
    ;;
"N" | "n")
    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 Start OAuth 2 Set-up, Enter \"Y\""
    echo -e '\E[1;32;49m'"To Go Back To Main Menu, Enter \"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
    setup_stage1
    ;;
    esac
}

function imgur_upload_anonymous (){
    if ! type curl >/dev/null 2>&1; 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 '\E[1;32;49m'"For extra info go to website of \"cURL\","
echo -e '\E[1;32;49m'"https://curl.haxx.se/"
echo -e ""
read -rsp $'Press Any Key To Return To PMSS MENU..\n' -n1
MenU
    fi
    if ! wget --spider --user-agent="Mozilla/5.0 Gecko/20100101" --timeout=30 -q "https://api.imgur.com" -O /dev/null; 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
    fi
    RESPONSE=$(curl -s --connect-timeout 30 --user-agent "Mozilla/5.0 Gecko/20100101" -X POST -H "Authorization: Client-ID $ID_CLIENT" -F "image=@$NAME" "https://api.imgur.com/3/image.xml" 2>/dev/null)
    if grep -q 'success="0"' <<<"$RESPONSE"; then
ERR_MSG2="${RESPONSE##*<error>}"
ERR_MSG="${ERR_MSG2%%</error>*}"
printf "\033c"
echo -e ""
echo -e '\E[1;32;49m'"Something Went Wrong! Upload To imgur Failed!"
echo -e '\E[1;32;49m'"The Following Error Message Was Sent By imgur"
echo -e ""
echo -e '\E[1;32;49m'"\"$ERR_MSG\""
echo -e ""
read -rsp $'Press Any Key To Return To PMSS MENU..\n' -n1
MenU
    fi
    URL3="${RESPONSE##*<link>}"
    URL2="${URL3%%</link>*}"
    URL="${URL2//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 "################################################################################" >> "${PMSS_LOG}"
    echo -e "" >> "${PMSS_LOG}"
    echo -e "DATE-TIME : $(date +"%d-%m-%Y::%H:%M:%S")" >> "${PMSS_LOG}"
    echo -e "" >> "${PMSS_LOG}"
    echo -e "DIRECT LINK" >> "${PMSS_LOG}"
    echo -e "Original  : ${URL}" >> "${PMSS_LOG}"
    echo -e "Thumbnail : ${BASE_URL}m.${BASE_EXT}" >> "${PMSS_LOG}"
    echo -e "" >> "${PMSS_LOG}"
    echo -e "BBCODE LINK (FORUMS, MESSAGE BOARDS)" >> "${PMSS_LOG}"
    echo -e "Original  : [img]${URL}[/img]" >> "${PMSS_LOG}"
    echo -e "Thumbnail : [url=${BASE_URL}][img]${BASE_URL}m.${BASE_EXT}[/img][/url]" >> "${PMSS_LOG}"
    echo -e "" >> "${PMSS_LOG}"
    echo -e "MARKDOWN LINK (REDDIT, GITHUB)" >> "${PMSS_LOG}"
    echo -e "Original  : [${SHORT_NAME}](${URL})" >> "${PMSS_LOG}"
    echo -e "Thumbnail : [${SHORT_NAME}](${BASE_URL}m.${BASE_EXT})" >> "${PMSS_LOG}"
    echo -e "" >> "${PMSS_LOG}"
    echo -e "HTML LINK (WEBSITES, BLOGS)" >> "${PMSS_LOG}"
    echo -e "Original  : <a href=${BASE_URL}><img src=${URL} title=${SHORT_NAME} /></a>" >> "${PMSS_LOG}"
    echo -e "Thumbnail : <a href=${BASE_URL}><img src=${BASE_URL}m.${BASE_EXT} title=${SHORT_NAME} /></a>" >> "${PMSS_LOG}"
    echo -e "" >> "${PMSS_LOG}"
    echo -e "DELETE LINK" >> "${PMSS_LOG}"
    echo -e "Delete url: ${DEL_URL}" >> "${PMSS_LOG}"
    echo -e "" >> "${PMSS_LOG}"
    echo -e "################################################################################" >> "${PMSS_LOG}"
    echo -e "" >> "${PMSS_LOG}"
    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 LINK (FORUMS, MESSAGE BOARDS)"
    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 LINK (REDDIT, GITHUB)"
    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 LINK (WEBSITES, BLOGS)"
    echo -e '\E[1;32;49m'"Original  : "'\E[0;32;49m'"<a href=${BASE_URL}><img src=${URL} title=${SHORT_NAME} /></a>"
    echo -e '\E[1;32;49m'"Thumbnail : "'\E[0;32;49m'"<a href=${BASE_URL}><img src=${BASE_URL}m.${BASE_EXT} title=${SHORT_NAME} /></a>"
    echo -e ""
    echo -e '\E[1;32;49m'"DELETE LINK"
    echo -e '\E[1;32;49m'"Delete url: "'\E[0;32;49m'"${DEL_URL}"
    echo -e '\E[1;32;49m'""
    read -rsp $'Press Any Key To Return To PMSS MENU..\n' -n1
    MenU
}

function upload_check (){
    if type xdg-open >/dev/null 2>&1; then
xdg-open "${NAME}"
    else
echo -e ""
echo -e '\E[1;32;49m'"PMSS Is Unable To Open The Screenshot"
echo -e '\E[1;32;49m'"It Needs \"xdg-utils\" Package To Do So"
echo -e ""
    fi
    echo -e ""
    echo -e '\E[1;32;49m'"Do You Want To Upload The Screenshot?"
    echo -e ""
    echo -e '\E[1;32;49m'"Enter \"Y\" To Upload The Shot To imgur"
    echo -e '\E[1;32;49m'"Enter \"D\" To Purge The Shot & Go Back"
    echo -e '\E[1;32;49m'"Enter \"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")
    printf "\033c"
    echo -e ""
    echo -e '\E[1;32;49m'"Select The Preferred Image Upload Mode"
    echo -e ""
    echo -e '\E[1;32;49m'"Enter \"A\" For Anonymous Image Upload"
    echo -e '\E[1;32;49m'"Enter \"U\" To Upload Image To Account"
    echo -e ""
    echo -e '\E[1;32;49m'"Enter Your Choice: "
    echo -e ""
    tput sgr0
    read -er Choice
    case "$Choice" in
"A" | "a")
    printf "\033c"
    imgur_upload_anonymous
    ;;
"U" | "u")
    printf "\033c"
    setup_stage1
    ;;
*)
    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 A-P"
    echo -e ""
    echo -e '\E[1;32;49m'"For Uploading Image Anonymously, Enter \"A\""
    echo -e '\E[1;32;49m'"To Upload Image To Your Account, Enter \"U\""
    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
    ;;
"D" | "d")
    purge_shot
    ;;
"N" | "n")
    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-D-N"
    echo -e ""
    echo -e '\E[1;32;49m'"To Upload Image To imgur, Enter \"Y\""
    echo -e '\E[1;32;49m'"To Delete Captured Image, Enter \"D\""
    echo -e '\E[1;32;49m'"To Move Back To The Menu, Enter \"N\""
    echo -e ""
    echo -e '\E[1;32;49m'"Got it? It Is Not That Hard You See"
    echo -e ""
    read -rsp $'Press Any Key To Continue..\n' -n1
    MenU
    ;;
    esac
}

function area_mouse (){
    DATE="$(date +%d%m%y-%H%M%S)"
    SHORT_NAME="Shot-${DATE}.png"
    NAME="${DIR}/${SHORT_NAME}"
    printf "\033c"
    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
printf "\033c"
sleep 1
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
    else
printf "\033c"
sleep 1
xdotool windowactivate "$PMSS_PID"
echo -e ""
echo -e '\E[0;32;49m'"${SHORT_NAME}"'\E[1;32;49m'" Saved In "'\E[0;32;49m'"${DIR}"
echo -e ""
upload_check
    fi
}

function window_focus (){
    DATE="$(date +%d%m%y-%H%M%S)"
    SHORT_NAME="Shot-${DATE}.png"
    NAME="${DIR}/${SHORT_NAME}"
    printf "\033c"
    echo -e ""
    echo -e '\E[1;32;49m'"Select The Screenshot Mode"
    echo -e ""
    echo -e '\E[1;32;49m'"Press \"B\" To Capture The Window Open Below PMSS Window"
    echo -e '\E[1;32;49m'"Press \"C\" To Capture The Window Under The Mouse Cursor"
    echo -e '\E[1;32;49m'"Press \"M\" To Manually Select The Window To Be Captured"
    echo -e ""
    echo -e '\E[1;32;49m'"Enter Your Choice: "
    echo -e ""
    tput sgr0
    read -er Choice
    case "$Choice" in
"B" | "b")
    PMSS_PID=$(xdotool getactivewindow)
    xdotool windowminimize "$PMSS_PID"
    sleep 1
    scrot -u -b -c "${NAME}"
    RETVAL=$?
    if [[ "$RETVAL" == 2 ]]; then
printf "\033c"
sleep 1
xdotool windowactivate "$PMSS_PID"
echo -e ""
echo -e '\E[1;32;49m'"No Open Window Found Below PMSS"
echo -e '\E[1;32;49m'"Hence No Screenshot Is Captured"
echo -e ""
read -r -s -p $'Press Any Key To Continue..\n' -n1
window_focus
    else
printf "\033c"
sleep 1
xdotool windowactivate "$PMSS_PID"
echo -e ""
echo -e '\E[0;32;49m'"${SHORT_NAME}"'\E[1;32;49m'" Saved In "'\E[0;32;49m'"${DIR}"
echo -e ""
upload_check
    fi
    ;;
"C" | "c")
    printf "\033c"
    echo -e ""
    echo -e '\E[1;32;49m'"Position The Mouse Cursor Over The Window To Capture"
    echo -e '\E[1;32;49m'"Don't Click Just Position The Cursor Over The Window"
    echo -e ""
    read -r -s -p $'Press Any Key When You Are Ready..\n' -n1
    PMSS_PID=$(xdotool getactivewindow)
    xdotool windowminimize "$PMSS_PID"
    MAGIC_SED='s/.*=\(.*\)/\1/'
    WIN_BLW=$(xdotool getmouselocation --shell 2>/dev/null | grep WINDOW | sed "$MAGIC_SED")
    xdotool windowactivate "$WIN_BLW"
    sleep 1
    scrot -u -b -c "${NAME}"
    printf "\033c"
    sleep 1
    xdotool windowactivate "$PMSS_PID"
    echo -e ""
    echo -e '\E[0;32;49m'"${SHORT_NAME}"'\E[1;32;49m'" Saved In "'\E[0;32;49m'"${DIR}"
    echo -e ""
    upload_check
    ;;
"M" | "m")
    PMSS_PID=$(xdotool getactivewindow)
    printf "\033c"
    echo -e ""
    echo -e '\E[1;32;49m'"Minimize Terminal And Bring The Window To Be Captured In Focus.."
    echo -e ""
    scrot -u -d12 -b -c "${NAME}"
    RETVAL=$?
    if [[ "$RETVAL" == 2 ]]; then
printf "\033c"
sleep 1
xdotool windowactivate "$PMSS_PID"
echo -e ""
echo -e '\E[1;32;49m'"Failed To Find A Focused Window"
echo -e '\E[1;32;49m'"Hence No Screenshot Is Captured"
echo -e ""
read -r -s -p $'Press Any Key To Continue..\n' -n1
window_focus
    else
printf "\033c"
sleep 1
xdotool windowactivate "$PMSS_PID"
echo -e ""
echo -e '\E[0;32;49m'"${SHORT_NAME}"'\E[1;32;49m'" Saved In "'\E[0;32;49m'"${DIR}"
echo -e ""
upload_check
    fi
    ;;
*)
    printf "\033c"
    echo -e ""
    echo -e '\E[1;32;49m'"\"$Choice\" Is An Invalid Option!!!"
    echo -e ""
    echo -e '\E[1;32;49m'"Correct Options To Choose Are From B-C-M"
    echo -e ""
    echo -e '\E[1;32;49m'"To Capture The Window Open Below PMSS Window, Press \"B\""
    echo -e '\E[1;32;49m'"To Capture The Window Under The Mouse Cursor, Press \"C\""
    echo -e '\E[1;32;49m'"To Manually Select The Window To Be Captured, Press \"M\""
    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
    window_focus
    ;;
    esac
}

function entire_area (){
    DATE="$(date +%d%m%y-%H%M%S)"
    SHORT_NAME="Shot-${DATE}.png"
    NAME="${DIR}/${SHORT_NAME}"
    printf "\033c"
    echo -e ""
    echo -e '\E[1;32;49m'"Select The Screenshot Mode"
    echo -e ""
    echo -e '\E[1;32;49m'"Press \"C\" For Clean Mode"
    echo -e '\E[1;32;49m'"Press \"D\" For Dirty Mode"
    echo -e ""
    echo -e '\E[1;32;49m'"Enter Your Choice: "
    echo -e ""
    tput sgr0
    read -er Choice
    case "$Choice" in
"C" | "c")
    shopt -s nocaseglob
    shopt -s globstar
    shopt -s extglob
    DESK_TOP=$(xdotool get_desktop)
    PMSS_PID=$(xdotool getactivewindow)
    xdotool windowminimize "$PMSS_PID"
    CONKY_CHECK=$(xdotool search --desktop "$DESK_TOP" --onlyvisible ".*conky*")
    DZEN_CHECK=$(xdotool search --desktop "$DESK_TOP" --onlyvisible ".*dzen*")
    PANEL_CHECK=$(xdotool search --desktop "$DESK_TOP" --onlyvisible ".*panel*")
    TINT2_CHECK=$(xdotool search --desktop "$DESK_TOP" --onlyvisible ".*tint*")
    BAR_CHECK=$(xdotool search --desktop "$DESK_TOP" --onlyvisible ".*bar*")
    DOCK_CHECK=$(xdotool search --desktop "$DESK_TOP" --onlyvisible ".*dock*")
    AWN_CHECK=$(xdotool search --desktop "$DESK_TOP" --onlyvisible ".*awn*")
    PLANK_CHECK=$(xdotool search --desktop "$DESK_TOP" --onlyvisible ".*plank*")
    for i in $(xdotool search --onlyvisible --desktop "$DESK_TOP" ".*"); do xdotool windowminimize "$i"; done
    CONKY_CHECK2=$(xdotool search --desktop "$DESK_TOP" ".*conky*")
    DZEN_CHECK2=$(xdotool search --desktop "$DESK_TOP" ".*dzen*")
    PANEL_CHECK2=$(xdotool search --desktop "$DESK_TOP" ".*panel*")
    TINT2_CHECK2=$(xdotool search --desktop "$DESK_TOP" ".*tint*")
    BAR_CHECK2=$(xdotool search --desktop "$DESK_TOP" ".*bar*")
    DOCK_CHECK2=$(xdotool search --desktop "$DESK_TOP" ".*dock*")
    AWN_CHECK2=$(xdotool search --desktop "$DESK_TOP" ".*awn*")
    PLANK_CHECK2=$(xdotool search --desktop "$DESK_TOP" ".*plank*")
    if ! [[ "$CONKY_CHECK" == "$CONKY_CHECK2" ]]; then
for i in $(xdotool search --desktop "$DESK_TOP" ".*conky*"); do xdotool windowactivate "$i"; done
    fi
    if ! [[ "$DZEN_CHECK" == "$DZEN_CHECK2" ]]; then
for i in $(xdotool search --desktop "$DESK_TOP" ".*dzen*"); do xdotool windowactivate "$i"; done
    fi
    if ! [[ "$PANEL_CHECK" == "$PANEL_CHECK2" ]]; then
for i in $(xdotool search --desktop "$DESK_TOP" ".*panel*"); do xdotool windowactivate "$i"; done
    fi
    if ! [[ "$TINT2_CHECK" == "$TINT2_CHECK2" ]]; then
for i in $(xdotool search --desktop "$DESK_TOP" ".*tint*"); do xdotool windowactivate "$i"; done
    fi
    if ! [[ "$BAR_CHECK" == "$BAR_CHECK2" ]]; then
for i in $(xdotool search --desktop "$DESK_TOP" ".*bar*"); do xdotool windowactivate "$i"; done
    fi
    if ! [[ "$DOCK_CHECK" == "$DOCK_CHECK2" ]]; then
for i in $(xdotool search --desktop "$DESK_TOP" ".*dock*"); do xdotool windowactivate "$i"; done
    fi
    if ! [[ "$AWN_CHECK" == "$AWN_CHECK2" ]]; then
for i in $(xdotool search --desktop "$DESK_TOP" ".*awn*"); do xdotool windowactivate "$i"; done
    fi
    if ! [[ "$PLANK_CHECK" == "$PLANK_CHECK2" ]]; then
for i in $(xdotool search --desktop "$DESK_TOP" ".*plank*"); do xdotool windowactivate "$i"; done
    fi
    shopt -u nocaseglob
    shopt -u globstar
    shopt -u extglob
    sleep 1
    scrot -c "${NAME}"
    printf "\033c"
    sleep 1
    xdotool windowactivate "$PMSS_PID"
    echo -e ""
    echo -e '\E[0;32;49m'"${SHORT_NAME}"'\E[1;32;49m'" Saved In "'\E[0;32;49m'"${DIR}"
    echo -e ""
    upload_check
    ;;
"D" | "d")
    PMSS_PID=$(xdotool getactivewindow)
    printf "\033c"
    echo -e ""
    echo -e '\E[1;32;49m'"Minimize Terminal & Any Open Window You Don't Wish To Capture.."
    echo -e ""
    scrot -d12 -c "${NAME}"
    printf "\033c"
    sleep 1
    xdotool windowactivate "$PMSS_PID"
    echo -e ""
    echo -e '\E[0;32;49m'"${SHORT_NAME}"'\E[1;32;49m'" Saved In "'\E[0;32;49m'"${DIR}"
    echo -e ""
    upload_check
    ;;
*)
    printf "\033c"
    echo -e ""
    echo -e '\E[1;32;49m'"\"$Choice\" Is An Invalid Option!!!"
    echo -e ""
    echo -e '\E[1;32;49m'"Correct Options To Choose Are From C-D"
    echo -e ""
    echo -e '\E[1;32;49m'"To Capture The Desktop Without Any Open Window, Press \"C\""
    echo -e '\E[1;32;49m'"To Capture The Desktop With Open-Active Window, Press \"D\""
    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
    entire_area
    ;;
    esac
}

function MenU (){
    export LC_ALL=C
    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; }
    type xdotool >/dev/null 2>&1 || { printf "\033c"; echo -e ""; echo -e '\E[1;32;49m'"A required pmss dependency \"xdotool\" is not present."; echo -e '\e[1;32;49m'"\"xdotool\" is available for almost all linux distros."; echo -e '\e[1;32;49m'"Please install \"xdotool\" using your package manager."; echo -e '\e[1;32;49m'"For more info please visit the website of \"xdotool\","; echo -e '\e[1;32;49m'"http://semicomplete.com/projects/xdotool"; echo -e ""; tput sgr0; exit 1; }
    if type xdg-user-dir >/dev/null 2>&1; then
DIR_CHECK="$(xdg-user-dir PICTURES)"
if [ "${DIR_CHECK}" != "${HOME}" ]; then
    DIR="${DIR_CHECK}/Screenshots"
    test -d "${DIR}" || mkdir -p "${DIR}"
fi
    else
DIR="${HOME}/Pictures/Screenshots"
test -d "${DIR}" || mkdir -p "${DIR}"
    fi
    PMSS_LOG="${DIR}/pmss-upload.log"
    test -f "${PMSS_LOG}" || touch "${PMSS_LOG}"
    PMSS_CONFIG="${DIR}/.pmss.cfg"
    ID_CLIENT=$(tr '\!-~' 'P-~\!-O' <<<"27a7g_h3ff562a4")
    declare -A codes_map
    printf "\033c"
    echo -e '\E[1;32;49m'"** PMSS<>MENU *************************************************"
    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 \"D\" To Empty Screenshots Directory"
    echo -e '\E[1;32;49m'"** Enter \"L\" To Manage Upload Log"
    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
    ;;
"D" | "d")
    empty_dir
    ;;
"L" | "l")
    view_log
    ;;
"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-D-Q"
    echo -e ""
    echo -e '\E[1;32;49m'"For Screenshot Of The Entire Screen, Press \"E\" & Hit \"Enter\" Key"
    echo -e '\E[1;32;49m'"For Screenshot Of The Window In Focus, Press \"W\" & Hit \"Enter\" Key"
    echo -e '\E[1;32;49m'"For Screenshot Of Area Selected By Mouse, Press \"A\" & Hit \"Enter\" Key"
    echo -e '\E[1;32;49m'"To Empty Screenshots Directory, Press \"D\" & Hit \"Enter\" Key"
    echo -e '\E[1;32;49m'"To Manage The Upload Log, Press \"L\" & 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


Cheers!!!
Title: Re: pmss (Poor Man's Screenshooter)
Post by: VastOne on March 19, 2017, 10:36:19 PM
 I have updated both pmss and pmytd to the latest and greatest versions for the next ISO build

Thank you hakerdefo!   8)