initial commit

This commit is contained in:
Arne Swanson 2018-08-15 23:31:28 -03:00
commit 2a16f20c4c
3 changed files with 62 additions and 0 deletions

12
Makefile Normal file
View File

@ -0,0 +1,12 @@
PREFIX?="/usr/local"
BINDIR?="$(PREFIX)/bin"
install:
@echo Installing the executable to $(BINDIR)
@mkdir -p "$(BINDIR)"
@cp -f shot "$(BINDIR)/shot"
@chmod 755 "$(BINDIR)/shot"
uninstall:
@echo Removing the executable from $(BINDIR)
@rm -f $(BINDIR)/shot

13
README.md Normal file
View File

@ -0,0 +1,13 @@
# shot
## dependencies
shot needs `imagemagick` for taking screenshot,
[pb][0] for uploading to 0x0,
and `xclip` for copying links.
## installation
```bash
mk install
```

37
shot Executable file
View File

@ -0,0 +1,37 @@
#!/bin/bash
args=`getopt w $*`
eval set -- "${args}"
directory="${HOME}/files/shot"
flag_window=0
while true; do
case "$1" in
-w)
flag_window=1
shift
;;
--)
shift
break
;;
*)
exit 3
;;
esac
done
if [ -z $1 ]; then
filename="$(date +'screen_%T_%F')"
else
filename="${$1}"
fi
if [ ${flag_window} -gt 0 ]; then
import -window root "${directory}/${filename}.png"
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)"