108 lines
2.5 KiB
Bash
Executable File
108 lines
2.5 KiB
Bash
Executable File
#!/bin/sh
|
|
# /usr/bin/mb-scrot
|
|
# based on simple screenshot-script using scrot for manjaro-i3 by oberon@manjaro.org
|
|
|
|
|
|
|
|
_conf=$HOME/.config/mb-scrot.conf
|
|
|
|
if ! [ -f $_conf ]; then
|
|
echo "scrot_dir=$(xdg-user-dir PICTURES)" > $_conf
|
|
fi
|
|
|
|
source $_conf
|
|
|
|
if ! [ -d $scrot_dir ]; then
|
|
mkdir -p $scrot_dir
|
|
fi
|
|
|
|
case $LANG in
|
|
pl*)
|
|
SCROT_5="Zrzut ekranu zostanie wykonany za 5 sekund"
|
|
SCROT_10="Zrzut ekranu zostanie wykonany za 10 sekund"
|
|
SAVED="Zrzut ekranu został zapisany w "
|
|
SELECT_AREA="Zaznacz obszar lub kliknij okno"
|
|
HLP="dostępne opcje:
|
|
-d | --desk pełny ekran
|
|
-w | --window aktywne okno
|
|
-s | --select zaznaczenie
|
|
-h | --help pokaż pomoc
|
|
Domyślną opcją jest 'pełny ekran'.
|
|
Katalog zapisu może być ustawiony w ${_conf}.
|
|
Domyślnym katalogiem jest $scrot_dir
|
|
"
|
|
MISSING="== ! mb-scrot: brak lub błędny argument ! =="
|
|
;;
|
|
*)
|
|
SCROT_5="screenshot will be taken in 5 second"
|
|
SCROT_10="screenshot will be taken in 10 second"
|
|
SAVED="screenshot has been saved in "
|
|
SELECT_AREA="select an area or click window for the screenshot'"
|
|
HLP="available options:
|
|
-d | --desk full screen
|
|
-w | --window active window
|
|
-s | --select selection
|
|
-h | --help display this information
|
|
Default option is 'full screen'.
|
|
The file destination can be set in ${_conf}.
|
|
Default is $scrot_dir
|
|
"
|
|
MISSING="== ! mb-scrot: missing or wrong argument ! =="
|
|
;;
|
|
esac
|
|
|
|
|
|
case "$1" in
|
|
--desk|-d|$NULL)
|
|
cd $scrot_dir
|
|
scrot &&
|
|
sleep 1 &&
|
|
notify-send -i photo "$SAVED $scrot_dir"
|
|
;;
|
|
--window|-w)
|
|
cd $scrot_dir
|
|
scrot -u &&
|
|
sleep 1 &&
|
|
notify-send -i photo "$SAVED $scrot_dir"
|
|
;;
|
|
--select|-s)
|
|
cd $scrot_dir
|
|
notify-send -i photo "$SELECT_AREA" &
|
|
scrot -fs &&
|
|
sleep 1 && notify-send -i photo "$SAVED $scrot_dir"
|
|
;;
|
|
-5)
|
|
cd $scrot_dir
|
|
notify-send -i photo -t 2000 "$SCROT_5"
|
|
scrot -d 5&&
|
|
sleep 1 &&
|
|
notify-send -i photo "$SAVED $scrot_dir"
|
|
;;
|
|
-10)
|
|
cd $scrot_dir
|
|
notify-send -i photo -t 6000 "$SCROT_10"
|
|
scrot -d 10&&
|
|
sleep 1 &&
|
|
notify-send -i photo "$SAVED $scrot_dir"
|
|
;;
|
|
--multi|-m)
|
|
cd $scrot_dir
|
|
scrot -m &&
|
|
sleep 1 &&
|
|
notify-send -i photo "$SAVED $scrot_dir"
|
|
;;
|
|
|
|
--help|-h)
|
|
echo "$HLP"
|
|
;;
|
|
*)
|
|
echo "
|
|
$MISSING
|
|
$HLP
|
|
"
|
|
|
|
exit 2
|
|
esac
|
|
|
|
exit 0
|