This commit is contained in:
Arne Swanson 2018-08-15 23:58:31 -03:00
parent 2a16f20c4c
commit 04b2a602f2
2 changed files with 55 additions and 4 deletions

View File

@ -9,5 +9,35 @@ and `xclip` for copying links.
## installation
```bash
mk install
make install
# use sudo if it's needed
```
## usage
directory defaults to `~/files/shot`, can be changed in source..
### `-w` flag
screenshot the whole desktop
### `-u` flag
upload to 0x0 endpoint **NOT WORKING**
## example
```bash
shot
```
propmts user to select window/region and saves screenshot to default directory with current time and date as name
```bash
shot -w
```
saves screenshot of whole screen to default directory with current time and date as name

27
shot
View File

@ -1,9 +1,11 @@
#!/bin/bash
args=`getopt w $*`
args=`getopt wu $*`
eval set -- "${args}"
directory="${HOME}/files/shot"
endpoint="http://0x0.tilde.team"
flag_window=0
flag_upload=0
while true; do
case "$1" in
@ -11,11 +13,16 @@ while true; do
flag_window=1
shift
;;
-u)
flag_upload=1
shift
;;
--)
shift
break
;;
*)
echo 'internal error'
exit 3
;;
esac
@ -33,5 +40,19 @@ else
import "${directory}/${filename}.png"
fi
echo "${directory}/${filename}.png" | pb -f | tr -d '\n' | xc
alert "Saved screenshot to ${directory}/${filename}.png and uploaded to $(xp)"
command_loc="$(command -v "alert" 2> /dev/null)"
if [ ${flag_upload} -gt 0 ]; then
echo "${directory}/${filename}.png" | pb -f | tr -d '\n' | xclip -selection clipboard
if [ ! -z "$command_loc" ]; then
alert "Saved screenshot to ${directory}/${filename}.png and uploaded to $(xp)"
else
export EDITOR="nano"
fi
else
if [ ! -z "$command_loc" ]; then
alert "Saved screenshot to ${directory}/${filename}.png"
else
export EDITOR="nano"
fi
fi