-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscreenshot
executable file
·43 lines (41 loc) · 1.1 KB
/
screenshot
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/bash
# Edgar Uriel Domínguez Espinoza
help() {
echo "Script que captura pantallas con ayuda de import (ImageMagick)"
echo "screenshot [OPCIONES]"
echo "Opciones:"
echo "-m <MODE> Opciones: window - Regresa un cursor para seleccionar una ventana"
echo " root - Toma la imagen de toda la pantalla (default)"
echo " tty - Toma la imagen del tty actual"
echo "-f <FILE> Archivo donde se guardará la imagen. El formato será:"
echo " <FILE>-YYYYMMDD-HHMMSS por default es: screenshot"
exit 0
}
# Begin Script
DATE=$(date +%Y%m%d-%H%M%S)
FILE=screenshot
if [[ $1 == "-h" ]]; then
help
else
while getopts m:f: option
do
case "${option}"
in
m) MODE=${OPTARG} ;;
f) FILE=${OPTARG} ;;
esac
done
FILE_NAME=$HOME/Pictures/Screenshots/$FILE-`date +%Y%m%d-%H%M%S`.jpg
case $MODE in
window)
import $FILE_NAME ;;
root)
import -window root $FILE_NAME ;;
tty)
fbgrab $FILE_NAME ;;
*)
help ;;
esac
exit 0
fi