dwm: Add scrot script and config we use for dwm

This commit is contained in:
Sanchayan Maity 2020-10-30 16:36:04 +05:30
parent 3691d67298
commit d512d2d629
2 changed files with 82 additions and 0 deletions

View file

@ -0,0 +1 @@
scrot_dir=/home/core/Pictures

81
dwm/.local/bin/dwm-scrot Executable file
View file

@ -0,0 +1,81 @@
#!/bin/sh
# /usr/bin/dwm-scrot
#
# simple screenshot-script using scrot
# originally taken from manjaro-i3
_conf=$HOME/.config/dwm-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
if ! [[ -z "$2" ]]; then
cmd="scrot -d $2"
else
cmd='scrot'
fi
case "$1" in
--desk|-d|$NULL)
cd $scrot_dir
$cmd &&
sleep 1 &&
notify-send "screenshot has been saved in $scrot_dir"
;;
--window|-w)
cd $scrot_dir
$cmd -u &&
sleep 1 &&
notify-send "screenshot has been saved in $scrot_dir"
;;
--select|-s)
cd $scrot_dir
notify-send 'select an area for the screenshot' &
scrot -s &&
sleep 1 && notify-send "screenshot has been saved in $scrot_dir"
;;
--help|-h)
echo "
available options:
-d | --desk full screen
-w | --window active window
-s | --select selection
-h | --help display this information
The -d or -w options can be used with a delay
by adding the number of seconds, like for example:
'dwm-scrot -w 5'
Default option is 'full screen'.
The file destination can be set in ${_conf}.
Default is $scrot_dir
"
;;
*)
echo "
== ! dwm-scrot: missing or wrong argument ! ==
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
"
exit 2
esac
exit 0