Custom Print Screen Share
Another one of those super useful keys is the PRTSC. It has a job and it does it well that is until you want extended functionality. One such functionality was allowing others to see pic. There are things that do this like Dropbox, but those require you to give your data to a third-party.
So back to the bash scripts. First I needed to get a working script…eventually I came up with these remote-screenshot.sh:
#!/bin/bash
DATE=$(date +'%Y%m%d%H%M%S')
FIL="$(echo "${DATE}${RANDOM}" | sha256sum - | awk '{print $1}').png"
SSHSRV="##SSHSERVER##"
SRV="##WEBSERVERDIR##"
RFIL="/srv/${SRV}/${FIL}"
FILEURL="https://${SRV}/${FIL}"
cd "${HOME}/Pictures" || ( echo -n "Couldn't 'cd' into ~/Pictures" | xclip -selection c && exit 1 )
gnome-screenshot --file="${FIL}"
rsync "${HOME}/Pictures/${FIL}" ${SSHSRV}:"${RFIL}" || ( echo -n "Rsync failed!!" | xclip -selection c && exit 1 )
echo -n "${FILEURL}" | xclip -selection c
remote-screenshot-area.sh
#!/bin/bash
DATE=$(date +'%Y%m%d%H%M%S')
FIL="$(echo "${DATE}${RANDOM}" | sha256sum - | awk '{print $1}').png"
SSHSRV="##SSHSERVER##"
SRV="##WEBSERVERDIR##"
RFIL="/srv/${SRV}/${FIL}"
FILEURL="https://${SRV}/${FIL}"
cd "${HOME}/Pictures" || ( echo -n "Couldn't 'cd' into ~/Pictures" | xclip -selection c && exit 1 )
gnome-screenshot -a --file="${FIL}"
rsync "${HOME}/Pictures/${FIL}" ${SSHSRV}:"${RFIL}" || ( echo -n "Rsync failed!!" | xclip -selection c && exit 1 )
echo -n "${FILEURL}" | xclip -selection c
And once I attached these scripts to a custom keyboard shortcut, I was crusin’ in style.
Update: Ran the script thru shellcheck and implemented some error conditions, though they are still have baked.